Skip to content

Commit dfff0fa

Browse files
committed
sh: wire up clear_user_highpage() for sh4, convert sh7705.
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>
1 parent 2277ab4 commit dfff0fa

9 files changed

Lines changed: 27 additions & 182 deletions

File tree

‎arch/sh/include/asm/cacheflush.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static inline void flush_kernel_dcache_page(struct page *page)
4949
flush_dcache_page(page);
5050
}
5151

52-
#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
52+
#if (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)) && !defined(CONFIG_CACHE_OFF)
5353
extern void copy_to_user_page(struct vm_area_struct *vma,
5454
struct page *page, unsigned long vaddr, void *dst, const void *src,
5555
unsigned long len);

‎arch/sh/include/asm/page.h‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,25 @@ pages_do_alias(unsigned long addr1, unsigned long addr2)
5656
return (addr1 ^ addr2) & shm_align_mask;
5757
}
5858

59-
extern void clear_page(void *to);
59+
60+
#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
6061
extern void copy_page(void *to, void *from);
6162

63+
struct page;
64+
struct vm_area_struct;
65+
6266
#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
6367
(defined(CONFIG_CPU_SH5) || defined(CONFIG_CPU_SH4) || \
6468
defined(CONFIG_SH7705_CACHE_32KB))
65-
struct page;
66-
struct vm_area_struct;
6769
extern void clear_user_page(void *to, unsigned long address, struct page *page);
6870
extern void copy_user_page(void *to, void *from, unsigned long address,
6971
struct page *page);
70-
#if defined(CONFIG_CPU_SH4)
72+
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
7173
extern void copy_user_highpage(struct page *to, struct page *from,
7274
unsigned long vaddr, struct vm_area_struct *vma);
7375
#define __HAVE_ARCH_COPY_USER_HIGHPAGE
76+
extern void clear_user_highpage(struct page *page, unsigned long vaddr);
77+
#define clear_user_highpage clear_user_highpage
7478
#endif
7579
#else
7680
#define clear_user_page(page, vaddr, pg) clear_page(page)

‎arch/sh/include/asm/pgtable.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ extern void paging_init(void);
141141
extern void page_table_range_init(unsigned long start, unsigned long end,
142142
pgd_t *pgd);
143143

144-
#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_CPU_SH4) && defined(CONFIG_MMU)
144+
#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \
145+
defined(CONFIG_SH7705_CACHE_32KB)) && defined(CONFIG_MMU)
145146
extern void kmap_coherent_init(void);
146147
#else
147148
#define kmap_coherent_init() do { } while (0)

‎arch/sh/kernel/sh_ksyms_32.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ EXPORT_SYMBOL(flush_cache_range);
101101
EXPORT_SYMBOL(flush_dcache_page);
102102
#endif
103103

104-
#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
105-
(defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB))
106-
EXPORT_SYMBOL(clear_user_page);
107-
#endif
108-
109104
#ifdef CONFIG_MCOUNT
110105
DECLARE_EXPORT(mcount);
111106
#endif
@@ -114,7 +109,6 @@ EXPORT_SYMBOL(csum_partial_copy_generic);
114109
#ifdef CONFIG_IPV6
115110
EXPORT_SYMBOL(csum_ipv6_magic);
116111
#endif
117-
EXPORT_SYMBOL(clear_page);
118112
EXPORT_SYMBOL(copy_page);
119113
EXPORT_SYMBOL(__clear_user);
120114
EXPORT_SYMBOL(_ebss);

‎arch/sh/lib/clear_page.S‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,6 @@
88
#include <linux/linkage.h>
99
#include <asm/page.h>
1010

