]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
sh: wire up clear_user_highpage() for sh4, convert sh7705.
authorPaul Mundt <lethal@linux-sh.org>
Mon, 27 Jul 2009 11:53:22 +0000 (20:53 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 27 Jul 2009 11:53:22 +0000 (20:53 +0900)
This wires up clear_user_highpage() on SH-4 and subsequently converts the
SH7705 32kB cache mode over to using it. Now that the SH-4 implementation
handles all of the dcache purging directly in the aliasing case, there is
no need to do this in the default clear_page() implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/cacheflush.h
arch/sh/include/asm/page.h
arch/sh/include/asm/pgtable.h
arch/sh/kernel/sh_ksyms_32.c
arch/sh/lib/clear_page.S
arch/sh/mm/Makefile_32
arch/sh/mm/pg-nommu.c
arch/sh/mm/pg-sh4.c
arch/sh/mm/pg-sh7705.c [deleted file]

index 4c5462daa74cffaad2f14b05c1e1f58e54097d72..4e360114269d8947bf3d1b5994ef8bc4137826f6 100644 (file)
@@ -49,7 +49,7 @@ static inline void flush_kernel_dcache_page(struct page *page)
        flush_dcache_page(page);
 }
 
-#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
+#if (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)) && !defined(CONFIG_CACHE_OFF)
 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);
index a31ab40040f0a67c845be8413d9859980b7f1a4f..5208b7bfc24e820c8c30667776bfc97810c3a2d5 100644 (file)
@@ -56,21 +56,25 @@ pages_do_alias(unsigned long addr1, unsigned long addr2)
        return (addr1 ^ addr2) & shm_align_mask;
 }
 
-extern void clear_page(void *to);
+
+#define clear_page(page)       memset((void *)(page), 0, PAGE_SIZE)
 extern void copy_page(void *to, void *from);
 
+struct page;
+struct vm_area_struct;
+
 #if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
        (defined(CONFIG_CPU_SH5) || defined(CONFIG_CPU_SH4) || \
         defined(CONFIG_SH7705_CACHE_32KB))
-struct page;
-struct vm_area_struct;
 extern void clear_user_page(void *to, unsigned long address, struct page *page);
 extern void copy_user_page(void *to, void *from, unsigned long address,
                           struct page *page);
-#if defined(CONFIG_CPU_SH4)
+#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
 extern void copy_user_highpage(struct page *to, struct page *from,
                               unsigned long vaddr, struct vm_area_struct *vma);
 #define __HAVE_ARCH_COPY_USER_HIGHPAGE
+extern void clear_user_highpage(struct page *page, unsigned long vaddr);
+#define clear_user_highpage    clear_user_highpage
 #endif
 #else
 #define clear_user_page(page, vaddr, pg)       clear_page(page)
index d9f68f9c3cb341cc2e00e30a0c7a59043b5629f6..bef3ab7fc09ed27e562535a78c31e2e64a711e86 100644 (file)
@@ -141,7 +141,8 @@ extern void paging_init(void);
 extern void page_table_range_init(unsigned long start, unsigned long end,
                                  pgd_t *pgd);
 
-#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_CPU_SH4) && defined(CONFIG_MMU)
+#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \
+    defined(CONFIG_SH7705_CACHE_32KB)) && defined(CONFIG_MMU)
 extern void kmap_coherent_init(void);
 #else
 #define kmap_coherent_init()   do { } while (0)
index cec610888e283d19a575eea5bbd33c0eed0c996d..8dbe26b17c4486362b628a068c95ac8334740bfb 100644 (file)
@@ -101,11 +101,6 @@ EXPORT_SYMBOL(flush_cache_range);
 EXPORT_SYMBOL(flush_dcache_page);
 #endif
 
-#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
-       (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB))
-EXPORT_SYMBOL(clear_user_page);
-#endif
-
 #ifdef CONFIG_MCOUNT
 DECLARE_EXPORT(mcount);
 #endif
@@ -114,7 +109,6 @@ EXPORT_SYMBOL(csum_partial_copy_generic);
 #ifdef CONFIG_IPV6
 EXPORT_SYMBOL(csum_ipv6_magic);
 #endif
