All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Pringle <chris.pringle@oxtel.com>
To: Sergej.Stepanov@ids.de
Cc: scottwood@freescale.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Re: AW: PowerPC PCI DMA issues (prefetch/coherency?)
Date: Mon, 29 Jun 2009 09:11:12 +0100	[thread overview]
Message-ID: <4A487720.5080500@oxtel.com> (raw)
In-Reply-To: <4206182445660643B9AEB8D4E55BBD0A08533B67B5@HERMES2>

[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]

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.


-- 

______________________________
Chris Pringle
Software Engineer

Miranda Technologies Ltd.
Hithercroft Road
Wallingford
Oxfordshire OX10 9DG
UK

Tel. +44 1491 820206
Fax. +44 1491 820001
www.miranda.com


____________________________

Miranda Technologies Limited
Registered in England and Wales CN 02017053
Registered Office: James House, Mere Park, Dedmere Road, Marlow, Bucks, SL7 1FJ

[-- Attachment #2: dma-cache-coherency-fix.patch --]
[-- Type: text/x-patch, Size: 2590 bytes --]

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)

  reply	other threads:[~2009-06-29  8:13 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 13:58 PowerPC PCI DMA issues (prefetch/coherency?) Chris Pringle
2009-06-16 14:16 ` Michael S. Zick
2009-06-16 14:59 ` Hu Gang
2009-06-16 16:21 ` Scott Wood
2009-06-16 16:34   ` Chris Pringle
2009-06-16 16:46     ` Scott Wood
2009-06-16 16:46       ` Scott Wood
2009-06-16 16:57       ` Chris Pringle
2009-06-16 16:57         ` Chris Pringle
2009-06-16 17:03         ` Scott Wood
2009-06-16 17:03           ` Scott Wood
2009-06-16 17:43           ` Arnd Bergmann
2009-06-16 17:49             ` Scott Wood
2009-06-16 17:49               ` Scott Wood
2009-06-16 18:02               ` Arnd Bergmann
2009-06-16 18:02                 ` Arnd Bergmann
2009-06-17  0:18                 ` Benjamin Herrenschmidt
2009-06-17  0:37                   ` FUJITA Tomonori
2009-06-17  0:37                     ` FUJITA Tomonori
2009-06-17  0:56                     ` Leon Woestenberg
2009-06-17  0:56                       ` Leon Woestenberg
2009-06-17  1:08                       ` Benjamin Herrenschmidt
2009-06-17  1:08                         ` Benjamin Herrenschmidt
2009-06-17  1:13                         ` Leon Woestenberg
2009-06-17  1:13                           ` Leon Woestenberg
2009-06-17  1:07                     ` Benjamin Herrenschmidt
2009-06-17  1:07                       ` Benjamin Herrenschmidt
2009-06-17  7:58           ` Chris Pringle
2009-06-17  7:58             ` Chris Pringle
2009-06-17 13:18             ` Chris Pringle
2009-06-18 11:24               ` Chris Pringle
2009-06-22 14:31                 ` AW: " Sergej.Stepanov
2009-06-22 14:31                   ` Sergej.Stepanov
2009-06-29  8:11                   ` Chris Pringle [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-09-02 21:22 Adam Zilkie
2009-09-03  8:05 ` Chris Pringle
2009-09-03  9:57   ` Benjamin Herrenschmidt
2009-09-03 16:04     ` Adam Zilkie
2009-09-03 16:21       ` Josh Boyer
2009-09-03 20:27       ` Prodyut Hazarika
2009-09-08 18:01         ` Adam Zilkie
2009-09-08 18:59           ` Prodyut Hazarika
2009-09-08 19:30             ` Adam Zilkie
2009-09-08 19:56               ` Prodyut Hazarika
2009-09-08 20:00                 ` Adam Zilkie
2009-09-09  1:34                   ` Benjamin Herrenschmidt
2009-09-08 21:34               ` Benjamin Herrenschmidt
2009-09-09 13:28             ` Mikhail Zolotaryov
2009-09-09 13:43               ` Tom Burns
2009-09-09 14:12                 ` Mikhail Zolotaryov
2009-09-09 14:10                   ` Tom Burns
2009-09-09 14:40                     ` Mikhail Zolotaryov
2009-09-11  1:57                       ` Benjamin Herrenschmidt
2009-09-11  7:17                         ` Mikhail Zolotaryov
2009-09-11  7:31                           ` Benjamin Herrenschmidt
2009-09-11  1:57                     ` Benjamin Herrenschmidt
2009-09-10 19:53                   ` Tom Burns
2009-09-10 20:30                     ` Pravin Bathija
2009-09-11  2:44                       ` Benjamin Herrenschmidt
2009-09-11  5:12                         ` Stefan Roese
2009-09-11  5:17                           ` Benjamin Herrenschmidt
2009-09-11  5:25                             ` Stefan Roese
2009-09-11  5:35                               ` Pravin Bathija
2009-09-11  5:40                                 ` Benjamin Herrenschmidt
2009-09-11  9:23                                   ` Pravin Bathija
2009-09-11  1:59                     ` Benjamin Herrenschmidt
2009-09-11 16:05                     ` Prodyut Hazarika
2009-09-11  1:55                 ` Benjamin Herrenschmidt
2009-09-11 13:51                   ` Tom Burns
2009-09-08 21:29           ` Benjamin Herrenschmidt
2009-09-03 12:20   ` Wrobel Heinz-R39252
2009-09-03 12:43     ` Chris Pringle
2009-09-06 21:32     ` Benjamin Herrenschmidt
2009-09-03 15:54   ` Adam Zilkie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A487720.5080500@oxtel.com \
    --to=chris.pringle@oxtel.com \
    --cc=Sergej.Stepanov@ids.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.