[PATCH] PPC32: Fix __flush_dcache_icache_phys() for Book E

From: Matt Porter
Date: Mon May 10 2004 - 19:37:25 EST



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/


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/