-EXPORT_SYMBOL(clear_page);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(__clear_user);
 EXPORT_SYMBOL(_ebss);
index 8342bfbde64c23a1f1128785b1ed810ba4f46b86..bee9817e055d30eeee2937b38daf6a50179031d5 100644 (file)
@@ -8,52 +8,6 @@
 #include <linux/linkage.h>
 #include <asm/page.h>
 
-/*
- * clear_page
- * @to: P1 address
- *
- * void clear_page(void *to)
- */
-
-/*
- * r0 --- scratch
- * r4 --- to
- * r5 --- to + PAGE_SIZE
- */
-ENTRY(clear_page)
-       mov     r4,r5
-       mov.l   .Llimit,r0
-       add     r0,r5
-       mov     #0,r0
-       !
-1:
-#if defined(CONFIG_CPU_SH4)
-       movca.l r0,@r4
-       mov     r4,r1
-#else
-       mov.l   r0,@r4
-#endif
-       add     #32,r4
-       mov.l   r0,@-r4
-       mov.l   r0,@-r4
-       mov.l   r0,@-r4
-       mov.l   r0,@-r4
-       mov.l   r0,@-r4
-       mov.l   r0,@-r4
-       mov.l   r0,@-r4
-#if defined(CONFIG_CPU_SH4)
-       ocbwb   @r1
-#endif
-       cmp/eq  r5,r4
-       bf/s    1b
-        add    #28,r4
-       !
-       rts
-        nop
-
-       .balign 4
-.Llimit:       .long   (PAGE_SIZE-28)
-
 ENTRY(__clear_user)
        !
        mov     #0, r0
index 986a1e0558348dfe2d8ef11873350918a28639ac..5c04bbb08d36806b87010619fa42bc717f7a3886 100644 (file)
@@ -31,7 +31,7 @@ tlb-$(CONFIG_CPU_HAS_PTEAEX)  := tlb-pteaex.o
 obj-y                          += $(tlb-y)
 ifndef CONFIG_CACHE_OFF
 obj-$(CONFIG_CPU_SH4)          += pg-sh4.o
-obj-$(CONFIG_SH7705_CACHE_32KB)        += pg-sh7705.o
+obj-$(CONFIG_SH7705_CACHE_32KB)        += pg-sh4.o
 endif
 endif
 
index 91ed4e695ff7cd0e9624583c777eab2215411b69..7e33b486b7e906bd8384b4c2c115c7965fbe5795 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/sh/mm/pg-nommu.c
  *
- * clear_page()/copy_page() implementation for MMUless SH.
+ * copy_page()/__copy_user()/__clear_user() implementations for MMUless SH.
  *
  * Copyright (C) 2003  Paul Mundt
  *
@@ -20,11 +20,6 @@ void copy_page(void *to, void *from)
        memcpy(to, from, PAGE_SIZE);
 }
 
-void clear_page(void *to)
-{
-       memset(to, 0, PAGE_SIZE);
-}
-
 __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n)
 {
        memcpy(to, from, n);
index f3c4b2a54fc756b2fc6b60e349d5bc20f1ebc8be..4d93070b8220613251be20784d2b91e6acfbe62d 100644 (file)
@@ -2,7 +2,7 @@
  * arch/sh/mm/pg-sh4.c
  *
  * Copyright (C) 1999, 2000, 2002  Niibe Yutaka
- * Copyright (C) 2002 - 2007  Paul Mundt
+ * Copyright (C) 2002 - 2009  Paul Mundt
  *
  * Released under the terms of the GNU GPL v2.0.
  */
@@ -58,20 +58,6 @@ static inline void kunmap_coherent(struct page *page)
        preempt_check_resched();
 }
 
-/*
- * clear_user_page
- * @to: P1 address
- * @address: U0 address to be mapped
- * @page: page (virt_to_page(to))
- */
-void clear_user_page(void *to, unsigned long address, struct page *page)
-{
-       clear_page(to);
-
-       if (pages_do_alias((unsigned long)to, address & PAGE_MASK))
-               __flush_wback_region(to, PAGE_SIZE);
-}
-
 void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
                       unsigned long vaddr, void *dst, const void *src,
                       unsigned long len)