11-
/*
12-
* clear_page
13-
* @to: P1 address
14-
*
15-
* void clear_page(void *to)
16-
*/
17-
18-
/*
19-
* r0 --- scratch
20-
* r4 --- to
21-
* r5 --- to + PAGE_SIZE
22-
*/
23-
ENTRY(clear_page)
24-
mov r4,r5
25-
mov.l .Llimit,r0
26-
add r0,r5
27-
mov #0,r0
28-
!
29-
1:
30-
#if defined(CONFIG_CPU_SH4)
31-
movca.l r0,@r4
32-
mov r4,r1
33-
#else
34-
mov.l r0,@r4
35-
#endif
36-
add #32,r4
37-
mov.l r0,@-r4
38-
mov.l r0,@-r4
39-
mov.l r0,@-r4
40-
mov.l r0,@-r4
41-
mov.l r0,@-r4
42-
mov.l r0,@-r4
43-
mov.l r0,@-r4
44-
#if defined(CONFIG_CPU_SH4)
45-
ocbwb @r1
46-
#endif
47-
cmp/eq r5,r4
48-
bf/s 1b
49-
add #28,r4
50-
!
51-
rts
52-
nop
53-
54-
.balign 4
55-
.Llimit: .long (PAGE_SIZE-28)
56-
5711
ENTRY(__clear_user)
5812
!
5913
mov #0, r0

‎arch/sh/mm/Makefile_32‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tlb-$(CONFIG_CPU_HAS_PTEAEX) := tlb-pteaex.o
3131
obj-y += $(tlb-y)
3232
ifndef CONFIG_CACHE_OFF
3333
obj-$(CONFIG_CPU_SH4) += pg-sh4.o
34-
obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o
34+
obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh4.o
3535
endif
3636
endif
3737

‎arch/sh/mm/pg-nommu.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* arch/sh/mm/pg-nommu.c
33
*
4-
* clear_page()/copy_page() implementation for MMUless SH.
4+
* copy_page()/__copy_user()/__clear_user() implementations for MMUless SH.
55
*
66
* Copyright (C) 2003 Paul Mundt
77
*
@@ -20,11 +20,6 @@ void copy_page(void *to, void *from)
2020
memcpy(to, from, PAGE_SIZE);
2121
}
2222

23-
void clear_page(void *to)
24-
{
25-
memset(to, 0, PAGE_SIZE);
26-
}
27-
2823
__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n)
2924
{
3025
memcpy(to, from, n);

‎arch/sh/mm/pg-sh4.c‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* arch/sh/mm/pg-sh4.c
33
*
44
* Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5-
* Copyright (C) 2002 - 2007 Paul Mundt
5+
* Copyright (C) 2002 - 2009 Paul Mundt
66
*
77
* Released under the terms of the GNU GPL v2.0.
88
*/
@@ -58,20 +58,6 @@ static inline void kunmap_coherent(struct page *page)
5858
preempt_check_resched();
5959
}
6060

61-
/*
62-
* clear_user_page
63-
* @to: P1 address
64-
* @address: U0 address to be mapped
65-
* @page: page (virt_to_page(to))
66-
*/
67-
void clear_user_page(void *to, unsigned long address, struct page *page)
68-
{
69-
clear_page(to);
70-
71-
if (pages_do_alias((unsigned long)to, address & PAGE_MASK))
72-
__flush_wback_region(to, PAGE_SIZE);
73-
}
74-
7561
void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
7662
unsigned long vaddr, void *dst, const void *src,
7763
unsigned long len)
@@ -128,3 +114,16 @@ void copy_user_highpage(struct page *to, struct page *from,
128114
smp_wmb();
129115
}
130116
EXPORT_SYMBOL(copy_user_highpage);
117+
118+
void clear_user_highpage(struct page *page, unsigned long vaddr)
119+
{
120+
void *kaddr = kmap_atomic(page, KM_USER0);
121+
122+
clear_page(kaddr);
123+
124+
if (pages_do_alias((unsigned long)kaddr, vaddr & PAGE_MASK))
125+
__flush_wback_region(kaddr, PAGE_SIZE);
126+
127+
kunmap_atomic(kaddr, KM_USER0);
128+
}
129+
EXPORT_SYMBOL(clear_user_highpage);

‎arch/sh/mm/pg-sh7705.c‎

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)