aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r--arch/x86/mm/init_64.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 32ba13b0f818..48623ae628fb 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -18,6 +18,7 @@
18#include <linux/swap.h> 18#include <linux/swap.h>
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/initrd.h>
21#include <linux/pagemap.h> 22#include <linux/pagemap.h>
22#include <linux/bootmem.h> 23#include <linux/bootmem.h>
23#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
@@ -135,7 +136,7 @@ static __init void *spp_getpage(void)
135 return ptr; 136 return ptr;
136} 137}
137 138
138static void 139static __init void
139set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot) 140set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
140{ 141{
141 pgd_t *pgd; 142 pgd_t *pgd;
@@ -206,7 +207,7 @@ void __init cleanup_highmap(void)
206 pmd_t *last_pmd = pmd + PTRS_PER_PMD; 207 pmd_t *last_pmd = pmd + PTRS_PER_PMD;
207 208
208 for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) { 209 for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) {
209 if (!pmd_present(*pmd)) 210 if (pmd_none(*pmd))
210 continue; 211 continue;
211 if (vaddr < (unsigned long) _text || vaddr > end) 212 if (vaddr < (unsigned long) _text || vaddr > end)
212 set_pmd(pmd, __pmd(0)); 213 set_pmd(pmd, __pmd(0));
@@ -214,7 +215,7 @@ void __init cleanup_highmap(void)
214} 215}
215 216
216/* NOTE: this is meant to be run only at boot */ 217/* NOTE: this is meant to be run only at boot */
217void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot) 218void __init __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
218{ 219{
219 unsigned long address = __fix_to_virt(idx); 220 unsigned long address = __fix_to_virt(idx);
220 221
@@ -312,6 +313,8 @@ __meminit void early_iounmap(void *addr, unsigned long size)
312static unsigned long __meminit 313static unsigned long __meminit
313phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end) 314phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
314{ 315{
316 unsigned long pages = 0;
317
315 int i = pmd_index(address); 318 int i = pmd_index(address);
316 319
317 for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) { 320 for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) {
@@ -328,9 +331,11 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
328 if (pmd_val(*pmd)) 331 if (pmd_val(*pmd))
329 continue; 332 continue;
330 333
334 pages++;
331 set_pte((pte_t *)pmd, 335 set_pte((pte_t *)pmd,
332 pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); 336 pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
333 } 337 }
338 update_page_count(PG_LEVEL_2M, pages);
334 return address; 339 return address;
335} 340}
336 341
@@ -350,6 +355,7 @@ phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
350static unsigned long __meminit 355static unsigned long __meminit
351phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end) 356phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
352{ 357{
358 unsigned long pages = 0;
353 unsigned long last_map_addr = end; 359 unsigned long last_map_addr = end;
354 int i = pud_index(addr); 360 int i = pud_index(addr);
355 361
@@ -374,6 +380,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
374 } 380 }
375 381
376 if (direct_gbpages) { 382 if (direct_gbpages) {
383 pages++;
377 set_pte((pte_t *)pud, 384 set_pte((pte_t *)pud,
378 pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); 385 pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
379 last_map_addr = (addr & PUD_MASK) + PUD_SIZE; 386 last_map_addr = (addr & PUD_MASK) + PUD_SIZE;
@@ -390,6 +397,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
390 unmap_low_page(pmd); 397 unmap_low_page(pmd);
391 } 398 }
392 __flush_tlb_all(); 399 __flush_tlb_all();
400 update_page_count(PG_LEVEL_1G, pages);
393 401
394 return last_map_addr >> PAGE_SHIFT; 402 return last_map_addr >> PAGE_SHIFT;
395} 403}
@@ -431,7 +439,7 @@ static void __init init_gbpages(void)
431 direct_gbpages = 0; 439 direct_gbpages = 0;
432} 440}
433 441
434#ifdef CONFIG_MEMTEST_BOOTPARAM 442#ifdef CONFIG_MEMTEST
435 443
436static void __init memtest(unsigned long start_phys, unsigned long size, 444static void __init memtest(unsigned long start_phys, unsigned long size,
437 unsigned pattern) 445 unsigned pattern)
@@ -493,7 +501,8 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
493 501
494} 502}
495 503
496static int memtest_pattern __initdata = CONFIG_MEMTEST_BOOTPARAM_VALUE; 504/* default is disabled */
505static int memtest_pattern __initdata;
497 506
498static int __init parse_memtest(char *arg) 507static int __init parse_memtest(char *arg)
499{ 508{
@@ -506,7 +515,7 @@ early_param("memtest", parse_memtest);
506 515
507static void __init early_memtest(unsigned long start, unsigned long end) 516static void __init early_memtest(unsigned long start, unsigned long end)
508{ 517{
509 unsigned long t_start, t_size; 518 u64 t_start, t_size;
510 unsigned pattern; 519 unsigned pattern;
511 520
512 if (!memtest_pattern) 521 if (!memtest_pattern)
@@ -525,8 +534,9 @@ static void __init early_memtest(unsigned long start, unsigned long end)
525 if (t_start + t_size > end) 534 if (t_start + t_size > end)
526 t_size = end - t_start; 535 t_size = end - t_start;
527 536
528 printk(KERN_CONT "\n %016lx - %016lx pattern %d", 537 printk(KERN_CONT "\n %016llx - %016llx pattern %d",
529 t_start, t_start + t_size, pattern); 538 (unsigned long long)t_start,
539 (unsigned long long)t_start + t_size, pattern);
530 540
531 memtest(t_start, t_size, pattern); 541 memtest(t_start, t_size, pattern);
532 542