From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6626 invoked by alias); 22 Aug 2008 18:58:29 -0000 Received: (qmail 6616 invoked by uid 22791); 22 Aug 2008 18:58:28 -0000 X-Spam-Check-By: sourceware.org Received: from outbound-dub.frontbridge.com (HELO IE1EHSOBE002.bigfish.com) (213.199.154.16) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 22 Aug 2008 18:57:43 +0000 Received: from mail156-dub-R.bigfish.com (10.5.252.3) by IE1EHSOBE002.bigfish.com (10.5.252.22) with Microsoft SMTP Server id 8.1.240.5; Fri, 22 Aug 2008 18:57:39 +0000 Received: from mail156-dub (localhost.localdomain [127.0.0.1]) by mail156-dub-R.bigfish.com (Postfix) with ESMTP id 6348E12582BE; Fri, 22 Aug 2008 18:57:39 +0000 (UTC) X-BigFish: VS-5(z34a4lz154dM1432R936eQ1805Mzzzzz2dh6bh87il61h) X-Spam-TCS-SCL: 0:0 X-FB-DOMAIN-IP-MATCH: fail Received: by mail156-dub (MessageSwitch) id 1219431458910821_27047; Fri, 22 Aug 2008 18:57:38 +0000 (UCT) Received: from mail8.fw-sd.sony.com (mail8.fw-sd.sony.com [160.33.66.75]) by mail156-dub.bigfish.com (Postfix) with ESMTP id 56FE1F80055; Fri, 22 Aug 2008 18:57:38 +0000 (UTC) Received: from mail3.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com [43.134.1.211]) by mail8.fw-sd.sony.com (8.14.2/8.14.2) with ESMTP id m7MIvb69004869; Fri, 22 Aug 2008 18:57:37 GMT Received: from constantine.playstation.sony.com ([162.49.67.15]) by mail3.sjc.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id m7MIvY9l002569; Fri, 22 Aug 2008 18:57:35 GMT Received: from trevor-ubuntu ([10.98.8.239]) by constantine.playstation.sony.com (Lotus Domino Release 7.0.3FP1) with ESMTP id 2008082211573236-5447 ; Fri, 22 Aug 2008 11:57:32 -0700 Received: from trevor by trevor-ubuntu with local (Exim 4.67) (envelope-from ) id 1KWbpD-0002Z1-UH; Fri, 22 Aug 2008 11:57:31 -0700 Date: Fri, 22 Aug 2008 20:59:00 -0000 From: To: Ulrich Weigand CC: gcc-patches@gcc.gnu.org, andrew_pinski@playstation.sony.com Subject: Re: [PATCH, SPU] Add interrupt-safe critical section functions to spu_mfcio.h Message-ID: <20080822185731.GH27746@playstation.sony.com> References: <200808221644.m7MGiMmj031929@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 In-Reply-To: <200808221644.m7MGiMmj031929@d12av02.megacenter.de.ibm.com> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-SEL-encryption-scan: scanned Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg01710.txt.bz2 Ok for both. Trevor * Ulrich Weigand [2008-08-22 09:45]: > Hello, > > this patch to spu_mfcio.h provides the functions to support interrupt-safe > critical sections as defined in TWG RFC00130-2 (will be included in the > upcoming version 2.6 of the C/C++ Language Extensions for Cell/B.E. > specification). > > OK for mainline and 4.3? > > Bye, > Ulrich > > > ChangeLog: > > * config/spu/spu_mfcio.h (mfc_begin_critical_section): New function. > (mfc_end_critical_section): Likewise. > > > --- gcc-4.3.1/gcc/config/spu/spu_mfcio.h.orig 2008-08-22 16:43:50.000000000 +0200 > +++ gcc-4.3.1/gcc/config/spu/spu_mfcio.h 2008-08-22 16:43:56.000000000 +0200 > @@ -289,6 +289,34 @@ typedef struct mfc_list_element { > #define spu_write_srr0(srr0) spu_writech(SPU_WrSRR0,srr0) > #define spu_read_srr0() spu_readch(SPU_RdSRR0) > > +/* Interrupt-Safe Critical Sections */ > + > +static __inline__ unsigned int mfc_begin_critical_section (void) > + __attribute__ ((__always_inline__)); > + > +static __inline__ unsigned int > +mfc_begin_critical_section (void) > +{ > +#ifdef SPU_MFCIO_INTERRUPT_SAFE > + unsigned int __status = spu_read_machine_status (); > + spu_idisable (); > + return __status; > +#else > + return 0; > +#endif > +} > + > +static __inline__ void mfc_end_critical_section (unsigned int) > + __attribute__ ((__always_inline__)); > + > +static __inline__ void > +mfc_end_critical_section (unsigned int __status __attribute__ ((__unused__))) > +{ > +#ifdef SPU_MFCIO_INTERRUPT_SAFE > + if (__status & 1) > + spu_ienable (); > +#endif > +} > > /* MFC Tag Manager */ > > -- > Dr. Ulrich Weigand > GNU Toolchain for Linux on System z and Cell BE > Ulrich.Weigand@de.ibm.com