x86: clean up max_pfn_mapped usage - 32-bit
authorYinghai Lu <yhlu.kernel@gmail.com>
Mon, 2 Jun 2008 06:53:50 +0000 (23:53 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 3 Jun 2008 11:26:28 +0000 (13:26 +0200)
on 32-bit in head_32.S after initial page table is done, we get initial
max_pfn_mapped, and then kernel_physical_mapping_init will give us
a final one.

We need to use that to make sure find_e820_area will get valid addresses
for boot_map and for NODE_DATA(0) on numa32.

XEN PV and lguest may need to assign max_pfn_mapped too.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/head_32.S
arch/x86/kernel/setup_32.c
arch/x86/mm/discontig_32.c

index bef4618feadbc6020b78a6f230265865cfcd650c..ac7002fdd637e889f7dab03ae18c06d7518a0bb9 100644 (file)
@@ -220,6 +220,8 @@ default_entry:
        jb 10b
 1:
        movl %edi,pa(init_pg_tables_end)
+       shrl $12, %eax
+       movl %eax, pa(max_pfn_mapped)
 
        /* Do early initialization of the fixmap area */
        movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax
@@ -251,6 +253,8 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
        cmpl %ebp,%eax
        jb 10b
        movl %edi,pa(init_pg_tables_end)
+       shrl $12, %eax
+       movl %eax, pa(max_pfn_mapped)
 
        /* Do early initialization of the fixmap area */
        movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax
index 29010420458dd163bb64617962a52aafc2402102..c985a8c305e06871aee858f07080c61f5258e7aa 100644 (file)
@@ -586,7 +586,7 @@ void __init setup_bootmem_allocator(void)
         */
        bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT;
        bootmap = find_e820_area(min_low_pfn<<PAGE_SHIFT,
-                                max_low_pfn<<PAGE_SHIFT, bootmap_size,
+                                max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
                                 PAGE_SIZE);
        if (bootmap == -1L)
                panic("Cannot find bootmem map of size %ld\n", bootmap_size);
@@ -595,6 +595,8 @@ void __init setup_bootmem_allocator(void)
        reserve_initrd();
 #endif
        bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, max_low_pfn);
+       printk(KERN_INFO "  mapped low ram: 0 - %08lx\n",
+                max_pfn_mapped<<PAGE_SHIFT);
        printk(KERN_INFO "  low ram: %08lx - %08lx\n",
                 min_low_pfn<<PAGE_SHIFT, max_low_pfn<<PAGE_SHIFT);
        printk(KERN_INFO "  bootmap %08lx - %08lx\n",
index 73a983489c60ba30ea691803f721c10f29a48d82..914a81ee785507c6e10282fb00613bccb3ed215c 100644 (file)
@@ -163,7 +163,8 @@ static void __init allocate_pgdat(int nid)
        else {
                unsigned long pgdat_phys;
                pgdat_phys = find_e820_area(min_low_pfn<<PAGE_SHIFT,
-                                max_low_pfn<<PAGE_SHIFT, sizeof(pg_data_t),
+                                (nid ? max_low_pfn:max_pfn_mapped)<<PAGE_SHIFT,
+                                sizeof(pg_data_t),
                                 PAGE_SIZE);
                NODE_DATA(nid) = (pg_data_t *)(pfn_to_kaddr(pgdat_phys>>PAGE_SHIFT));
                reserve_early(pgdat_phys, pgdat_phys + sizeof(pg_data_t),