Commit 09f5dc44 authored by David Gibson's avatar David Gibson Committed by Paul Mackerras

[PATCH] powerpc: Cleanup, consolidating icache dirtying logic

The code to mark a page as icache dirty (so that it will later be
icache-dcache flushed when we try to execute from it) is duplicated in
three places: flush_dcache_page() does this marking and nothing else,
but clear_user_page() and copy_user_page() duplicate it, since those
functions make the page icache dirty themselves.

This patch makes those other functions call flush_dcache_page()
instead, so the logic's all in one place.  This will make life less
confusing if we ever need to tweak the details of the the lazy icache
flush mechanism.

 arch/powerpc/mm/mem.c |   14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
Signed-off-by: default avatarDavid Gibson <dwg@au1.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 95eff20f
...@@ -435,17 +435,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg) ...@@ -435,17 +435,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
{ {
clear_page(page); clear_page(page);
if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
return;
/* /*
* We shouldnt have to do this, but some versions of glibc * We shouldnt have to do this, but some versions of glibc
* require it (ld.so assumes zero filled pages are icache clean) * require it (ld.so assumes zero filled pages are icache clean)
* - Anton * - Anton
*/ */
flush_dcache_page(pg);
/* avoid an atomic op if possible */
if (test_bit(PG_arch_1, &pg->flags))
clear_bit(PG_arch_1, &pg->flags);
} }
EXPORT_SYMBOL(clear_user_page); EXPORT_SYMBOL(clear_user_page);
...@@ -469,12 +464,7 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, ...@@ -469,12 +464,7 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
return; return;
#endif #endif
if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) flush_dcache_page(pg);
return;
/* avoid an atomic op if possible */
if (test_bit(PG_arch_1, &pg->flags))
clear_bit(PG_arch_1, &pg->flags);
} }
void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
......
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