diff options
author | Liu Hua <sdu.liu@huawei.com> | 2014-04-18 04:43:32 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-04-23 06:09:42 -0400 |
commit | a05e54c103b0b8e1dab5d04b411f1d48387c4903 (patch) | |
tree | d9960fd5c3517f42f57c4513e28dd51a6353ec27 | |
parent | 4221e2e6b3160e4b558df14fa79f025c0e277935 (diff) |
ARM: 8031/2: change fixmap mapping region to support 32 CPUs
In 32-bit ARM systems, the fixmap mapping region can support no more
than 14 CPUs(total: 896k; one CPU: 64K). And we can configure NR_CPUS
up to 32. So there is a mismatch.
This patch moves fixmapping region downwards to region 0xffc00000-
0xffe00000. Then the fixmap mapping region can support up to 32 CPUs.
Reviewed-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | Documentation/arm/memory.txt | 2 | ||||
-rw-r--r-- | arch/arm/include/asm/fixmap.h | 16 | ||||
-rw-r--r-- | arch/arm/include/asm/highmem.h | 1 | ||||
-rw-r--r-- | arch/arm/mm/highmem.c | 27 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 4 |
5 files changed, 29 insertions, 21 deletions
diff --git a/Documentation/arm/memory.txt b/Documentation/arm/memory.txt index d74e8a5901fc..256c5e067fb1 100644 --- a/Documentation/arm/memory.txt +++ b/Documentation/arm/memory.txt | |||
@@ -41,7 +41,7 @@ fffe8000 fffeffff DTCM mapping area for platforms with | |||
41 | fffe0000 fffe7fff ITCM mapping area for platforms with | 41 | fffe0000 fffe7fff ITCM mapping area for platforms with |
42 | ITCM mounted inside the CPU. | 42 | ITCM mounted inside the CPU. |
43 | 43 | ||
44 | fff00000 fffdffff Fixmap mapping region. Addresses provided | 44 | fffc0000 ffdfffff Fixmap mapping region. Addresses provided |
45 | by fix_to_virt() will be located here. | 45 | by fix_to_virt() will be located here. |
46 | 46 | ||
47 | fee00000 feffffff Mapping of PCI I/O space. This is a static | 47 | fee00000 feffffff Mapping of PCI I/O space. This is a static |
diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h index be55ebc08ed4..74124b0d0d79 100644 --- a/arch/arm/include/asm/fixmap.h +++ b/arch/arm/include/asm/fixmap.h | |||
@@ -1,20 +1,8 @@ | |||
1 | #ifndef _ASM_FIXMAP_H | 1 | #ifndef _ASM_FIXMAP_H |
2 | #define _ASM_FIXMAP_H | 2 | #define _ASM_FIXMAP_H |
3 | 3 | ||
4 | /* | 4 | #define FIXADDR_START 0xffc00000UL |
5 | * Nothing too fancy for now. | 5 | #define FIXADDR_TOP 0xffe00000UL |
6 | * | ||
7 | * On ARM we already have well known fixed virtual addresses imposed by | ||
8 | * the architecture such as the vector page which is located at 0xffff0000, | ||
9 | * therefore a second level page table is already allocated covering | ||
10 | * 0xfff00000 upwards. | ||
11 | * | ||
12 | * The cache flushing code in proc-xscale.S uses the virtual area between | ||
13 | * 0xfffe0000 and 0xfffeffff. | ||
14 | */ | ||
15 | |||
16 | #define FIXADDR_START 0xfff00000UL | ||
17 | #define FIXADDR_TOP 0xfffe0000UL | ||
18 | #define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START) | 6 | #define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START) |
19 | 7 | ||
20 | #define FIX_KMAP_NR_PTES (FIXADDR_SIZE >> PAGE_SHIFT) | 8 | #define FIX_KMAP_NR_PTES (FIXADDR_SIZE >> PAGE_SHIFT) |
diff --git a/arch/arm/include/asm/highmem.h b/arch/arm/include/asm/highmem.h index 91b99abe7a95..535579511ed0 100644 --- a/arch/arm/include/asm/highmem.h +++ b/arch/arm/include/asm/highmem.h | |||
@@ -18,6 +18,7 @@ | |||
18 | } while (0) | 18 | } while (0) |
19 | 19 | ||
20 | extern pte_t *pkmap_page_table; | 20 | extern pte_t *pkmap_page_table; |
21 | extern pte_t *fixmap_page_table; | ||
21 | 22 | ||
22 | extern void *kmap_high(struct page *page); | 23 | extern void *kmap_high(struct page *page); |
23 | extern void kunmap_high(struct page *page); | 24 | extern void kunmap_high(struct page *page); |
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index e05e8ad26ba5..45aeaaca9052 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c | |||
@@ -18,6 +18,21 @@ | |||
18 | #include <asm/tlbflush.h> | 18 | #include <asm/tlbflush.h> |
19 | #include "mm.h" | 19 | #include "mm.h" |
20 | 20 | ||
21 | pte_t *fixmap_page_table; | ||
22 | |||
23 | static inline void set_fixmap_pte(int idx, pte_t pte) | ||
24 | { | ||
25 | unsigned long vaddr = __fix_to_virt(idx); | ||
26 | set_pte_ext(fixmap_page_table + idx, pte, 0); | ||
27 | local_flush_tlb_kernel_page(vaddr); | ||
28 | } | ||
29 | |||
30 | static inline pte_t get_fixmap_pte(unsigned long vaddr) | ||
31 | { | ||
32 | unsigned long idx = __virt_to_fix(vaddr); | ||
33 | return *(fixmap_page_table + idx); | ||
34 | } | ||
35 | |||
21 | void *kmap(struct page *page) | 36 | void *kmap(struct page *page) |
22 | { | 37 | { |
23 | might_sleep(); | 38 | might_sleep(); |
@@ -69,14 +84,14 @@ void *kmap_atomic(struct page *page) | |||
69 | * With debugging enabled, kunmap_atomic forces that entry to 0. | 84 | * With debugging enabled, kunmap_atomic forces that entry to 0. |
70 | * Make sure it was indeed properly unmapped. | 85 | * Make sure it was indeed properly unmapped. |
71 | */ | 86 | */ |
72 | BUG_ON(!pte_none(get_top_pte(vaddr))); | 87 | BUG_ON(!pte_none(*(fixmap_page_table + idx))); |
73 | #endif | 88 | #endif |
74 | /* | 89 | /* |
75 | * When debugging is off, kunmap_atomic leaves the previous mapping | 90 | * When debugging is off, kunmap_atomic leaves the previous mapping |
76 | * in place, so the contained TLB flush ensures the TLB is updated | 91 | * in place, so the contained TLB flush ensures the TLB is updated |
77 | * with the new mapping. | 92 | * with the new mapping. |
78 | */ | 93 | */ |
79 | set_top_pte(vaddr, mk_pte(page, kmap_prot)); | 94 | set_fixmap_pte(idx, mk_pte(page, kmap_prot)); |
80 | 95 | ||
81 | return (void *)vaddr; | 96 | return (void *)vaddr; |
82 | } | 97 | } |
@@ -95,7 +110,7 @@ void __kunmap_atomic(void *kvaddr) | |||
95 | __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); | 110 | __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); |
96 | #ifdef CONFIG_DEBUG_HIGHMEM | 111 | #ifdef CONFIG_DEBUG_HIGHMEM |
97 | BUG_ON(vaddr != __fix_to_virt(idx)); | 112 | BUG_ON(vaddr != __fix_to_virt(idx)); |
98 | set_top_pte(vaddr, __pte(0)); | 113 | set_fixmap_pte(idx, __pte(0)); |
99 | #else | 114 | #else |
100 | (void) idx; /* to kill a warning */ | 115 | (void) idx; /* to kill a warning */ |
101 | #endif | 116 | #endif |
@@ -119,9 +134,9 @@ void *kmap_atomic_pfn(unsigned long pfn) | |||
119 | idx = type + KM_TYPE_NR * smp_processor_id(); | 134 | idx = type + KM_TYPE_NR * smp_processor_id(); |
120 | vaddr = __fix_to_virt(idx); | 135 | vaddr = __fix_to_virt(idx); |
121 | #ifdef CONFIG_DEBUG_HIGHMEM | 136 | #ifdef CONFIG_DEBUG_HIGHMEM |
122 | BUG_ON(!pte_none(get_top_pte(vaddr))); | 137 | BUG_ON(!pte_none(*(fixmap_page_table + idx))); |
123 | #endif | 138 | #endif |
124 | set_top_pte(vaddr, pfn_pte(pfn, kmap_prot)); | 139 | set_fixmap_pte(idx, pfn_pte(pfn, kmap_prot)); |
125 | 140 | ||
126 | return (void *)vaddr; | 141 | return (void *)vaddr; |
127 | } | 142 | } |
@@ -133,5 +148,5 @@ struct page *kmap_atomic_to_page(const void *ptr) | |||
133 | if (vaddr < FIXADDR_START) | 148 | if (vaddr < FIXADDR_START) |
134 | return virt_to_page(ptr); | 149 | return virt_to_page(ptr); |
135 | 150 | ||
136 | return pte_page(get_top_pte(vaddr)); | 151 | return pte_page(get_fixmap_pte(vaddr)); |
137 | } | 152 | } |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index b68c6b22e1c8..09c0a16165dc 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/mach/arch.h> | 35 | #include <asm/mach/arch.h> |
36 | #include <asm/mach/map.h> | 36 | #include <asm/mach/map.h> |
37 | #include <asm/mach/pci.h> | 37 | #include <asm/mach/pci.h> |
38 | #include <asm/fixmap.h> | ||
38 | 39 | ||
39 | #include "mm.h" | 40 | #include "mm.h" |
40 | #include "tcm.h" | 41 | #include "tcm.h" |
@@ -1359,6 +1360,9 @@ static void __init kmap_init(void) | |||
1359 | #ifdef CONFIG_HIGHMEM | 1360 | #ifdef CONFIG_HIGHMEM |
1360 | pkmap_page_table = early_pte_alloc(pmd_off_k(PKMAP_BASE), | 1361 | pkmap_page_table = early_pte_alloc(pmd_off_k(PKMAP_BASE), |
1361 | PKMAP_BASE, _PAGE_KERNEL_TABLE); | 1362 | PKMAP_BASE, _PAGE_KERNEL_TABLE); |
1363 | |||
1364 | fixmap_page_table = early_pte_alloc(pmd_off_k(FIXADDR_START), | ||
1365 | FIXADDR_START, _PAGE_KERNEL_TABLE); | ||
1362 | #endif | 1366 | #endif |
1363 | } | 1367 | } |
1364 | 1368 | ||