Commit 4bab667f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

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

From: Matt Porter <mporter@kernel.crashing.org>

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.
parent 239adc58
...@@ -227,8 +227,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -227,8 +227,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
struct page *page = pte_page(*ptep); struct page *page = pte_page(*ptep);
if (! test_bit(PG_arch_1, &page->flags)) { if (! test_bit(PG_arch_1, &page->flags)) {
unsigned long phys = page_to_pfn(page) << PAGE_SHIFT; flush_dcache_icache_page(page);
__flush_dcache_icache_phys(phys);
set_bit(PG_arch_1, &page->flags); set_bit(PG_arch_1, &page->flags);
} }
pte_update(ptep, 0, _PAGE_HWEXEC); pte_update(ptep, 0, _PAGE_HWEXEC);
......
...@@ -572,6 +572,16 @@ void flush_dcache_page(struct page *page) ...@@ -572,6 +572,16 @@ void flush_dcache_page(struct page *page)
clear_bit(PG_arch_1, &page->flags); 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) void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
{ {
clear_page(page); clear_page(page);
...@@ -614,7 +624,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, ...@@ -614,7 +624,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
if (vma->vm_mm == current->active_mm) if (vma->vm_mm == current->active_mm)
__flush_dcache_icache((void *) address); __flush_dcache_icache((void *) address);
else else
__flush_dcache_icache_phys(pfn << PAGE_SHIFT); flush_dcache_icache_page(page);
set_bit(PG_arch_1, &page->flags); set_bit(PG_arch_1, &page->flags);
} }
} }
......
...@@ -41,6 +41,6 @@ do { memcpy(dst, src, len); \ ...@@ -41,6 +41,6 @@ do { memcpy(dst, src, len); \
extern void __flush_dcache_icache(void *page_va); extern void __flush_dcache_icache(void *page_va);
extern void __flush_dcache_icache_phys(unsigned long physaddr); extern void __flush_dcache_icache_phys(unsigned long physaddr);
extern void flush_dcache_icache_page(struct page *page);
#endif /* _PPC_CACHEFLUSH_H */ #endif /* _PPC_CACHEFLUSH_H */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment