diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2016-04-11 14:14:17 -0400 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2016-07-23 23:33:58 -0400 |
commit | d39af90265feb40ec198c4ca8268724645b4b50e (patch) | |
tree | 32c3aed4a66a243251ca0a9e195c4ba8e6dddeeb | |
parent | f1883aa7d63e3be92ad18da7a1bfc6c9b15c4f9a (diff) |
xtensa: add alternative kernel memory layouts
MMUv3 is able to support low memory bigger than 128MB.
Implement 256MB and 512MB KSEG layouts:
- add Kconfig selector for KSEG layout;
- add KSEG base address, size and alignment definitions to
arch/xtensa/include/asm/kmem_layout.h;
- use new definitions in TLB initialization;
- add build time memory map consistency checks.
See Documentation/xtensa/mmu.txt for the details of new memory layouts.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
-rw-r--r-- | Documentation/xtensa/mmu.txt | 124 | ||||
-rw-r--r-- | arch/xtensa/Kconfig | 44 | ||||
-rw-r--r-- | arch/xtensa/include/asm/fixmap.h | 5 | ||||
-rw-r--r-- | arch/xtensa/include/asm/highmem.h | 5 | ||||
-rw-r--r-- | arch/xtensa/include/asm/initialize_mmu.h | 23 | ||||
-rw-r--r-- | arch/xtensa/include/asm/kmem_layout.h | 46 | ||||
-rw-r--r-- | arch/xtensa/include/asm/page.h | 6 | ||||
-rw-r--r-- | arch/xtensa/include/uapi/asm/types.h | 3 | ||||
-rw-r--r-- | arch/xtensa/mm/init.c | 3 |
9 files changed, 249 insertions, 10 deletions
diff --git a/Documentation/xtensa/mmu.txt b/Documentation/xtensa/mmu.txt index 0312fe66475c..867c0f837e28 100644 --- a/Documentation/xtensa/mmu.txt +++ b/Documentation/xtensa/mmu.txt | |||
@@ -62,3 +62,127 @@ limitations apply: | |||
62 | 62 | ||
63 | 6. The IO area covers the entire 256MB segment of parent-bus-address; the | 63 | 6. The IO area covers the entire 256MB segment of parent-bus-address; the |
64 | "ranges" triplet length field is ignored | 64 | "ranges" triplet length field is ignored |
65 | |||
66 | |||
67 | MMUv3 address space layouts. | ||
68 | ============================ | ||
69 | |||
70 | Default MMUv2-compatible layout. | ||
71 | |||
72 | Symbol VADDR Size | ||
73 | +------------------+ | ||
74 | | Userspace | 0x00000000 TASK_SIZE | ||
75 | +------------------+ 0x40000000 | ||
76 | +------------------+ | ||
77 | | Page table | 0x80000000 | ||
78 | +------------------+ 0x80400000 | ||
79 | +------------------+ | ||
80 | | KMAP area | PKMAP_BASE PTRS_PER_PTE * | ||
81 | | | DCACHE_N_COLORS * | ||
82 | | | PAGE_SIZE | ||
83 | | | (4MB * DCACHE_N_COLORS) | ||
84 | +------------------+ | ||
85 | | Atomic KMAP area | FIXADDR_START KM_TYPE_NR * | ||
86 | | | NR_CPUS * | ||
87 | | | DCACHE_N_COLORS * | ||
88 | | | PAGE_SIZE | ||
89 | +------------------+ FIXADDR_TOP 0xbffff000 | ||
90 | +------------------+ | ||
91 | | VMALLOC area | VMALLOC_START 0xc0000000 128MB - 64KB | ||
92 | +------------------+ VMALLOC_END | ||
93 | | Cache aliasing | TLBTEMP_BASE_1 0xc7ff0000 DCACHE_WAY_SIZE | ||
94 | | remap area 1 | | ||
95 | +------------------+ | ||
96 | | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE | ||
97 | | remap area 2 | | ||
98 | +------------------+ | ||
99 | +------------------+ | ||
100 | | Cached KSEG | XCHAL_KSEG_CACHED_VADDR 0xd0000000 128MB | ||
101 | +------------------+ | ||
102 | | Uncached KSEG | XCHAL_KSEG_BYPASS_VADDR 0xd8000000 128MB | ||
103 | +------------------+ | ||
104 | | Cached KIO | XCHAL_KIO_CACHED_VADDR 0xe0000000 256MB | ||
105 | +------------------+ | ||
106 | | Uncached KIO | XCHAL_KIO_BYPASS_VADDR 0xf0000000 256MB | ||
107 | +------------------+ | ||
108 | |||
109 | |||
110 | 256MB cached + 256MB uncached layout. | ||
111 | |||
112 | Symbol VADDR Size | ||
113 | +------------------+ | ||
114 | | Userspace | 0x00000000 TASK_SIZE | ||
115 | +------------------+ 0x40000000 | ||
116 | +------------------+ | ||
117 | | Page table | 0x80000000 | ||
118 | +------------------+ 0x80400000 | ||
119 | +------------------+ | ||
120 | | KMAP area | PKMAP_BASE PTRS_PER_PTE * | ||
121 | | | DCACHE_N_COLORS * | ||
122 | | | PAGE_SIZE | ||
123 | | | (4MB * DCACHE_N_COLORS) | ||
124 | +------------------+ | ||
125 | | Atomic KMAP area | FIXADDR_START KM_TYPE_NR * | ||
126 | | | NR_CPUS * | ||
127 | | | DCACHE_N_COLORS * | ||
128 | | | PAGE_SIZE | ||
129 | +------------------+ FIXADDR_TOP 0x9ffff000 | ||
130 | +------------------+ | ||
131 | | VMALLOC area | VMALLOC_START 0xa0000000 128MB - 64KB | ||
132 | +------------------+ VMALLOC_END | ||
133 | | Cache aliasing | TLBTEMP_BASE_1 0xa7ff0000 DCACHE_WAY_SIZE | ||
134 | | remap area 1 | | ||
135 | +------------------+ | ||
136 | | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE | ||
137 | | remap area 2 | | ||
138 | +------------------+ | ||
139 | +------------------+ | ||
140 | | Cached KSEG | XCHAL_KSEG_CACHED_VADDR 0xb0000000 256MB | ||
141 | +------------------+ | ||
142 | | Uncached KSEG | XCHAL_KSEG_BYPASS_VADDR 0xc0000000 256MB | ||
143 | +------------------+ | ||
144 | +------------------+ | ||
145 | | Cached KIO | XCHAL_KIO_CACHED_VADDR 0xe0000000 256MB | ||
146 | +------------------+ | ||
147 | | Uncached KIO | XCHAL_KIO_BYPASS_VADDR 0xf0000000 256MB | ||
148 | +------------------+ | ||
149 | |||
150 | |||
151 | 512MB cached + 512MB uncached layout. | ||
152 | |||
153 | Symbol VADDR Size | ||
154 | +------------------+ | ||
155 | | Userspace | 0x00000000 TASK_SIZE | ||
156 | +------------------+ 0x40000000 | ||
157 | +------------------+ | ||
158 | | Page table | 0x80000000 | ||
159 | +------------------+ 0x80400000 | ||
160 | +------------------+ | ||
161 | | KMAP area | PKMAP_BASE PTRS_PER_PTE * | ||
162 | | | DCACHE_N_COLORS * | ||
163 | | | PAGE_SIZE | ||
164 | | | (4MB * DCACHE_N_COLORS) | ||
165 | +------------------+ | ||
166 | | Atomic KMAP area | FIXADDR_START KM_TYPE_NR * | ||
167 | | | NR_CPUS * | ||
168 | | | DCACHE_N_COLORS * | ||
169 | | | PAGE_SIZE | ||
170 | +------------------+ FIXADDR_TOP 0x8ffff000 | ||
171 | +------------------+ | ||
172 | | VMALLOC area | VMALLOC_START 0x90000000 128MB - 64KB | ||
173 | +------------------+ VMALLOC_END | ||
174 | | Cache aliasing | TLBTEMP_BASE_1 0x97ff0000 DCACHE_WAY_SIZE | ||
175 | | remap area 1 | | ||
176 | +------------------+ | ||
177 | | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE | ||
178 | | remap area 2 | | ||
179 | +------------------+ | ||
180 | +------------------+ | ||
181 | | Cached KSEG | XCHAL_KSEG_CACHED_VADDR 0xa0000000 512MB | ||
182 | +------------------+ | ||
183 | | Uncached KSEG | XCHAL_KSEG_BYPASS_VADDR 0xc0000000 512MB | ||
184 | +------------------+ | ||
185 | | Cached KIO | XCHAL_KIO_CACHED_VADDR 0xe0000000 256MB | ||
186 | +------------------+ | ||
187 | | Uncached KIO | XCHAL_KIO_BYPASS_VADDR 0xf0000000 256MB | ||
188 | +------------------+ | ||
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 64336f666fb6..c17496bc37f0 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -236,6 +236,50 @@ config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX | |||
236 | 236 | ||
237 | If in doubt, say Y. | 237 | If in doubt, say Y. |
238 | 238 | ||
239 | config KSEG_PADDR | ||
240 | hex "Physical address of the KSEG mapping" | ||
241 | depends on INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX && MMU | ||
242 | default 0x00000000 | ||
243 | help | ||
244 | This is the physical address where KSEG is mapped. Please refer to | ||
245 | the chosen KSEG layout help for the required address alignment. | ||
246 | Unpacked kernel image (including vectors) must be located completely | ||
247 | within KSEG. | ||
248 | Physical memory below this address is not available to linux. | ||
249 | |||
250 | If unsure, leave the default value here. | ||
251 | |||
252 | choice | ||
253 | prompt "KSEG layout" | ||
254 | depends on MMU | ||
255 | default XTENSA_KSEG_MMU_V2 | ||
256 | |||
257 | config XTENSA_KSEG_MMU_V2 | ||
258 | bool "MMUv2: 128MB cached + 128MB uncached" | ||
259 | help | ||
260 | MMUv2 compatible kernel memory map: TLB way 5 maps 128MB starting | ||
261 | at KSEG_PADDR to 0xd0000000 with cache and to 0xd8000000 | ||
262 | without cache. | ||
263 | KSEG_PADDR must be aligned to 128MB. | ||
264 | |||
265 | config XTENSA_KSEG_256M | ||
266 | bool "256MB cached + 256MB uncached" | ||
267 | depends on INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX | ||
268 | help | ||
269 | TLB way 6 maps 256MB starting at KSEG_PADDR to 0xb0000000 | ||
270 | with cache and to 0xc0000000 without cache. | ||
271 | KSEG_PADDR must be aligned to 256MB. | ||
272 | |||
273 | config XTENSA_KSEG_512M | ||
274 | bool "512MB cached + 512MB uncached" | ||
275 | depends on INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX | ||
276 | help | ||
277 | TLB way 6 maps 512MB starting at KSEG_PADDR to 0xa0000000 | ||
278 | with cache and to 0xc0000000 without cache. | ||
279 | KSEG_PADDR must be aligned to 256MB. | ||
280 | |||
281 | endchoice | ||
282 | |||
239 | config HIGHMEM | 283 | config HIGHMEM |
240 | bool "High Memory Support" | 284 | bool "High Memory Support" |
241 | depends on MMU | 285 | depends on MMU |
diff --git a/arch/xtensa/include/asm/fixmap.h b/arch/xtensa/include/asm/fixmap.h index 62b507deea9d..0d30403b6c95 100644 --- a/arch/xtensa/include/asm/fixmap.h +++ b/arch/xtensa/include/asm/fixmap.h | |||
@@ -59,6 +59,11 @@ enum fixed_addresses { | |||
59 | */ | 59 | */ |
60 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | 60 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) |
61 | { | 61 | { |
62 | /* Check if this memory layout is broken because fixmap overlaps page | ||
63 | * table. | ||
64 | */ | ||
65 | BUILD_BUG_ON(FIXADDR_START < | ||
66 | XCHAL_PAGE_TABLE_VADDR + XCHAL_PAGE_TABLE_SIZE); | ||
62 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses); | 67 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses); |
63 | return __fix_to_virt(idx); | 68 | return __fix_to_virt(idx); |
64 | } | 69 | } |
diff --git a/arch/xtensa/include/asm/highmem.h b/arch/xtensa/include/asm/highmem.h index 01cef6b40829..6e070db1022e 100644 --- a/arch/xtensa/include/asm/highmem.h +++ b/arch/xtensa/include/asm/highmem.h | |||
@@ -68,6 +68,11 @@ void kunmap_high(struct page *page); | |||
68 | 68 | ||
69 | static inline void *kmap(struct page *page) | 69 | static inline void *kmap(struct page *page) |
70 | { | 70 | { |
71 | /* Check if this memory layout is broken because PKMAP overlaps | ||
72 | * page table. | ||
73 | */ | ||
74 | BUILD_BUG_ON(PKMAP_BASE < | ||
75 | XCHAL_PAGE_TABLE_VADDR + XCHAL_PAGE_TABLE_SIZE); | ||
71 | BUG_ON(in_interrupt()); | 76 | BUG_ON(in_interrupt()); |
72 | if (!PageHighMem(page)) | 77 | if (!PageHighMem(page)) |
73 | return page_address(page); | 78 | return page_address(page); |
diff --git a/arch/xtensa/include/asm/initialize_mmu.h b/arch/xtensa/include/asm/initialize_mmu.h index 7a1e075969a3..46d4bef61655 100644 --- a/arch/xtensa/include/asm/initialize_mmu.h +++ b/arch/xtensa/include/asm/initialize_mmu.h | |||
@@ -116,22 +116,35 @@ | |||
116 | add a5, a5, a4 | 116 | add a5, a5, a4 |
117 | bne a5, a2, 3b | 117 | bne a5, a2, 3b |
118 | 118 | ||
119 | /* Step 4: Setup MMU with the old V2 mappings. */ | 119 | /* Step 4: Setup MMU with the requested static mappings. */ |
120 | |||
120 | movi a6, 0x01000000 | 121 | movi a6, 0x01000000 |
121 | wsr a6, ITLBCFG | 122 | wsr a6, ITLBCFG |
122 | wsr a6, DTLBCFG | 123 | wsr a6, DTLBCFG |
123 | isync | 124 | isync |
124 | 125 | ||
125 | movi a5, 0xd0000005 | 126 | movi a5, XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_TLB_WAY |
126 | movi a4, CA_WRITEBACK | 127 | movi a4, XCHAL_KSEG_PADDR + CA_WRITEBACK |
128 | wdtlb a4, a5 | ||
129 | witlb a4, a5 | ||
130 | |||
131 | movi a5, XCHAL_KSEG_BYPASS_VADDR + XCHAL_KSEG_TLB_WAY | ||
132 | movi a4, XCHAL_KSEG_PADDR + CA_BYPASS | ||
127 | wdtlb a4, a5 | 133 | wdtlb a4, a5 |
128 | witlb a4, a5 | 134 | witlb a4, a5 |
129 | 135 | ||
130 | movi a5, 0xd8000005 | 136 | #ifdef CONFIG_XTENSA_KSEG_512M |
131 | movi a4, CA_BYPASS | 137 | movi a5, XCHAL_KSEG_CACHED_VADDR + 0x10000000 + XCHAL_KSEG_TLB_WAY |
138 | movi a4, XCHAL_KSEG_PADDR + 0x10000000 + CA_WRITEBACK | ||
132 | wdtlb a4, a5 | 139 | wdtlb a4, a5 |
133 | witlb a4, a5 | 140 | witlb a4, a5 |
134 | 141 | ||
142 | movi a5, XCHAL_KSEG_BYPASS_VADDR + 0x10000000 + XCHAL_KSEG_TLB_WAY | ||
143 | movi a4, XCHAL_KSEG_PADDR + 0x10000000 + CA_BYPASS | ||
144 | wdtlb a4, a5 | ||
145 | witlb a4, a5 | ||
146 | #endif | ||
147 | |||
135 | movi a5, XCHAL_KIO_CACHED_VADDR + 6 | 148 | movi a5, XCHAL_KIO_CACHED_VADDR + 6 |
136 | movi a4, XCHAL_KIO_DEFAULT_PADDR + CA_WRITEBACK | 149 | movi a4, XCHAL_KIO_DEFAULT_PADDR + CA_WRITEBACK |
137 | wdtlb a4, a5 | 150 | wdtlb a4, a5 |
diff --git a/arch/xtensa/include/asm/kmem_layout.h b/arch/xtensa/include/asm/kmem_layout.h index 4eb43b65a34d..bfce7ee8efd8 100644 --- a/arch/xtensa/include/asm/kmem_layout.h +++ b/arch/xtensa/include/asm/kmem_layout.h | |||
@@ -13,13 +13,59 @@ | |||
13 | 13 | ||
14 | #include <asm/types.h> | 14 | #include <asm/types.h> |
15 | 15 | ||
16 | #ifdef CONFIG_MMU | ||
17 | |||
16 | /* | 18 | /* |
17 | * Fixed TLB translations in the processor. | 19 | * Fixed TLB translations in the processor. |
18 | */ | 20 | */ |
19 | 21 | ||
22 | #define XCHAL_PAGE_TABLE_VADDR __XTENSA_UL_CONST(0x80000000) | ||
23 | #define XCHAL_PAGE_TABLE_SIZE __XTENSA_UL_CONST(0x00400000) | ||
24 | |||
25 | #if defined(CONFIG_XTENSA_KSEG_MMU_V2) | ||
26 | |||
20 | #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xd0000000) | 27 | #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xd0000000) |
21 | #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xd8000000) | 28 | #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xd8000000) |
22 | #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x08000000) | 29 | #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x08000000) |
30 | #define XCHAL_KSEG_ALIGNMENT __XTENSA_UL_CONST(0x08000000) | ||
31 | #define XCHAL_KSEG_TLB_WAY 5 | ||
32 | |||
33 | #elif defined(CONFIG_XTENSA_KSEG_256M) | ||
34 | |||
35 | #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xb0000000) | ||
36 | #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xc0000000) | ||
37 | #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x10000000) | ||
38 | #define XCHAL_KSEG_ALIGNMENT __XTENSA_UL_CONST(0x10000000) | ||
39 | #define XCHAL_KSEG_TLB_WAY 6 | ||
40 | |||
41 | #elif defined(CONFIG_XTENSA_KSEG_512M) | ||
42 | |||
43 | #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xa0000000) | ||
44 | #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xc0000000) | ||
45 | #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x20000000) | ||
46 | #define XCHAL_KSEG_ALIGNMENT __XTENSA_UL_CONST(0x10000000) | ||
47 | #define XCHAL_KSEG_TLB_WAY 6 | ||
48 | |||
49 | #else | ||
50 | #error Unsupported KSEG configuration | ||
51 | #endif | ||
52 | |||
53 | #ifdef CONFIG_KSEG_PADDR | ||
54 | #define XCHAL_KSEG_PADDR __XTENSA_UL_CONST(CONFIG_KSEG_PADDR) | ||
55 | #else | ||
23 | #define XCHAL_KSEG_PADDR __XTENSA_UL_CONST(0x00000000) | 56 | #define XCHAL_KSEG_PADDR __XTENSA_UL_CONST(0x00000000) |
57 | #endif | ||
58 | |||
59 | #if XCHAL_KSEG_PADDR & (XCHAL_KSEG_ALIGNMENT - 1) | ||
60 | #error XCHAL_KSEG_PADDR is not properly aligned to XCHAL_KSEG_ALIGNMENT | ||
61 | #endif | ||
62 | |||
63 | #else | ||
64 | |||
65 | #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xd0000000) | ||
66 | #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xd8000000) | ||
67 | #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x08000000) | ||
68 | |||
69 | #endif | ||
24 | 70 | ||
25 | #endif | 71 | #endif |
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h index fd12a1977ba8..8a02438232c4 100644 --- a/arch/xtensa/include/asm/page.h +++ b/arch/xtensa/include/asm/page.h | |||
@@ -27,10 +27,12 @@ | |||
27 | 27 | ||
28 | #ifdef CONFIG_MMU | 28 | #ifdef CONFIG_MMU |
29 | #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR | 29 | #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR |
30 | #define MAX_MEM_PFN XCHAL_KSEG_SIZE | 30 | #define MAX_LOW_PFN (PHYS_PFN(XCHAL_KSEG_PADDR) + \ |
31 | PHYS_PFN(XCHAL_KSEG_SIZE)) | ||
31 | #else | 32 | #else |
32 | #define PAGE_OFFSET __XTENSA_UL_CONST(0) | 33 | #define PAGE_OFFSET __XTENSA_UL_CONST(0) |
33 | #define MAX_MEM_PFN (PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE) | 34 | #define MAX_LOW_PFN (PHYS_PFN(PLATFORM_DEFAULT_MEM_START) + \ |
35 | PHYS_PFN(PLATFORM_DEFAULT_MEM_SIZE)) | ||
34 | #endif | 36 | #endif |
35 | 37 | ||
36 | #define PGTABLE_START 0x80000000 | 38 | #define PGTABLE_START 0x80000000 |
diff --git a/arch/xtensa/include/uapi/asm/types.h b/arch/xtensa/include/uapi/asm/types.h index 87ec7ae73cb1..2efc921506c4 100644 --- a/arch/xtensa/include/uapi/asm/types.h +++ b/arch/xtensa/include/uapi/asm/types.h | |||
@@ -18,7 +18,8 @@ | |||
18 | # define __XTENSA_UL_CONST(x) x | 18 | # define __XTENSA_UL_CONST(x) x |
19 | #else | 19 | #else |
20 | # define __XTENSA_UL(x) ((unsigned long)(x)) | 20 | # define __XTENSA_UL(x) ((unsigned long)(x)) |
21 | # define __XTENSA_UL_CONST(x) x##UL | 21 | # define ___XTENSA_UL_CONST(x) x##UL |
22 | # define __XTENSA_UL_CONST(x) ___XTENSA_UL_CONST(x) | ||
22 | #endif | 23 | #endif |
23 | 24 | ||
24 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index 4d7142beac72..302fa72d0d5a 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c | |||
@@ -266,8 +266,7 @@ void __init bootmem_init(void) | |||
266 | if (min_low_pfn > max_pfn) | 266 | if (min_low_pfn > max_pfn) |
267 | panic("No memory found!\n"); | 267 | panic("No memory found!\n"); |
268 | 268 | ||
269 | max_low_pfn = max_pfn < MAX_MEM_PFN >> PAGE_SHIFT ? | 269 | max_low_pfn = min(max_pfn, MAX_LOW_PFN); |
270 | max_pfn : MAX_MEM_PFN >> PAGE_SHIFT; | ||
271 | 270 | ||
272 | /* Find an area to use for the bootmem bitmap. */ | 271 | /* Find an area to use for the bootmem bitmap. */ |
273 | 272 | ||