diff options
Diffstat (limited to 'arch/x86_64/mm/init.c')
-rw-r--r-- | arch/x86_64/mm/init.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index 52fd42c40c86..1e4669fa5734 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c | |||
@@ -229,7 +229,6 @@ __init void *early_ioremap(unsigned long addr, unsigned long size) | |||
229 | 229 | ||
230 | /* actually usually some more */ | 230 | /* actually usually some more */ |
231 | if (size >= LARGE_PAGE_SIZE) { | 231 | if (size >= LARGE_PAGE_SIZE) { |
232 | printk("SMBIOS area too long %lu\n", size); | ||
233 | return NULL; | 232 | return NULL; |
234 | } | 233 | } |
235 | set_pmd(temp_mappings[0].pmd, __pmd(map | _KERNPG_TABLE | _PAGE_PSE)); | 234 | set_pmd(temp_mappings[0].pmd, __pmd(map | _KERNPG_TABLE | _PAGE_PSE)); |
@@ -250,12 +249,13 @@ __init void early_iounmap(void *addr, unsigned long size) | |||
250 | } | 249 | } |
251 | 250 | ||
252 | static void __meminit | 251 | static void __meminit |
253 | phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end) | 252 | phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end) |
254 | { | 253 | { |
255 | int i; | 254 | int i = pmd_index(address); |
256 | 255 | ||
257 | for (i = 0; i < PTRS_PER_PMD; pmd++, i++, address += PMD_SIZE) { | 256 | for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) { |
258 | unsigned long entry; | 257 | unsigned long entry; |
258 | pmd_t *pmd = pmd_page + pmd_index(address); | ||
259 | 259 | ||
260 | if (address >= end) { | 260 | if (address >= end) { |
261 | if (!after_bootmem) | 261 | if (!after_bootmem) |
@@ -263,6 +263,10 @@ phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end) | |||
263 | set_pmd(pmd, __pmd(0)); | 263 | set_pmd(pmd, __pmd(0)); |
264 | break; | 264 | break; |
265 | } | 265 | } |
266 | |||
267 | if (pmd_val(*pmd)) | ||
268 | continue; | ||
269 | |||
266 | entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address; | 270 | entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address; |
267 | entry &= __supported_pte_mask; | 271 | entry &= __supported_pte_mask; |
268 | set_pmd(pmd, __pmd(entry)); | 272 | set_pmd(pmd, __pmd(entry)); |
@@ -272,45 +276,41 @@ phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end) | |||
272 | static void __meminit | 276 | static void __meminit |
273 | phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end) | 277 | phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end) |
274 | { | 278 | { |
275 | pmd_t *pmd = pmd_offset(pud, (unsigned long)__va(address)); | 279 | pmd_t *pmd = pmd_offset(pud,0); |
276 | 280 | spin_lock(&init_mm.page_table_lock); | |
277 | if (pmd_none(*pmd)) { | 281 | phys_pmd_init(pmd, address, end); |
278 | spin_lock(&init_mm.page_table_lock); | 282 | spin_unlock(&init_mm.page_table_lock); |
279 | phys_pmd_init(pmd, address, end); | 283 | __flush_tlb_all(); |
280 | spin_unlock(&init_mm.page_table_lock); | ||
281 | __flush_tlb_all(); | ||
282 | } | ||
283 | } | 284 | } |
284 | 285 | ||
285 | static void __meminit phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) | 286 | static void __meminit phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end) |
286 | { | 287 | { |
287 | long i = pud_index(address); | 288 | int i = pud_index(addr); |
288 | |||
289 | pud = pud + i; | ||
290 | 289 | ||
291 | if (after_bootmem && pud_val(*pud)) { | ||
292 | phys_pmd_update(pud, address, end); | ||
293 | return; | ||
294 | } | ||
295 | 290 | ||
296 | for (; i < PTRS_PER_PUD; pud++, i++) { | 291 | for (; i < PTRS_PER_PUD; i++, addr = (addr & PUD_MASK) + PUD_SIZE ) { |
297 | int map; | 292 | int map; |
298 | unsigned long paddr, pmd_phys; | 293 | unsigned long pmd_phys; |
294 | pud_t *pud = pud_page + pud_index(addr); | ||
299 | pmd_t *pmd; | 295 | pmd_t *pmd; |
300 | 296 | ||
301 | paddr = (address & PGDIR_MASK) + i*PUD_SIZE; | 297 | if (addr >= end) |
302 | if (paddr >= end) | ||
303 | break; | 298 | break; |
304 | 299 | ||
305 | if (!after_bootmem && !e820_any_mapped(paddr, paddr+PUD_SIZE, 0)) { | 300 | if (!after_bootmem && !e820_any_mapped(addr,addr+PUD_SIZE,0)) { |
306 | set_pud(pud, __pud(0)); | 301 | set_pud(pud, __pud(0)); |
307 | continue; | 302 | continue; |
308 | } | 303 | } |
309 | 304 | ||
305 | if (pud_val(*pud)) { | ||
306 | phys_pmd_update(pud, addr, end); | ||
307 | continue; | ||
308 | } | ||
309 | |||
310 | pmd = alloc_low_page(&map, &pmd_phys); | 310 | pmd = alloc_low_page(&map, &pmd_phys); |
311 | spin_lock(&init_mm.page_table_lock); | 311 | spin_lock(&init_mm.page_table_lock); |
312 | set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); | 312 | set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); |
313 | phys_pmd_init(pmd, paddr, end); | 313 | phys_pmd_init(pmd, addr, end); |
314 | spin_unlock(&init_mm.page_table_lock); | 314 | spin_unlock(&init_mm.page_table_lock); |
315 | unmap_low_page(map); | 315 | unmap_low_page(map); |
316 | } | 316 | } |
@@ -597,12 +597,6 @@ void __init mem_init(void) | |||
597 | 597 | ||
598 | pci_iommu_alloc(); | 598 | pci_iommu_alloc(); |
599 | 599 | ||
600 | /* How many end-of-memory variables you have, grandma! */ | ||
601 | max_low_pfn = end_pfn; | ||
602 | max_pfn = end_pfn; | ||
603 | num_physpages = end_pfn; | ||
604 | high_memory = (void *) __va(end_pfn * PAGE_SIZE); | ||
605 | |||
606 | /* clear the zero-page */ | 600 | /* clear the zero-page */ |
607 | memset(empty_zero_page, 0, PAGE_SIZE); | 601 | memset(empty_zero_page, 0, PAGE_SIZE); |
608 | 602 | ||