Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=68ca3e537f12044af05a653fa9d28b4fe80117e8
Commit:     68ca3e537f12044af05a653fa9d28b4fe80117e8
Parent:     2507bc1338e43eadfef5b604d2c47e4f8180718f
Author:     Haavard Skinnemoen <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 3 18:04:11 2007 +0100
Committer:  Haavard Skinnemoen <[EMAIL PROTECTED]>
CommitDate: Fri Dec 7 14:54:47 2007 +0100

    [AVR32] Fix copy_to_user_page() breakage
    
    The current implementation of copy_to_user_page() gives "vaddr" to the
    cache instruction when trying to sync the icache with the dcache. If
    vaddr does not exist in the TLB, the CPU will silently abort the
    operation, which may result in the caches staying out of sync.
    
    To fix this, pass the "dst" parameter to flush_icache_range() instead
    -- we know this is valid because we just wrote to it.
    
    Signed-off-by: Haavard Skinnemoen <[EMAIL PROTECTED]>
---
 arch/avr32/mm/cache.c          |   20 ++++++++++----------
 include/asm-avr32/cacheflush.h |   19 ++++++++++---------
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index c1233c6..15a4e5e 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -122,16 +122,6 @@ void flush_icache_page(struct vm_area_struct *vma, struct 
page *page)
        }
 }
 
-/*
- * This one is used by copy_to_user_page()
- */
-void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
-                            unsigned long addr, int len)
-{
-       if (vma->vm_flags & VM_EXEC)
-               flush_icache_range(addr, addr + len);
-}
-
 asmlinkage int sys_cacheflush(int operation, void __user *addr, size_t len)
 {
        int ret;
@@ -159,3 +149,13 @@ asmlinkage int sys_cacheflush(int operation, void __user 
*addr, size_t len)
 out:
        return ret;
 }
+
+void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
+               unsigned long vaddr, void *dst, const void *src,
+               unsigned long len)
+{
+       memcpy(dst, src, len);
+       if (vma->vm_flags & VM_EXEC)
+               flush_icache_range((unsigned long)dst,
+                               (unsigned long)dst + len);
+}
diff --git a/include/asm-avr32/cacheflush.h b/include/asm-avr32/cacheflush.h
index dfaaa88..6706747 100644
--- a/include/asm-avr32/cacheflush.h
+++ b/include/asm-avr32/cacheflush.h
@@ -116,15 +116,16 @@ extern void flush_icache_page(struct vm_area_struct *vma, 
struct page *page);
  * flush with all configurations.
  */
 extern void flush_icache_range(unsigned long start, unsigned long end);
-extern void flush_icache_user_range(struct vm_area_struct *vma,
-                                   struct page *page,
-                                   unsigned long addr, int len);
 
-#define copy_to_user_page(vma, page, vaddr, dst, src, len) do {        \
-       memcpy(dst, src, len);                                  \
-       flush_icache_user_range(vma, page, vaddr, len);         \
-} while(0)
-#define copy_from_user_page(vma, page, vaddr, dst, src, len)   \
-       memcpy(dst, src, len)
+extern void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
+               unsigned long vaddr, void *dst, const void *src,
+               unsigned long len);
+
+static inline void copy_from_user_page(struct vm_area_struct *vma,
+               struct page *page, unsigned long vaddr, void *dst,
+               const void *src, unsigned long len)
+{
+       memcpy(dst, src, len);
+}
 
 #endif /* __ASM_AVR32_CACHEFLUSH_H */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to