diff options
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/init.c | 10 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 14 | ||||
-rw-r--r-- | arch/x86/mm/init_64.c | 11 | ||||
-rw-r--r-- | arch/x86/mm/k8topology_64.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/memtest.c | 7 | ||||
-rw-r--r-- | arch/x86/mm/numa_32.c | 25 | ||||
-rw-r--r-- | arch/x86/mm/numa_64.c | 34 | ||||
-rw-r--r-- | arch/x86/mm/srat_32.c | 3 | ||||
-rw-r--r-- | arch/x86/mm/srat_64.c | 11 |
9 files changed, 64 insertions, 55 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index b278535b14aa..c0e28a13de7d 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/initrd.h> | 2 | #include <linux/initrd.h> |
3 | #include <linux/ioport.h> | 3 | #include <linux/ioport.h> |
4 | #include <linux/swap.h> | 4 | #include <linux/swap.h> |
5 | #include <linux/memblock.h> | ||
5 | 6 | ||
6 | #include <asm/cacheflush.h> | 7 | #include <asm/cacheflush.h> |
7 | #include <asm/e820.h> | 8 | #include <asm/e820.h> |
@@ -33,6 +34,7 @@ static void __init find_early_table_space(unsigned long end, int use_pse, | |||
33 | int use_gbpages) | 34 | int use_gbpages) |
34 | { | 35 | { |
35 | unsigned long puds, pmds, ptes, tables, start; | 36 | unsigned long puds, pmds, ptes, tables, start; |
37 | phys_addr_t base; | ||
36 | 38 | ||
37 | puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; | 39 | puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; |
38 | tables = roundup(puds * sizeof(pud_t), PAGE_SIZE); | 40 | tables = roundup(puds * sizeof(pud_t), PAGE_SIZE); |
@@ -75,12 +77,12 @@ static void __init find_early_table_space(unsigned long end, int use_pse, | |||
75 | #else | 77 | #else |
76 | start = 0x8000; | 78 | start = 0x8000; |
77 | #endif | 79 | #endif |
78 | e820_table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT, | 80 | base = memblock_find_in_range(start, max_pfn_mapped<<PAGE_SHIFT, |
79 | tables, PAGE_SIZE); | 81 | tables, PAGE_SIZE); |
80 | if (e820_table_start == -1UL) | 82 | if (base == MEMBLOCK_ERROR) |
81 | panic("Cannot find space for the kernel page tables"); | 83 | panic("Cannot find space for the kernel page tables"); |
82 | 84 | ||
83 | e820_table_start >>= PAGE_SHIFT; | 85 | e820_table_start = base >> PAGE_SHIFT; |
84 | e820_table_end = e820_table_start; | 86 | e820_table_end = e820_table_start; |
85 | e820_table_top = e820_table_start + (tables >> PAGE_SHIFT); | 87 | e820_table_top = e820_table_start + (tables >> PAGE_SHIFT); |
86 | 88 | ||
@@ -299,7 +301,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
299 | __flush_tlb_all(); | 301 | __flush_tlb_all(); |
300 | 302 | ||
301 | if (!after_bootmem && e820_table_end > e820_table_start) | 303 | if (!after_bootmem && e820_table_end > e820_table_start) |
302 | reserve_early(e820_table_start << PAGE_SHIFT, | 304 | memblock_x86_reserve_range(e820_table_start << PAGE_SHIFT, |
303 | e820_table_end << PAGE_SHIFT, "PGTABLE"); | 305 | e820_table_end << PAGE_SHIFT, "PGTABLE"); |
304 | 306 | ||
305 | if (!after_bootmem) | 307 | if (!after_bootmem) |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 90e054589aae..63b09bae2509 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pfn.h> | 25 | #include <linux/pfn.h> |
26 | #include <linux/poison.h> | 26 | #include <linux/poison.h> |
27 | #include <linux/bootmem.h> | 27 | #include <linux/bootmem.h> |
28 | #include <linux/memblock.h> | ||
28 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
29 | #include <linux/memory_hotplug.h> | 30 | #include <linux/memory_hotplug.h> |
30 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
@@ -712,14 +713,14 @@ void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn, | |||
712 | highstart_pfn = highend_pfn = max_pfn; | 713 | highstart_pfn = highend_pfn = max_pfn; |
713 | if (max_pfn > max_low_pfn) | 714 | if (max_pfn > max_low_pfn) |
714 | highstart_pfn = max_low_pfn; | 715 | highstart_pfn = max_low_pfn; |
715 | e820_register_active_regions(0, 0, highend_pfn); | 716 | memblock_x86_register_active_regions(0, 0, highend_pfn); |
716 | sparse_memory_present_with_active_regions(0); | 717 | sparse_memory_present_with_active_regions(0); |
717 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | 718 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", |
718 | pages_to_mb(highend_pfn - highstart_pfn)); | 719 | pages_to_mb(highend_pfn - highstart_pfn)); |
719 | num_physpages = highend_pfn; | 720 | num_physpages = highend_pfn; |
720 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | 721 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; |
721 | #else | 722 | #else |
722 | e820_register_active_regions(0, 0, max_low_pfn); | 723 | memblock_x86_register_active_regions(0, 0, max_low_pfn); |
723 | sparse_memory_present_with_active_regions(0); | 724 | sparse_memory_present_with_active_regions(0); |
724 | num_physpages = max_low_pfn; | 725 | num_physpages = max_low_pfn; |
725 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | 726 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; |
@@ -776,16 +777,16 @@ void __init setup_bootmem_allocator(void) | |||
776 | { | 777 | { |
777 | #ifndef CONFIG_NO_BOOTMEM | 778 | #ifndef CONFIG_NO_BOOTMEM |
778 | int nodeid; | 779 | int nodeid; |
779 | unsigned long bootmap_size, bootmap; | 780 | phys_addr_t bootmap_size, bootmap; |
780 | /* | 781 | /* |
781 | * Initialize the boot-time allocator (with low memory only): | 782 | * Initialize the boot-time allocator (with low memory only): |
782 | */ | 783 | */ |
783 | bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT; | 784 | bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT; |
784 | bootmap = find_e820_area(0, max_pfn_mapped<<PAGE_SHIFT, bootmap_size, | 785 | bootmap = memblock_find_in_range(0, max_pfn_mapped<<PAGE_SHIFT, bootmap_size, |
785 | PAGE_SIZE); | 786 | PAGE_SIZE); |
786 | if (bootmap == -1L) | 787 | if (bootmap == MEMBLOCK_ERROR) |
787 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); | 788 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); |
788 | reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP"); | 789 | memblock_x86_reserve_range(bootmap, bootmap + bootmap_size, "BOOTMAP"); |
789 | #endif | 790 | #endif |
790 | 791 | ||
791 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", | 792 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", |
@@ -1069,3 +1070,4 @@ void mark_rodata_ro(void) | |||
1069 | #endif | 1070 | #endif |
1070 | } | 1071 | } |
1071 | #endif | 1072 | #endif |
1073 | |||
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 634fa0884a41..592b2368062d 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/initrd.h> | 21 | #include <linux/initrd.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
24 | #include <linux/memblock.h> | ||
24 | #include <linux/proc_fs.h> | 25 | #include <linux/proc_fs.h> |
25 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
26 | #include <linux/pfn.h> | 27 | #include <linux/pfn.h> |
@@ -577,18 +578,18 @@ void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn, | |||
577 | unsigned long bootmap_size, bootmap; | 578 | unsigned long bootmap_size, bootmap; |
578 | 579 | ||
579 | bootmap_size = bootmem_bootmap_pages(end_pfn)<<PAGE_SHIFT; | 580 | bootmap_size = bootmem_bootmap_pages(end_pfn)<<PAGE_SHIFT; |
580 | bootmap = find_e820_area(0, end_pfn<<PAGE_SHIFT, bootmap_size, | 581 | bootmap = memblock_find_in_range(0, end_pfn<<PAGE_SHIFT, bootmap_size, |
581 | PAGE_SIZE); | 582 | PAGE_SIZE); |
582 | if (bootmap == -1L) | 583 | if (bootmap == MEMBLOCK_ERROR) |
583 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); | 584 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); |
584 | reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP"); | 585 | memblock_x86_reserve_range(bootmap, bootmap + bootmap_size, "BOOTMAP"); |
585 | /* don't touch min_low_pfn */ | 586 | /* don't touch min_low_pfn */ |
586 | bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT, | 587 | bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT, |
587 | 0, end_pfn); | 588 | 0, end_pfn); |
588 | e820_register_active_regions(0, start_pfn, end_pfn); | 589 | memblock_x86_register_active_regions(0, start_pfn, end_pfn); |
589 | free_bootmem_with_active_regions(0, end_pfn); | 590 | free_bootmem_with_active_regions(0, end_pfn); |
590 | #else | 591 | #else |
591 | e820_register_active_regions(0, start_pfn, end_pfn); | 592 | memblock_x86_register_active_regions(0, start_pfn, end_pfn); |
592 | #endif | 593 | #endif |
593 | } | 594 | } |
594 | #endif | 595 | #endif |
diff --git a/arch/x86/mm/k8topology_64.c b/arch/x86/mm/k8topology_64.c index 970ed579d4e4..966de9372e8c 100644 --- a/arch/x86/mm/k8topology_64.c +++ b/arch/x86/mm/k8topology_64.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/nodemask.h> | 13 | #include <linux/nodemask.h> |
14 | #include <linux/memblock.h> | ||
15 | |||
14 | #include <asm/io.h> | 16 | #include <asm/io.h> |
15 | #include <linux/pci_ids.h> | 17 | #include <linux/pci_ids.h> |
16 | #include <linux/acpi.h> | 18 | #include <linux/acpi.h> |
@@ -222,7 +224,7 @@ int __init k8_scan_nodes(void) | |||
222 | for_each_node_mask(i, node_possible_map) { | 224 | for_each_node_mask(i, node_possible_map) { |
223 | int j; | 225 | int j; |
224 | 226 | ||
225 | e820_register_active_regions(i, | 227 | memblock_x86_register_active_regions(i, |
226 | nodes[i].start >> PAGE_SHIFT, | 228 | nodes[i].start >> PAGE_SHIFT, |
227 | nodes[i].end >> PAGE_SHIFT); | 229 | nodes[i].end >> PAGE_SHIFT); |
228 | for (j = apicid_base; j < cores + apicid_base; j++) | 230 | for (j = apicid_base; j < cores + apicid_base; j++) |
diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c index 18d244f70205..92faf3a1c53e 100644 --- a/arch/x86/mm/memtest.c +++ b/arch/x86/mm/memtest.c | |||
@@ -6,8 +6,7 @@ | |||
6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <linux/pfn.h> | 8 | #include <linux/pfn.h> |
9 | 9 | #include <linux/memblock.h> | |
10 | #include <asm/e820.h> | ||
11 | 10 | ||
12 | static u64 patterns[] __initdata = { | 11 | static u64 patterns[] __initdata = { |
13 | 0, | 12 | 0, |
@@ -35,7 +34,7 @@ static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad) | |||
35 | (unsigned long long) pattern, | 34 | (unsigned long long) pattern, |
36 | (unsigned long long) start_bad, | 35 | (unsigned long long) start_bad, |
37 | (unsigned long long) end_bad); | 36 | (unsigned long long) end_bad); |
38 | reserve_early(start_bad, end_bad, "BAD RAM"); | 37 | memblock_x86_reserve_range(start_bad, end_bad, "BAD RAM"); |
39 | } | 38 | } |
40 | 39 | ||
41 | static void __init memtest(u64 pattern, u64 start_phys, u64 size) | 40 | static void __init memtest(u64 pattern, u64 start_phys, u64 size) |
@@ -74,7 +73,7 @@ static void __init do_one_pass(u64 pattern, u64 start, u64 end) | |||
74 | u64 size = 0; | 73 | u64 size = 0; |
75 | 74 | ||
76 | while (start < end) { | 75 | while (start < end) { |
77 | start = find_e820_area_size(start, &size, 1); | 76 | start = memblock_x86_find_in_range_size(start, &size, 1); |
78 | 77 | ||
79 | /* done ? */ | 78 | /* done ? */ |
80 | if (start >= end) | 79 | if (start >= end) |
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c index 809baaaf48b1..ddf9730b2061 100644 --- a/arch/x86/mm/numa_32.c +++ b/arch/x86/mm/numa_32.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
26 | #include <linux/bootmem.h> | 26 | #include <linux/bootmem.h> |
27 | #include <linux/memblock.h> | ||
27 | #include <linux/mmzone.h> | 28 | #include <linux/mmzone.h> |
28 | #include <linux/highmem.h> | 29 | #include <linux/highmem.h> |
29 | #include <linux/initrd.h> | 30 | #include <linux/initrd.h> |
@@ -120,7 +121,7 @@ int __init get_memcfg_numa_flat(void) | |||
120 | 121 | ||
121 | node_start_pfn[0] = 0; | 122 | node_start_pfn[0] = 0; |
122 | node_end_pfn[0] = max_pfn; | 123 | node_end_pfn[0] = max_pfn; |
123 | e820_register_active_regions(0, 0, max_pfn); | 124 | memblock_x86_register_active_regions(0, 0, max_pfn); |
124 | memory_present(0, 0, max_pfn); | 125 | memory_present(0, 0, max_pfn); |
125 | node_remap_size[0] = node_memmap_size_bytes(0, 0, max_pfn); | 126 | node_remap_size[0] = node_memmap_size_bytes(0, 0, max_pfn); |
126 | 127 | ||
@@ -161,14 +162,14 @@ static void __init allocate_pgdat(int nid) | |||
161 | NODE_DATA(nid) = (pg_data_t *)node_remap_start_vaddr[nid]; | 162 | NODE_DATA(nid) = (pg_data_t *)node_remap_start_vaddr[nid]; |
162 | else { | 163 | else { |
163 | unsigned long pgdat_phys; | 164 | unsigned long pgdat_phys; |
164 | pgdat_phys = find_e820_area(min_low_pfn<<PAGE_SHIFT, | 165 | pgdat_phys = memblock_find_in_range(min_low_pfn<<PAGE_SHIFT, |
165 | max_pfn_mapped<<PAGE_SHIFT, | 166 | max_pfn_mapped<<PAGE_SHIFT, |
166 | sizeof(pg_data_t), | 167 | sizeof(pg_data_t), |
167 | PAGE_SIZE); | 168 | PAGE_SIZE); |
168 | NODE_DATA(nid) = (pg_data_t *)(pfn_to_kaddr(pgdat_phys>>PAGE_SHIFT)); | 169 | NODE_DATA(nid) = (pg_data_t *)(pfn_to_kaddr(pgdat_phys>>PAGE_SHIFT)); |
169 | memset(buf, 0, sizeof(buf)); | 170 | memset(buf, 0, sizeof(buf)); |
170 | sprintf(buf, "NODE_DATA %d", nid); | 171 | sprintf(buf, "NODE_DATA %d", nid); |
171 | reserve_early(pgdat_phys, pgdat_phys + sizeof(pg_data_t), buf); | 172 | memblock_x86_reserve_range(pgdat_phys, pgdat_phys + sizeof(pg_data_t), buf); |
172 | } | 173 | } |
173 | printk(KERN_DEBUG "allocate_pgdat: node %d NODE_DATA %08lx\n", | 174 | printk(KERN_DEBUG "allocate_pgdat: node %d NODE_DATA %08lx\n", |
174 | nid, (unsigned long)NODE_DATA(nid)); | 175 | nid, (unsigned long)NODE_DATA(nid)); |
@@ -291,15 +292,15 @@ static __init unsigned long calculate_numa_remap_pages(void) | |||
291 | PTRS_PER_PTE); | 292 | PTRS_PER_PTE); |
292 | node_kva_target <<= PAGE_SHIFT; | 293 | node_kva_target <<= PAGE_SHIFT; |
293 | do { | 294 | do { |
294 | node_kva_final = find_e820_area(node_kva_target, | 295 | node_kva_final = memblock_find_in_range(node_kva_target, |
295 | ((u64)node_end_pfn[nid])<<PAGE_SHIFT, | 296 | ((u64)node_end_pfn[nid])<<PAGE_SHIFT, |
296 | ((u64)size)<<PAGE_SHIFT, | 297 | ((u64)size)<<PAGE_SHIFT, |
297 | LARGE_PAGE_BYTES); | 298 | LARGE_PAGE_BYTES); |
298 | node_kva_target -= LARGE_PAGE_BYTES; | 299 | node_kva_target -= LARGE_PAGE_BYTES; |
299 | } while (node_kva_final == -1ULL && | 300 | } while (node_kva_final == MEMBLOCK_ERROR && |
300 | (node_kva_target>>PAGE_SHIFT) > (node_start_pfn[nid])); | 301 | (node_kva_target>>PAGE_SHIFT) > (node_start_pfn[nid])); |
301 | 302 | ||
302 | if (node_kva_final == -1ULL) | 303 | if (node_kva_final == MEMBLOCK_ERROR) |
303 | panic("Can not get kva ram\n"); | 304 | panic("Can not get kva ram\n"); |
304 | 305 | ||
305 | node_remap_size[nid] = size; | 306 | node_remap_size[nid] = size; |
@@ -318,9 +319,9 @@ static __init unsigned long calculate_numa_remap_pages(void) | |||
318 | * but we could have some hole in high memory, and it will only | 319 | * but we could have some hole in high memory, and it will only |
319 | * check page_is_ram(pfn) && !page_is_reserved_early(pfn) to decide | 320 | * check page_is_ram(pfn) && !page_is_reserved_early(pfn) to decide |
320 | * to use it as free. | 321 | * to use it as free. |
321 | * So reserve_early here, hope we don't run out of that array | 322 | * So memblock_x86_reserve_range here, hope we don't run out of that array |
322 | */ | 323 | */ |
323 | reserve_early(node_kva_final, | 324 | memblock_x86_reserve_range(node_kva_final, |
324 | node_kva_final+(((u64)size)<<PAGE_SHIFT), | 325 | node_kva_final+(((u64)size)<<PAGE_SHIFT), |
325 | "KVA RAM"); | 326 | "KVA RAM"); |
326 | 327 | ||
@@ -367,14 +368,14 @@ void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn, | |||
367 | 368 | ||
368 | kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE); | 369 | kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE); |
369 | do { | 370 | do { |
370 | kva_start_pfn = find_e820_area(kva_target_pfn<<PAGE_SHIFT, | 371 | kva_start_pfn = memblock_find_in_range(kva_target_pfn<<PAGE_SHIFT, |
371 | max_low_pfn<<PAGE_SHIFT, | 372 | max_low_pfn<<PAGE_SHIFT, |
372 | kva_pages<<PAGE_SHIFT, | 373 | kva_pages<<PAGE_SHIFT, |
373 | PTRS_PER_PTE<<PAGE_SHIFT) >> PAGE_SHIFT; | 374 | PTRS_PER_PTE<<PAGE_SHIFT) >> PAGE_SHIFT; |
374 | kva_target_pfn -= PTRS_PER_PTE; | 375 | kva_target_pfn -= PTRS_PER_PTE; |
375 | } while (kva_start_pfn == -1UL && kva_target_pfn > min_low_pfn); | 376 | } while (kva_start_pfn == MEMBLOCK_ERROR && kva_target_pfn > min_low_pfn); |
376 | 377 | ||
377 | if (kva_start_pfn == -1UL) | 378 | if (kva_start_pfn == MEMBLOCK_ERROR) |
378 | panic("Can not get kva space\n"); | 379 | panic("Can not get kva space\n"); |
379 | 380 | ||
380 | printk(KERN_INFO "kva_start_pfn ~ %lx max_low_pfn ~ %lx\n", | 381 | printk(KERN_INFO "kva_start_pfn ~ %lx max_low_pfn ~ %lx\n", |
@@ -382,7 +383,7 @@ void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn, | |||
382 | printk(KERN_INFO "max_pfn = %lx\n", max_pfn); | 383 | printk(KERN_INFO "max_pfn = %lx\n", max_pfn); |
383 | 384 | ||
384 | /* avoid clash with initrd */ | 385 | /* avoid clash with initrd */ |
385 | reserve_early(kva_start_pfn<<PAGE_SHIFT, | 386 | memblock_x86_reserve_range(kva_start_pfn<<PAGE_SHIFT, |
386 | (kva_start_pfn + kva_pages)<<PAGE_SHIFT, | 387 | (kva_start_pfn + kva_pages)<<PAGE_SHIFT, |
387 | "KVA PG"); | 388 | "KVA PG"); |
388 | #ifdef CONFIG_HIGHMEM | 389 | #ifdef CONFIG_HIGHMEM |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 3d54f9f95d46..984b1ff7db44 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -87,16 +87,16 @@ static int __init allocate_cachealigned_memnodemap(void) | |||
87 | 87 | ||
88 | addr = 0x8000; | 88 | addr = 0x8000; |
89 | nodemap_size = roundup(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES); | 89 | nodemap_size = roundup(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES); |
90 | nodemap_addr = find_e820_area(addr, max_pfn<<PAGE_SHIFT, | 90 | nodemap_addr = memblock_find_in_range(addr, max_pfn<<PAGE_SHIFT, |
91 | nodemap_size, L1_CACHE_BYTES); | 91 | nodemap_size, L1_CACHE_BYTES); |
92 | if (nodemap_addr == -1UL) { | 92 | if (nodemap_addr == MEMBLOCK_ERROR) { |
93 | printk(KERN_ERR | 93 | printk(KERN_ERR |
94 | "NUMA: Unable to allocate Memory to Node hash map\n"); | 94 | "NUMA: Unable to allocate Memory to Node hash map\n"); |
95 | nodemap_addr = nodemap_size = 0; | 95 | nodemap_addr = nodemap_size = 0; |
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | memnodemap = phys_to_virt(nodemap_addr); | 98 | memnodemap = phys_to_virt(nodemap_addr); |
99 | reserve_early(nodemap_addr, nodemap_addr + nodemap_size, "MEMNODEMAP"); | 99 | memblock_x86_reserve_range(nodemap_addr, nodemap_addr + nodemap_size, "MEMNODEMAP"); |
100 | 100 | ||
101 | printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n", | 101 | printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n", |
102 | nodemap_addr, nodemap_addr + nodemap_size); | 102 | nodemap_addr, nodemap_addr + nodemap_size); |
@@ -227,7 +227,7 @@ setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) | |||
227 | if (node_data[nodeid] == NULL) | 227 | if (node_data[nodeid] == NULL) |
228 | return; | 228 | return; |
229 | nodedata_phys = __pa(node_data[nodeid]); | 229 | nodedata_phys = __pa(node_data[nodeid]); |
230 | reserve_early(nodedata_phys, nodedata_phys + pgdat_size, "NODE_DATA"); | 230 | memblock_x86_reserve_range(nodedata_phys, nodedata_phys + pgdat_size, "NODE_DATA"); |
231 | printk(KERN_INFO " NODE_DATA [%016lx - %016lx]\n", nodedata_phys, | 231 | printk(KERN_INFO " NODE_DATA [%016lx - %016lx]\n", nodedata_phys, |
232 | nodedata_phys + pgdat_size - 1); | 232 | nodedata_phys + pgdat_size - 1); |
233 | nid = phys_to_nid(nodedata_phys); | 233 | nid = phys_to_nid(nodedata_phys); |
@@ -246,7 +246,7 @@ setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) | |||
246 | * Find a place for the bootmem map | 246 | * Find a place for the bootmem map |
247 | * nodedata_phys could be on other nodes by alloc_bootmem, | 247 | * nodedata_phys could be on other nodes by alloc_bootmem, |
248 | * so need to sure bootmap_start not to be small, otherwise | 248 | * so need to sure bootmap_start not to be small, otherwise |
249 | * early_node_mem will get that with find_e820_area instead | 249 | * early_node_mem will get that with memblock_find_in_range instead |
250 | * of alloc_bootmem, that could clash with reserved range | 250 | * of alloc_bootmem, that could clash with reserved range |
251 | */ | 251 | */ |
252 | bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn); | 252 | bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn); |
@@ -258,12 +258,12 @@ setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) | |||
258 | bootmap = early_node_mem(nodeid, bootmap_start, end, | 258 | bootmap = early_node_mem(nodeid, bootmap_start, end, |
259 | bootmap_pages<<PAGE_SHIFT, PAGE_SIZE); | 259 | bootmap_pages<<PAGE_SHIFT, PAGE_SIZE); |
260 | if (bootmap == NULL) { | 260 | if (bootmap == NULL) { |
261 | free_early(nodedata_phys, nodedata_phys + pgdat_size); | 261 | memblock_x86_free_range(nodedata_phys, nodedata_phys + pgdat_size); |
262 | node_data[nodeid] = NULL; | 262 | node_data[nodeid] = NULL; |
263 | return; | 263 | return; |
264 | } | 264 | } |
265 | bootmap_start = __pa(bootmap); | 265 | bootmap_start = __pa(bootmap); |
266 | reserve_early(bootmap_start, bootmap_start+(bootmap_pages<<PAGE_SHIFT), | 266 | memblock_x86_reserve_range(bootmap_start, bootmap_start+(bootmap_pages<<PAGE_SHIFT), |
267 | "BOOTMAP"); | 267 | "BOOTMAP"); |
268 | 268 | ||
269 | bootmap_size = init_bootmem_node(NODE_DATA(nodeid), | 269 | bootmap_size = init_bootmem_node(NODE_DATA(nodeid), |
@@ -417,7 +417,7 @@ static int __init split_nodes_interleave(u64 addr, u64 max_addr, | |||
417 | nr_nodes = MAX_NUMNODES; | 417 | nr_nodes = MAX_NUMNODES; |
418 | } | 418 | } |
419 | 419 | ||
420 | size = (max_addr - addr - e820_hole_size(addr, max_addr)) / nr_nodes; | 420 | size = (max_addr - addr - memblock_x86_hole_size(addr, max_addr)) / nr_nodes; |
421 | /* | 421 | /* |
422 | * Calculate the number of big nodes that can be allocated as a result | 422 | * Calculate the number of big nodes that can be allocated as a result |
423 | * of consolidating the remainder. | 423 | * of consolidating the remainder. |
@@ -453,7 +453,7 @@ static int __init split_nodes_interleave(u64 addr, u64 max_addr, | |||
453 | * non-reserved memory is less than the per-node size. | 453 | * non-reserved memory is less than the per-node size. |
454 | */ | 454 | */ |
455 | while (end - physnodes[i].start - | 455 | while (end - physnodes[i].start - |
456 | e820_hole_size(physnodes[i].start, end) < size) { | 456 | memblock_x86_hole_size(physnodes[i].start, end) < size) { |
457 | end += FAKE_NODE_MIN_SIZE; | 457 | end += FAKE_NODE_MIN_SIZE; |
458 | if (end > physnodes[i].end) { | 458 | if (end > physnodes[i].end) { |
459 | end = physnodes[i].end; | 459 | end = physnodes[i].end; |
@@ -467,7 +467,7 @@ static int __init split_nodes_interleave(u64 addr, u64 max_addr, | |||
467 | * this one must extend to the boundary. | 467 | * this one must extend to the boundary. |
468 | */ | 468 | */ |
469 | if (end < dma32_end && dma32_end - end - | 469 | if (end < dma32_end && dma32_end - end - |
470 | e820_hole_size(end, dma32_end) < FAKE_NODE_MIN_SIZE) | 470 | memblock_x86_hole_size(end, dma32_end) < FAKE_NODE_MIN_SIZE) |
471 | end = dma32_end; | 471 | end = dma32_end; |
472 | 472 | ||
473 | /* | 473 | /* |
@@ -476,7 +476,7 @@ static int __init split_nodes_interleave(u64 addr, u64 max_addr, | |||
476 | * physical node. | 476 | * physical node. |
477 | */ | 477 | */ |
478 | if (physnodes[i].end - end - | 478 | if (physnodes[i].end - end - |
479 | e820_hole_size(end, physnodes[i].end) < size) | 479 | memblock_x86_hole_size(end, physnodes[i].end) < size) |
480 | end = physnodes[i].end; | 480 | end = physnodes[i].end; |
481 | 481 | ||
482 | /* | 482 | /* |
@@ -504,7 +504,7 @@ static u64 __init find_end_of_node(u64 start, u64 max_addr, u64 size) | |||
504 | { | 504 | { |
505 | u64 end = start + size; | 505 | u64 end = start + size; |
506 | 506 | ||
507 | while (end - start - e820_hole_size(start, end) < size) { | 507 | while (end - start - memblock_x86_hole_size(start, end) < size) { |
508 | end += FAKE_NODE_MIN_SIZE; | 508 | end += FAKE_NODE_MIN_SIZE; |
509 | if (end > max_addr) { | 509 | if (end > max_addr) { |
510 | end = max_addr; | 510 | end = max_addr; |
@@ -533,7 +533,7 @@ static int __init split_nodes_size_interleave(u64 addr, u64 max_addr, u64 size) | |||
533 | * creates a uniform distribution of node sizes across the entire | 533 | * creates a uniform distribution of node sizes across the entire |
534 | * machine (but not necessarily over physical nodes). | 534 | * machine (but not necessarily over physical nodes). |
535 | */ | 535 | */ |
536 | min_size = (max_addr - addr - e820_hole_size(addr, max_addr)) / | 536 | min_size = (max_addr - addr - memblock_x86_hole_size(addr, max_addr)) / |
537 | MAX_NUMNODES; | 537 | MAX_NUMNODES; |
538 | min_size = max(min_size, FAKE_NODE_MIN_SIZE); | 538 | min_size = max(min_size, FAKE_NODE_MIN_SIZE); |
539 | if ((min_size & FAKE_NODE_MIN_HASH_MASK) < min_size) | 539 | if ((min_size & FAKE_NODE_MIN_HASH_MASK) < min_size) |
@@ -566,7 +566,7 @@ static int __init split_nodes_size_interleave(u64 addr, u64 max_addr, u64 size) | |||
566 | * this one must extend to the boundary. | 566 | * this one must extend to the boundary. |
567 | */ | 567 | */ |
568 | if (end < dma32_end && dma32_end - end - | 568 | if (end < dma32_end && dma32_end - end - |
569 | e820_hole_size(end, dma32_end) < FAKE_NODE_MIN_SIZE) | 569 | memblock_x86_hole_size(end, dma32_end) < FAKE_NODE_MIN_SIZE) |
570 | end = dma32_end; | 570 | end = dma32_end; |
571 | 571 | ||
572 | /* | 572 | /* |
@@ -575,7 +575,7 @@ static int __init split_nodes_size_interleave(u64 addr, u64 max_addr, u64 size) | |||
575 | * physical node. | 575 | * physical node. |
576 | */ | 576 | */ |
577 | if (physnodes[i].end - end - | 577 | if (physnodes[i].end - end - |
578 | e820_hole_size(end, physnodes[i].end) < size) | 578 | memblock_x86_hole_size(end, physnodes[i].end) < size) |
579 | end = physnodes[i].end; | 579 | end = physnodes[i].end; |
580 | 580 | ||
581 | /* | 581 | /* |
@@ -639,7 +639,7 @@ static int __init numa_emulation(unsigned long start_pfn, | |||
639 | */ | 639 | */ |
640 | remove_all_active_ranges(); | 640 | remove_all_active_ranges(); |
641 | for_each_node_mask(i, node_possible_map) { | 641 | for_each_node_mask(i, node_possible_map) { |
642 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, | 642 | memblock_x86_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, |
643 | nodes[i].end >> PAGE_SHIFT); | 643 | nodes[i].end >> PAGE_SHIFT); |
644 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 644 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
645 | } | 645 | } |
@@ -692,7 +692,7 @@ void __init initmem_init(unsigned long start_pfn, unsigned long last_pfn, | |||
692 | node_set(0, node_possible_map); | 692 | node_set(0, node_possible_map); |
693 | for (i = 0; i < nr_cpu_ids; i++) | 693 | for (i = 0; i < nr_cpu_ids; i++) |
694 | numa_set_node(i, 0); | 694 | numa_set_node(i, 0); |
695 | e820_register_active_regions(0, start_pfn, last_pfn); | 695 | memblock_x86_register_active_regions(0, start_pfn, last_pfn); |
696 | setup_node_bootmem(0, start_pfn << PAGE_SHIFT, last_pfn << PAGE_SHIFT); | 696 | setup_node_bootmem(0, start_pfn << PAGE_SHIFT, last_pfn << PAGE_SHIFT); |
697 | } | 697 | } |
698 | 698 | ||
diff --git a/arch/x86/mm/srat_32.c b/arch/x86/mm/srat_32.c index 9324f13492d5..a17dffd136c1 100644 --- a/arch/x86/mm/srat_32.c +++ b/arch/x86/mm/srat_32.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/bootmem.h> | 27 | #include <linux/bootmem.h> |
28 | #include <linux/memblock.h> | ||
28 | #include <linux/mmzone.h> | 29 | #include <linux/mmzone.h> |
29 | #include <linux/acpi.h> | 30 | #include <linux/acpi.h> |
30 | #include <linux/nodemask.h> | 31 | #include <linux/nodemask.h> |
@@ -264,7 +265,7 @@ int __init get_memcfg_from_srat(void) | |||
264 | if (node_read_chunk(chunk->nid, chunk)) | 265 | if (node_read_chunk(chunk->nid, chunk)) |
265 | continue; | 266 | continue; |
266 | 267 | ||
267 | e820_register_active_regions(chunk->nid, chunk->start_pfn, | 268 | memblock_x86_register_active_regions(chunk->nid, chunk->start_pfn, |
268 | min(chunk->end_pfn, max_pfn)); | 269 | min(chunk->end_pfn, max_pfn)); |
269 | } | 270 | } |
270 | /* for out of order entries in SRAT */ | 271 | /* for out of order entries in SRAT */ |
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c index f9897f7a9ef1..7f44eb62a5e9 100644 --- a/arch/x86/mm/srat_64.c +++ b/arch/x86/mm/srat_64.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/topology.h> | 17 | #include <linux/topology.h> |
18 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
19 | #include <linux/memblock.h> | ||
19 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
20 | #include <asm/proto.h> | 21 | #include <asm/proto.h> |
21 | #include <asm/numa.h> | 22 | #include <asm/numa.h> |
@@ -98,15 +99,15 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) | |||
98 | unsigned long phys; | 99 | unsigned long phys; |
99 | 100 | ||
100 | length = slit->header.length; | 101 | length = slit->header.length; |
101 | phys = find_e820_area(0, max_pfn_mapped<<PAGE_SHIFT, length, | 102 | phys = memblock_find_in_range(0, max_pfn_mapped<<PAGE_SHIFT, length, |
102 | PAGE_SIZE); | 103 | PAGE_SIZE); |
103 | 104 | ||
104 | if (phys == -1L) | 105 | if (phys == MEMBLOCK_ERROR) |
105 | panic(" Can not save slit!\n"); | 106 | panic(" Can not save slit!\n"); |
106 | 107 | ||
107 | acpi_slit = __va(phys); | 108 | acpi_slit = __va(phys); |
108 | memcpy(acpi_slit, slit, length); | 109 | memcpy(acpi_slit, slit, length); |
109 | reserve_early(phys, phys + length, "ACPI SLIT"); | 110 | memblock_x86_reserve_range(phys, phys + length, "ACPI SLIT"); |
110 | } | 111 | } |
111 | 112 | ||
112 | /* Callback for Proximity Domain -> x2APIC mapping */ | 113 | /* Callback for Proximity Domain -> x2APIC mapping */ |
@@ -324,7 +325,7 @@ static int __init nodes_cover_memory(const struct bootnode *nodes) | |||
324 | pxmram = 0; | 325 | pxmram = 0; |
325 | } | 326 | } |
326 | 327 | ||
327 | e820ram = max_pfn - (e820_hole_size(0, max_pfn<<PAGE_SHIFT)>>PAGE_SHIFT); | 328 | e820ram = max_pfn - (memblock_x86_hole_size(0, max_pfn<<PAGE_SHIFT)>>PAGE_SHIFT); |
328 | /* We seem to lose 3 pages somewhere. Allow 1M of slack. */ | 329 | /* We seem to lose 3 pages somewhere. Allow 1M of slack. */ |
329 | if ((long)(e820ram - pxmram) >= (1<<(20 - PAGE_SHIFT))) { | 330 | if ((long)(e820ram - pxmram) >= (1<<(20 - PAGE_SHIFT))) { |
330 | printk(KERN_ERR | 331 | printk(KERN_ERR |
@@ -421,7 +422,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
421 | } | 422 | } |
422 | 423 | ||
423 | for_each_node_mask(i, nodes_parsed) | 424 | for_each_node_mask(i, nodes_parsed) |
424 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, | 425 | memblock_x86_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, |
425 | nodes[i].end >> PAGE_SHIFT); | 426 | nodes[i].end >> PAGE_SHIFT); |
426 | /* for out of order entries in SRAT */ | 427 | /* for out of order entries in SRAT */ |
427 | sort_node_map(); | 428 | sort_node_map(); |