aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-12 15:52:47 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-12 15:52:47 -0400
commit6439d1c693bae2e7552ceaf16e45a6e819d18873 (patch)
tree3ccd1bfbef1794b6fd45a2e8181659105cc0c0fc /arch/sparc
parent3d8273675d4771d30e1e1c3dbae820dec55a0950 (diff)
sparc32: Un-btfixup PAGE_{NONE,COPY,READONLY,SHARED,KERNEL}.
That lets us also get rid of the run-time initialization of protection_map[] and all the ugly module workarounds for PAGE_KERNEL and PAGE_SHARED to deal with the fact that we can't do btfixups for modular code. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/pgtable_32.h62
-rw-r--r--arch/sparc/mm/init_32.c23
-rw-r--r--arch/sparc/mm/srmmu.c9
3 files changed, 23 insertions, 71 deletions
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 1c31ef180b1a..c0e4d737afb2 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -32,11 +32,6 @@ extern unsigned long calc_highpages(void);
32#define pmd_ERROR(e) __builtin_trap() 32#define pmd_ERROR(e) __builtin_trap()
33#define pgd_ERROR(e) __builtin_trap() 33#define pgd_ERROR(e) __builtin_trap()
34 34
35BTFIXUPDEF_INT(page_none)
36BTFIXUPDEF_INT(page_copy)
37BTFIXUPDEF_INT(page_readonly)
38BTFIXUPDEF_INT(page_kernel)
39
40#define PMD_SHIFT 22 35#define PMD_SHIFT 22
41#define PMD_SIZE (1UL << PMD_SHIFT) 36#define PMD_SIZE (1UL << PMD_SHIFT)
42#define PMD_MASK (~(PMD_SIZE-1)) 37#define PMD_MASK (~(PMD_SIZE-1))
@@ -51,18 +46,11 @@ BTFIXUPDEF_INT(page_kernel)
51#define FIRST_USER_ADDRESS 0 46#define FIRST_USER_ADDRESS 0
52#define PTE_SIZE (PTRS_PER_PTE*4) 47#define PTE_SIZE (PTRS_PER_PTE*4)
53 48
54#define PAGE_NONE __pgprot(BTFIXUP_INT(page_none)) 49#define PAGE_NONE SRMMU_PAGE_NONE
55extern pgprot_t PAGE_SHARED; 50#define PAGE_SHARED SRMMU_PAGE_SHARED
56#define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy)) 51#define PAGE_COPY SRMMU_PAGE_COPY
57#define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly)) 52#define PAGE_READONLY SRMMU_PAGE_RDONLY
58 53#define PAGE_KERNEL SRMMU_PAGE_KERNEL
59extern unsigned long page_kernel;
60
61#ifdef MODULE
62#define PAGE_KERNEL page_kernel
63#else
64#define PAGE_KERNEL __pgprot(BTFIXUP_INT(page_kernel))
65#endif
66 54
67/* Top-level page directory */ 55/* Top-level page directory */
68extern pgd_t swapper_pg_dir[1024]; 56extern pgd_t swapper_pg_dir[1024];
@@ -71,28 +59,24 @@ extern void paging_init(void);
71 59
72extern unsigned long ptr_in_current_pgd; 60extern unsigned long ptr_in_current_pgd;
73 61
74/* Here is a trick, since mmap.c need the initializer elements for 62/* xwr */
75 * protection_map[] to be constant at compile time, I set the following 63#define __P000 PAGE_NONE
76 * to all zeros. I set it to the real values after I link in the 64#define __P001 PAGE_READONLY
77 * appropriate MMU page table routines at boot time. 65#define __P010 PAGE_COPY
78 */ 66#define __P011 PAGE_COPY
79#define __P000 __pgprot(0) 67#define __P100 PAGE_READONLY
80#define __P001 __pgprot(0) 68#define __P101 PAGE_READONLY
81#define __P010 __pgprot(0) 69#define __P110 PAGE_COPY
82#define __P011 __pgprot(0) 70#define __P111 PAGE_COPY
83#define __P100 __pgprot(0) 71
84#define __P101 __pgprot(0) 72#define __S000 PAGE_NONE
85#define __P110 __pgprot(0) 73#define __S001 PAGE_READONLY
86#define __P111 __pgprot(0) 74#define __S010 PAGE_SHARED
87 75#define __S011 PAGE_SHARED
88#define __S000 __pgprot(0) 76#define __S100 PAGE_READONLY
89#define __S001 __pgprot(0) 77#define __S101 PAGE_READONLY
90#define __S010 __pgprot(0) 78#define __S110 PAGE_SHARED
91#define __S011 __pgprot(0) 79#define __S111 PAGE_SHARED
92#define __S100 __pgprot(0)
93#define __S101 __pgprot(0)
94#define __S110 __pgprot(0)
95#define __S111 __pgprot(0)
96 80
97extern int num_contexts; 81extern int num_contexts;
98 82
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index 79b215e9b5ca..61f9b7039760 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -44,9 +44,6 @@ EXPORT_SYMBOL(phys_base);
44unsigned long pfn_base; 44unsigned long pfn_base;
45EXPORT_SYMBOL(pfn_base); 45EXPORT_SYMBOL(pfn_base);
46 46
47unsigned long page_kernel;
48EXPORT_SYMBOL(page_kernel);
49
50struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1]; 47struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1];
51unsigned long sparc_unmapped_base; 48unsigned long sparc_unmapped_base;
52 49
@@ -293,9 +290,6 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
293extern void srmmu_paging_init(void); 290extern void srmmu_paging_init(void);
294extern void device_scan(void); 291extern void device_scan(void);
295 292
296pgprot_t PAGE_SHARED __read_mostly;
297EXPORT_SYMBOL(PAGE_SHARED);
298
299void __init paging_init(void) 293void __init paging_init(void)
300{ 294{
301 switch(sparc_cpu_model) { 295 switch(sparc_cpu_model) {
@@ -315,23 +309,6 @@ void __init paging_init(void)
315 prom_halt(); 309 prom_halt();
316 } 310 }
317 311
318 /* Initialize the protection map with non-constant, MMU dependent values. */
319 protection_map[0] = PAGE_NONE;
320 protection_map[1] = PAGE_READONLY;
321 protection_map[2] = PAGE_COPY;
322 protection_map[3] = PAGE_COPY;
323 protection_map[4] = PAGE_READONLY;
324 protection_map[5] = PAGE_READONLY;
325 protection_map[6] = PAGE_COPY;
326 protection_map[7] = PAGE_COPY;
327 protection_map[8] = PAGE_NONE;
328 protection_map[9] = PAGE_READONLY;
329 protection_map[10] = PAGE_SHARED;
330 protection_map[11] = PAGE_SHARED;
331 protection_map[12] = PAGE_READONLY;
332 protection_map[13] = PAGE_READONLY;
333 protection_map[14] = PAGE_SHARED;
334 protection_map[15] = PAGE_SHARED;
335 btfixup(); 312 btfixup();
336 prom_build_devicetree(); 313 prom_build_devicetree();
337 of_fill_in_cpu_data(); 314 of_fill_in_cpu_data();
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index d852962d58d8..c6962715ef08 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -59,8 +59,6 @@ extern struct resource sparc_iomap;
59 59
60extern unsigned long last_valid_pfn; 60extern unsigned long last_valid_pfn;
61 61
62extern unsigned long page_kernel;
63
64static pgd_t *srmmu_swapper_pg_dir; 62static pgd_t *srmmu_swapper_pg_dir;
65 63
66#ifdef CONFIG_SMP 64#ifdef CONFIG_SMP
@@ -2078,13 +2076,6 @@ void __init ld_mmu_srmmu(void)
2078 extern void ld_mmu_iounit(void); 2076 extern void ld_mmu_iounit(void);
2079 extern void ___xchg32_sun4md(void); 2077 extern void ___xchg32_sun4md(void);
2080 2078
2081 BTFIXUPSET_INT(page_none, pgprot_val(SRMMU_PAGE_NONE));
2082 PAGE_SHARED = pgprot_val(SRMMU_PAGE_SHARED);
2083 BTFIXUPSET_INT(page_copy, pgprot_val(SRMMU_PAGE_COPY));
2084 BTFIXUPSET_INT(page_readonly, pgprot_val(SRMMU_PAGE_RDONLY));
2085 BTFIXUPSET_INT(page_kernel, pgprot_val(SRMMU_PAGE_KERNEL));
2086 page_kernel = pgprot_val(SRMMU_PAGE_KERNEL);
2087
2088 /* Functions */ 2079 /* Functions */
2089#ifndef CONFIG_SMP 2080#ifndef CONFIG_SMP
2090 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4md, BTFIXUPCALL_SWAPG1G2); 2081 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4md, BTFIXUPCALL_SWAPG1G2);