public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PPC32: Fix __flush_dcache_icache_phys() for Book E
@ 2004-05-11  0:05 Matt Porter
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Porter @ 2004-05-11  0:05 UTC (permalink / raw)
  To: akpm; +Cc: paulus, linux-kernel, linuxppc-dev

This patch implements/uses __flush_dcache_icache_page() which
kmaps on a Book E part, but keeps the existing behavior on other
PowerPCs which can disable the MMU. Please apply.
 
-Matt

diff -Nru a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
--- a/arch/ppc/mm/fault.c	Mon May 10 15:25:17 2004
+++ b/arch/ppc/mm/fault.c	Mon May 10 15:25:17 2004
@@ -227,8 +227,7 @@
 			struct page *page = pte_page(*ptep);
 
 			if (! test_bit(PG_arch_1, &page->flags)) {
-				unsigned long phys = page_to_pfn(page) << PAGE_SHIFT;
-				__flush_dcache_icache_phys(phys);
+				flush_dcache_icache_page(page);
 				set_bit(PG_arch_1, &page->flags);
 			}
 			pte_update(ptep, 0, _PAGE_HWEXEC);
diff -Nru a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
--- a/arch/ppc/mm/init.c	Mon May 10 15:25:17 2004
+++ b/arch/ppc/mm/init.c	Mon May 10 15:25:17 2004
@@ -572,6 +572,16 @@
 	clear_bit(PG_arch_1, &page->flags);
 }
 
+void flush_dcache_icache_page(struct page *page)
+{
+#ifdef CONFIG_BOOKE
+	__flush_dcache_icache(kmap(page));
+	kunmap(page);
+#else
+	__flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
+#endif
+
+}
 void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
 {
 	clear_page(page);
@@ -614,7 +624,7 @@
 			if (vma->vm_mm == current->active_mm)
 				__flush_dcache_icache((void *) address);
 			else
-				__flush_dcache_icache_phys(pfn << PAGE_SHIFT);
+				flush_dcache_icache_page(page);
 			set_bit(PG_arch_1, &page->flags);
 		}
 	}
diff -Nru a/include/asm-ppc/cacheflush.h b/include/asm-ppc/cacheflush.h
--- a/include/asm-ppc/cacheflush.h	Mon May 10 15:25:17 2004
+++ b/include/asm-ppc/cacheflush.h	Mon May 10 15:25:17 2004
@@ -41,6 +41,6 @@
 
 extern void __flush_dcache_icache(void *page_va);
 extern void __flush_dcache_icache_phys(unsigned long physaddr);
-
+extern void flush_dcache_icache_page(struct page *page);
 #endif /* _PPC_CACHEFLUSH_H */
 #endif /* __KERNEL__ */

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] PPC32: Fix __flush_dcache_icache_phys() for Book E
@ 2004-05-11  0:30 Matt Porter
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Porter @ 2004-05-11  0:30 UTC (permalink / raw)
  To: Administrator; +Cc: paulus, linux-kernel, linuxppc-dev


This patch implements/uses __flush_dcache_icache_page() which
kmaps on a Book E part, but keeps the existing behavior on other
PowerPCs which can disable the MMU. Please apply.

-Matt

diff -Nru a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
--- a/arch/ppc/mm/fault.c	Mon May 10 15:25:17 2004
+++ b/arch/ppc/mm/fault.c	Mon May 10 15:25:17 2004
@@ -227,8 +227,7 @@
 			struct page *page = pte_page(*ptep);

 			if (! test_bit(PG_arch_1, &page->flags)) {
-				unsigned long phys = page_to_pfn(page) << PAGE_SHIFT;
-				__flush_dcache_icache_phys(phys);
+				flush_dcache_icache_page(page);
 				set_bit(PG_arch_1, &page->flags);
 			}
 			pte_update(ptep, 0, _PAGE_HWEXEC);
diff -Nru a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
--- a/arch/ppc/mm/init.c	Mon May 10 15:25:17 2004
+++ b/arch/ppc/mm/init.c	Mon May 10 15:25:17 2004
@@ -572,6 +572,16 @@
 	clear_bit(PG_arch_1, &page->flags);
 }

+void flush_dcache_icache_page(struct page *page)
+{
+#ifdef CONFIG_BOOKE
+	__flush_dcache_icache(kmap(page));
+	kunmap(page);
+#else
+	__flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
+#endif
+
+}
 void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
 {
 	clear_page(page);
@@ -614,7 +624,7 @@
 			if (vma->vm_mm == current->active_mm)
 				__flush_dcache_icache((void *) address);
 			else
-				__flush_dcache_icache_phys(pfn << PAGE_SHIFT);
+				flush_dcache_icache_page(page);
 			set_bit(PG_arch_1, &page->flags);
 		}
 	}
diff -Nru a/include/asm-ppc/cacheflush.h b/include/asm-ppc/cacheflush.h
--- a/include/asm-ppc/cacheflush.h	Mon May 10 15:25:17 2004
+++ b/include/asm-ppc/cacheflush.h	Mon May 10 15:25:17 2004
@@ -41,6 +41,6 @@

 extern void __flush_dcache_icache(void *page_va);
 extern void __flush_dcache_icache_phys(unsigned long physaddr);
-
+extern void flush_dcache_icache_page(struct page *page);
 #endif /* _PPC_CACHEFLUSH_H */
 #endif /* __KERNEL__ */

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-11  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-11  0:05 [PATCH] PPC32: Fix __flush_dcache_icache_phys() for Book E Matt Porter
  -- strict thread matches above, loose matches on Subject: below --
2004-05-11  0:30 Matt Porter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox