diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-07-02 09:46:27 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-26 15:06:14 -0500 |
commit | de27c308223dc9bd48de9742c7c2b53a15c1b012 (patch) | |
tree | d32acbc71110b1e727abd80620f95f14565b6031 | |
parent | dcd6c92267155e70a94b3927bce681ce74b80d1f (diff) |
ARM: pgtable: move TOP_PTE address definitions to arch/arm/mm/mm.h
Move the TOP_PTE address definitions to one central place so that it's
easy to discover what they're being used for. This helps to ensure
that there are no overlaps.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mm/copypage-v4mc.c | 10 | ||||
-rw-r--r-- | arch/arm/mm/copypage-v6.c | 16 | ||||
-rw-r--r-- | arch/arm/mm/copypage-xscale.c | 6 | ||||
-rw-r--r-- | arch/arm/mm/flush.c | 8 | ||||
-rw-r--r-- | arch/arm/mm/mm.h | 13 |
5 files changed, 25 insertions, 28 deletions
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c index 7d0a8c230342..87a23ca1fc61 100644 --- a/arch/arm/mm/copypage-v4mc.c +++ b/arch/arm/mm/copypage-v4mc.c | |||
@@ -23,10 +23,6 @@ | |||
23 | 23 | ||
24 | #include "mm.h" | 24 | #include "mm.h" |
25 | 25 | ||
26 | /* | ||
27 | * 0xffff8000 to 0xffffffff is reserved for any ARM architecture | ||
28 | * specific hacks for copying pages efficiently. | ||
29 | */ | ||
30 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ | 26 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ |
31 | L_PTE_MT_MINICACHE) | 27 | L_PTE_MT_MINICACHE) |
32 | 28 | ||
@@ -78,10 +74,10 @@ void v4_mc_copy_user_highpage(struct page *to, struct page *from, | |||
78 | 74 | ||
79 | raw_spin_lock(&minicache_lock); | 75 | raw_spin_lock(&minicache_lock); |
80 | 76 | ||
81 | set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); | 77 | set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); |
82 | flush_tlb_kernel_page(0xffff8000); | 78 | flush_tlb_kernel_page(COPYPAGE_MINICACHE); |
83 | 79 | ||
84 | mc_copy_user_page((void *)0xffff8000, kto); | 80 | mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); |
85 | 81 | ||
86 | raw_spin_unlock(&minicache_lock); | 82 | raw_spin_unlock(&minicache_lock); |
87 | 83 | ||
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c index 3d9a1552cef6..c00a75014435 100644 --- a/arch/arm/mm/copypage-v6.c +++ b/arch/arm/mm/copypage-v6.c | |||
@@ -24,9 +24,6 @@ | |||
24 | #error FIX ME | 24 | #error FIX ME |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #define from_address (0xffff8000) | ||
28 | #define to_address (0xffffc000) | ||
29 | |||
30 | static DEFINE_RAW_SPINLOCK(v6_lock); | 27 | static DEFINE_RAW_SPINLOCK(v6_lock); |
31 | 28 | ||
32 | /* | 29 | /* |
@@ -90,11 +87,11 @@ static void v6_copy_user_highpage_aliasing(struct page *to, | |||
90 | */ | 87 | */ |
91 | raw_spin_lock(&v6_lock); | 88 | raw_spin_lock(&v6_lock); |
92 | 89 | ||
93 | set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0); | 90 | kfrom = COPYPAGE_V6_FROM + (offset << PAGE_SHIFT); |
94 | set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0); | 91 | kto = COPYPAGE_V6_TO + (offset << PAGE_SHIFT); |
95 | 92 | ||
96 | kfrom = from_address + (offset << PAGE_SHIFT); | 93 | set_pte_ext(TOP_PTE(kfrom), pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0); |
97 | kto = to_address + (offset << PAGE_SHIFT); | 94 | set_pte_ext(TOP_PTE(kto), pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0); |
98 | 95 | ||
99 | flush_tlb_kernel_page(kfrom); | 96 | flush_tlb_kernel_page(kfrom); |
100 | flush_tlb_kernel_page(kto); | 97 | flush_tlb_kernel_page(kto); |
@@ -111,8 +108,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to, | |||
111 | */ | 108 | */ |
112 | static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr) | 109 | static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr) |
113 | { | 110 | { |
114 | unsigned int offset = CACHE_COLOUR(vaddr); | 111 | unsigned long to = COPYPAGE_V6_TO + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); |
115 | unsigned long to = to_address + (offset << PAGE_SHIFT); | ||
116 | 112 | ||
117 | /* FIXME: not highmem safe */ | 113 | /* FIXME: not highmem safe */ |
118 | discard_old_kernel_data(page_address(page)); | 114 | discard_old_kernel_data(page_address(page)); |
@@ -123,7 +119,7 @@ static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vad | |||
123 | */ | 119 | */ |
124 | raw_spin_lock(&v6_lock); | 120 | raw_spin_lock(&v6_lock); |
125 | 121 | ||
126 | set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0); | 122 | set_pte_ext(TOP_PTE(to), pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0); |
127 | flush_tlb_kernel_page(to); | 123 | flush_tlb_kernel_page(to); |
128 | clear_page((void *)to); | 124 | clear_page((void *)to); |
129 | 125 | ||
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c index 610c24ced310..90f3bb58eafa 100644 --- a/arch/arm/mm/copypage-xscale.c +++ b/arch/arm/mm/copypage-xscale.c | |||
@@ -23,12 +23,6 @@ | |||
23 | 23 | ||
24 | #include "mm.h" | 24 | #include "mm.h" |
25 | 25 | ||
26 | /* | ||
27 | * 0xffff8000 to 0xffffffff is reserved for any ARM architecture | ||
28 | * specific hacks for copying pages efficiently. | ||
29 | */ | ||
30 | #define COPYPAGE_MINICACHE 0xffff8000 | ||
31 | |||
32 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ | 26 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ |
33 | L_PTE_MT_MINICACHE) | 27 | L_PTE_MT_MINICACHE) |
34 | 28 | ||
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 1a8d4aa821be..f4d407af4690 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c | |||
@@ -23,11 +23,9 @@ | |||
23 | 23 | ||
24 | #ifdef CONFIG_CPU_CACHE_VIPT | 24 | #ifdef CONFIG_CPU_CACHE_VIPT |
25 | 25 | ||
26 | #define ALIAS_FLUSH_START 0xffff4000 | ||
27 | |||
28 | static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) | 26 | static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) |
29 | { | 27 | { |
30 | unsigned long to = ALIAS_FLUSH_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); | 28 | unsigned long to = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); |
31 | const int zero = 0; | 29 | const int zero = 0; |
32 | 30 | ||
33 | set_pte_ext(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL), 0); | 31 | set_pte_ext(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL), 0); |
@@ -46,8 +44,8 @@ static void flush_icache_alias(unsigned long pfn, unsigned long vaddr, unsigned | |||
46 | unsigned long offset = vaddr & (PAGE_SIZE - 1); | 44 | unsigned long offset = vaddr & (PAGE_SIZE - 1); |
47 | unsigned long to; | 45 | unsigned long to; |
48 | 46 | ||
49 | set_pte_ext(TOP_PTE(ALIAS_FLUSH_START) + colour, pfn_pte(pfn, PAGE_KERNEL), 0); | 47 | set_pte_ext(TOP_PTE(FLUSH_ALIAS_START) + colour, pfn_pte(pfn, PAGE_KERNEL), 0); |
50 | to = ALIAS_FLUSH_START + (colour << PAGE_SHIFT) + offset; | 48 | to = FLUSH_ALIAS_START + (colour << PAGE_SHIFT) + offset; |
51 | flush_tlb_kernel_page(to); | 49 | flush_tlb_kernel_page(to); |
52 | flush_icache_range(to, to + len); | 50 | flush_icache_range(to, to + len); |
53 | } | 51 | } |
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h index 70f6d3ea4834..6ee1ff2c1da6 100644 --- a/arch/arm/mm/mm.h +++ b/arch/arm/mm/mm.h | |||
@@ -5,6 +5,19 @@ extern pmd_t *top_pmd; | |||
5 | 5 | ||
6 | #define TOP_PTE(x) pte_offset_kernel(top_pmd, x) | 6 | #define TOP_PTE(x) pte_offset_kernel(top_pmd, x) |
7 | 7 | ||
8 | /* | ||
9 | * 0xffff8000 to 0xffffffff is reserved for any ARM architecture | ||
10 | * specific hacks for copying pages efficiently, while 0xffff4000 | ||
11 | * is reserved for VIPT aliasing flushing by generic code. | ||
12 | * | ||
13 | * Note that we don't allow VIPT aliasing caches with SMP. | ||
14 | */ | ||
15 | #define COPYPAGE_MINICACHE 0xffff8000 | ||
16 | #define COPYPAGE_V6_FROM 0xffff8000 | ||
17 | #define COPYPAGE_V6_TO 0xffffc000 | ||
18 | /* PFN alias flushing, for VIPT caches */ | ||
19 | #define FLUSH_ALIAS_START 0xffff4000 | ||
20 | |||
8 | static inline pmd_t *pmd_off_k(unsigned long virt) | 21 | static inline pmd_t *pmd_off_k(unsigned long virt) |
9 | { | 22 | { |
10 | return pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt); | 23 | return pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt); |