From patchwork Mon Jun 29 08:11:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Pringle X-Patchwork-Id: 29285 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id A85F8B707C for ; Tue, 30 Jun 2009 00:31:55 +1000 (EST) Received: by ozlabs.org (Postfix) id 99764DDD1B; Tue, 30 Jun 2009 00:31:55 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 9687ADDD0C for ; Tue, 30 Jun 2009 00:31:55 +1000 (EST) Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id B1837B72DA for ; Tue, 30 Jun 2009 00:31:30 +1000 (EST) Received: from oxtel.com (mail.oxtel.com [193.200.114.15]) by bilbo.ozlabs.org (Postfix) with ESMTP id C553EB707C for ; Mon, 29 Jun 2009 18:13:27 +1000 (EST) Received: from [10.96.99.86] ([127.0.0.1]) by oxtel.com ([127.0.0.1] running VPOP3) with ESMTP; Mon, 29 Jun 2009 09:11:13 +0100 Message-ID: <4A487720.5080500@oxtel.com> Date: Mon, 29 Jun 2009 09:11:12 +0100 From: Chris Pringle User-Agent: Thunderbird 2.0.0.21 (X11/20090409) MIME-Version: 1.0 To: Sergej.Stepanov@ids.de Subject: Re: AW: PowerPC PCI DMA issues (prefetch/coherency?) References: <4A37A503.3030209@oxtel.com> <20090616162114.GA5051@loki.buserror.net> <4A37C97A.5050508@oxtel.com> <4A37CC72.3060709@freescale.com> <4A37CF02.5080906@oxtel.com> <4A37D073.6020802@freescale.com> <4A38A21B.5060306@oxtel.com> <4A38ED31.9030705@oxtel.com>,<4A3A23FA.1000407@oxtel.com> <4206182445660643B9AEB8D4E55BBD0A08533B67B5@HERMES2> In-Reply-To: <4206182445660643B9AEB8D4E55BBD0A08533B67B5@HERMES2> X-Authenticated-Sender: chris.pringle X-Server: VPOP3 Enterprise V2.6.0b - Registered X-Mailman-Approved-At: Tue, 30 Jun 2009 00:31:20 +1000 Cc: scottwood@freescale.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Hi Sergej, I've attached the patch used to fix this issue. Both the patch to pgtable32.h and head_32.S are required in order to make it work. The change to pgtable32.h ensures that all pages are marked cache coherent (results in setting the M bit). The change to head_32.S ensures that the M bit is not unconditionally masked out - it should only be masked out if CPU_FTR_NEED_COHERENT is not set. Hope this helps. Cheers, Chris Sergej.Stepanov@ids.de wrote: >> The other part of the fix is in asm-powerpc/pgtable32.h. _PAGE_BASE >> needs _PAGE_COHERENT in order to work correctly, and in fact there is >> now a comment in there to that affect in 2.6.29. Backporting that change >> has made it work on 2.6.26. Both this patch, and the fix to head_32.S >> are needed for it to work correctly on older kernels. >> >> Chris >> > > Hello Chris, > > sorry for dummy, but if it possible, could you, please, send a corresponding summary patch of backporting you've done for older kernels? > or just summary of that changes once again? > > Many thanks > > Sergej. diff -r -U3 ./arch/powerpc/kernel/head_32.S ../../kernel.WORKS/linux-2.6.26/arch/powerpc/kernel/head_32.S --- ./arch/powerpc/kernel/head_32.S 2008-07-13 22:51:29.000000000 +0100 +++ ../../kernel.WORKS/linux-2.6.26/arch/powerpc/kernel/head_32.S 2009-06-17 18:18:04.000000000 +0100 @@ -501,8 +501,11 @@ and r1,r1,r2 /* writable if _RW and _DIRTY */ rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */ rlwimi r3,r3,32-1,31,31 /* _PAGE_USER -> PP lsb */ - ori r1,r1,0xe14 /* clear out reserved bits and M */ + ori r1,r1,0xe04 /* clear out reserved bits */ andc r1,r3,r1 /* PP = user? (rw&dirty? 2: 3): 0 */ +BEGIN_FTR_SECTION + rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ +END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) mtspr SPRN_RPA,r1 mfspr r3,SPRN_IMISS tlbli r3 @@ -575,8 +578,12 @@ and r1,r1,r2 /* writable if _RW and _DIRTY */ rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */ rlwimi r3,r3,32-1,31,31 /* _PAGE_USER -> PP lsb */ - ori r1,r1,0xe14 /* clear out reserved bits and M */ + ori r1,r1,0xe04 /* clear out reserved bits */ andc r1,r3,r1 /* PP = user? (rw&dirty? 2: 3): 0 */ +BEGIN_FTR_SECTION + rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ +END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) + /*ori r1,r1,0x10*/ mtspr SPRN_RPA,r1 mfspr r3,SPRN_DMISS tlbld r3 @@ -643,8 +650,12 @@ stw r3,0(r2) /* update PTE (accessed/dirty bits) */ /* Convert linux-style PTE to low word of PPC-style PTE */ rlwimi r3,r3,32-1,30,30 /* _PAGE_USER -> PP msb */ - li r1,0xe15 /* clear out reserved bits and M */ + li r1,0xe05 /* clear out reserved bits & PP lsb */ andc r1,r3,r1 /* PP = user? 2: 0 */ +BEGIN_FTR_SECTION + rlwinm r1,r1,0,~_PAGE_COHERENT /* clear M (coherence not required) */ +END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) + /*ori r1,r1,0x10*/ mtspr SPRN_RPA,r1 mfspr r3,SPRN_DMISS tlbld r3 diff -r -U3 ./include/asm-powerpc/pgtable-ppc32.h ../../kernel.WORKS/linux-2.6.26/include/asm-powerpc/pgtable-ppc32.h --- ./include/asm-powerpc/pgtable-ppc32.h 2008-07-13 22:51:29.000000000 +0100 +++ ../../kernel.WORKS/linux-2.6.26/include/asm-powerpc/pgtable-ppc32.h 2009-06-18 12:11:57.000000000 +0100 @@ -408,7 +408,7 @@ #ifdef CONFIG_44x #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_GUARDED) #else -#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED) +#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) #endif #define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE) #define _PAGE_KERNEL (_PAGE_BASE | _PAGE_SHARED | _PAGE_WRENABLE)