@@ -128,3 +114,16 @@ void copy_user_highpage(struct page *to, struct page *from,
        smp_wmb();
 }
 EXPORT_SYMBOL(copy_user_highpage);
+
+void clear_user_highpage(struct page *page, unsigned long vaddr)
+{
+       void *kaddr = kmap_atomic(page, KM_USER0);
+
+       clear_page(kaddr);
+
+       if (pages_do_alias((unsigned long)kaddr, vaddr & PAGE_MASK))
+               __flush_wback_region(kaddr, PAGE_SIZE);
+
+       kunmap_atomic(kaddr, KM_USER0);
+}
+EXPORT_SYMBOL(clear_user_highpage);
diff --git a/arch/sh/mm/pg-sh7705.c b/arch/sh/mm/pg-sh7705.c
deleted file mode 100644 (file)
index 684891b..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * arch/sh/mm/pg-sh7705.c
- *
- * Copyright (C) 1999, 2000  Niibe Yutaka
- * Copyright (C) 2004  Alex Song
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- */
-
-#include <linux/init.h>
-#include <linux/mman.h>
-#include <linux/mm.h>
-#include <linux/threads.h>
-#include <linux/fs.h>
-#include <asm/addrspace.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/cache.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <asm/pgalloc.h>
-#include <asm/mmu_context.h>
-#include <asm/cacheflush.h>
-
-static void __flush_purge_virtual_region(void *p1, void *virt, int size)
-{
-       unsigned long v;
-       unsigned long begin, end;
-       unsigned long p1_begin;
-
-
-       begin = L1_CACHE_ALIGN((unsigned long)virt);
-       end = L1_CACHE_ALIGN((unsigned long)virt + size);
-
-       p1_begin = (unsigned long)p1 & ~(L1_CACHE_BYTES - 1);
-
-       /* do this the slow way as we may not have TLB entries
-        * for virt yet. */
-       for (v = begin; v < end; v += L1_CACHE_BYTES) {
-               unsigned long p;
-               unsigned long ways, addr;
-
-               p = __pa(p1_begin);
-
-               ways = current_cpu_data.dcache.ways;
-               addr = CACHE_OC_ADDRESS_ARRAY;
-
-               do {
-                       unsigned long data;
-
-                       addr |= (v & current_cpu_data.dcache.entry_mask);
-
-                       data = ctrl_inl(addr);
-                       if ((data & CACHE_PHYSADDR_MASK) ==
-                              (p & CACHE_PHYSADDR_MASK)) {
-                               data &= ~(SH_CACHE_UPDATED|SH_CACHE_VALID);
-                               ctrl_outl(data, addr);
-                       }
-
-                       addr += current_cpu_data.dcache.way_incr;
-               } while (--ways);
-
-               p1_begin += L1_CACHE_BYTES;
-       }
-}
-
-/*
- * clear_user_page
- * @to: P1 address
- * @address: U0 address to be mapped
- */
-void clear_user_page(void *to, unsigned long address, struct page *pg)
-{
-       if (pages_do_alias(address, (unsigned long)to))
-               __flush_purge_virtual_region(to,
-                                            (void *)(address & 0xfffff000),
-                                            PAGE_SIZE);
-
-       clear_page(to);
-       __flush_wback_region(to, PAGE_SIZE);
-}
-
-/*
- * copy_user_page
- * @to: P1 address
- * @from: P1 address
- * @address: U0 address to be mapped
- */
-void copy_user_page(void *to, void *from, unsigned long address, struct page *pg)
-{
-       if (pages_do_alias(address, (unsigned long)to))
-               __flush_purge_virtual_region(to,
-                                            (void *)(address & 0xfffff000),
-                                            PAGE_SIZE);
-
-       copy_page(to, from);
-       __flush_wback_region(to, PAGE_SIZE);
-}