diff options
Diffstat (limited to 'arch/powerpc/mm/numa.c')
-rw-r--r-- | arch/powerpc/mm/numa.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 80d110635d24..f47364585ecd 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/nodemask.h> | 17 | #include <linux/nodemask.h> |
18 | #include <linux/cpu.h> | 18 | #include <linux/cpu.h> |
19 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
20 | #include <linux/lmb.h> | 20 | #include <linux/memblock.h> |
21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <linux/pfn.h> | 22 | #include <linux/pfn.h> |
23 | #include <asm/sparsemem.h> | 23 | #include <asm/sparsemem.h> |
@@ -351,7 +351,7 @@ struct of_drconf_cell { | |||
351 | #define DRCONF_MEM_RESERVED 0x00000080 | 351 | #define DRCONF_MEM_RESERVED 0x00000080 |
352 | 352 | ||
353 | /* | 353 | /* |
354 | * Read the next lmb list entry from the ibm,dynamic-memory property | 354 | * Read the next memblock list entry from the ibm,dynamic-memory property |
355 | * and return the information in the provided of_drconf_cell structure. | 355 | * and return the information in the provided of_drconf_cell structure. |
356 | */ | 356 | */ |
357 | static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp) | 357 | static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp) |
@@ -372,8 +372,8 @@ static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp) | |||
372 | /* | 372 | /* |
373 | * Retreive and validate the ibm,dynamic-memory property of the device tree. | 373 | * Retreive and validate the ibm,dynamic-memory property of the device tree. |
374 | * | 374 | * |
375 | * The layout of the ibm,dynamic-memory property is a number N of lmb | 375 | * The layout of the ibm,dynamic-memory property is a number N of memblock |
376 | * list entries followed by N lmb list entries. Each lmb list entry | 376 | * list entries followed by N memblock list entries. Each memblock list entry |
377 | * contains information as layed out in the of_drconf_cell struct above. | 377 | * contains information as layed out in the of_drconf_cell struct above. |
378 | */ | 378 | */ |
379 | static int of_get_drconf_memory(struct device_node *memory, const u32 **dm) | 379 | static int of_get_drconf_memory(struct device_node *memory, const u32 **dm) |
@@ -398,15 +398,15 @@ static int of_get_drconf_memory(struct device_node *memory, const u32 **dm) | |||
398 | } | 398 | } |
399 | 399 | ||
400 | /* | 400 | /* |
401 | * Retreive and validate the ibm,lmb-size property for drconf memory | 401 | * Retreive and validate the ibm,memblock-size property for drconf memory |
402 | * from the device tree. | 402 | * from the device tree. |
403 | */ | 403 | */ |
404 | static u64 of_get_lmb_size(struct device_node *memory) | 404 | static u64 of_get_memblock_size(struct device_node *memory) |
405 | { | 405 | { |
406 | const u32 *prop; | 406 | const u32 *prop; |
407 | u32 len; | 407 | u32 len; |
408 | 408 | ||
409 | prop = of_get_property(memory, "ibm,lmb-size", &len); | 409 | prop = of_get_property(memory, "ibm,memblock-size", &len); |
410 | if (!prop || len < sizeof(unsigned int)) | 410 | if (!prop || len < sizeof(unsigned int)) |
411 | return 0; | 411 | return 0; |
412 | 412 | ||
@@ -540,19 +540,19 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start, | |||
540 | unsigned long size) | 540 | unsigned long size) |
541 | { | 541 | { |
542 | /* | 542 | /* |
543 | * We use lmb_end_of_DRAM() in here instead of memory_limit because | 543 | * We use memblock_end_of_DRAM() in here instead of memory_limit because |
544 | * we've already adjusted it for the limit and it takes care of | 544 | * we've already adjusted it for the limit and it takes care of |
545 | * having memory holes below the limit. Also, in the case of | 545 | * having memory holes below the limit. Also, in the case of |
546 | * iommu_is_off, memory_limit is not set but is implicitly enforced. | 546 | * iommu_is_off, memory_limit is not set but is implicitly enforced. |
547 | */ | 547 | */ |
548 | 548 | ||
549 | if (start + size <= lmb_end_of_DRAM()) | 549 | if (start + size <= memblock_end_of_DRAM()) |
550 | return size; | 550 | return size; |
551 | 551 | ||
552 | if (start >= lmb_end_of_DRAM()) | 552 | if (start >= memblock_end_of_DRAM()) |
553 | return 0; | 553 | return 0; |
554 | 554 | ||
555 | return lmb_end_of_DRAM() - start; | 555 | return memblock_end_of_DRAM() - start; |
556 | } | 556 | } |
557 | 557 | ||
558 | /* | 558 | /* |
@@ -562,7 +562,7 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start, | |||
562 | static inline int __init read_usm_ranges(const u32 **usm) | 562 | static inline int __init read_usm_ranges(const u32 **usm) |
563 | { | 563 | { |
564 | /* | 564 | /* |
565 | * For each lmb in ibm,dynamic-memory a corresponding | 565 | * For each memblock in ibm,dynamic-memory a corresponding |
566 | * entry in linux,drconf-usable-memory property contains | 566 | * entry in linux,drconf-usable-memory property contains |
567 | * a counter followed by that many (base, size) duple. | 567 | * a counter followed by that many (base, size) duple. |
568 | * read the counter from linux,drconf-usable-memory | 568 | * read the counter from linux,drconf-usable-memory |
@@ -578,7 +578,7 @@ static void __init parse_drconf_memory(struct device_node *memory) | |||
578 | { | 578 | { |
579 | const u32 *dm, *usm; | 579 | const u32 *dm, *usm; |
580 | unsigned int n, rc, ranges, is_kexec_kdump = 0; | 580 | unsigned int n, rc, ranges, is_kexec_kdump = 0; |
581 | unsigned long lmb_size, base, size, sz; | 581 | unsigned long memblock_size, base, size, sz; |
582 | int nid; | 582 | int nid; |
583 | struct assoc_arrays aa; | 583 | struct assoc_arrays aa; |
584 | 584 | ||
@@ -586,8 +586,8 @@ static void __init parse_drconf_memory(struct device_node *memory) | |||
586 | if (!n) | 586 | if (!n) |
587 | return; | 587 | return; |
588 | 588 | ||
589 | lmb_size = of_get_lmb_size(memory); | 589 | memblock_size = of_get_memblock_size(memory); |
590 | if (!lmb_size) | 590 | if (!memblock_size) |
591 | return; | 591 | return; |
592 | 592 | ||
593 | rc = of_get_assoc_arrays(memory, &aa); | 593 | rc = of_get_assoc_arrays(memory, &aa); |
@@ -611,7 +611,7 @@ static void __init parse_drconf_memory(struct device_node *memory) | |||
611 | continue; | 611 | continue; |
612 | 612 | ||
613 | base = drmem.base_addr; | 613 | base = drmem.base_addr; |
614 | size = lmb_size; | 614 | size = memblock_size; |
615 | ranges = 1; | 615 | ranges = 1; |
616 | 616 | ||
617 | if (is_kexec_kdump) { | 617 | if (is_kexec_kdump) { |
@@ -731,7 +731,7 @@ new_range: | |||
731 | } | 731 | } |
732 | 732 | ||
733 | /* | 733 | /* |
734 | * Now do the same thing for each LMB listed in the ibm,dynamic-memory | 734 | * Now do the same thing for each MEMBLOCK listed in the ibm,dynamic-memory |
735 | * property in the ibm,dynamic-reconfiguration-memory node. | 735 | * property in the ibm,dynamic-reconfiguration-memory node. |
736 | */ | 736 | */ |
737 | memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); | 737 | memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); |
@@ -743,8 +743,8 @@ new_range: | |||
743 | 743 | ||
744 | static void __init setup_nonnuma(void) | 744 | static void __init setup_nonnuma(void) |
745 | { | 745 | { |
746 | unsigned long top_of_ram = lmb_end_of_DRAM(); | 746 | unsigned long top_of_ram = memblock_end_of_DRAM(); |
747 | unsigned long total_ram = lmb_phys_mem_size(); | 747 | unsigned long total_ram = memblock_phys_mem_size(); |
748 | unsigned long start_pfn, end_pfn; | 748 | unsigned long start_pfn, end_pfn; |
749 | unsigned int i, nid = 0; | 749 | unsigned int i, nid = 0; |
750 | 750 | ||
@@ -753,9 +753,9 @@ static void __init setup_nonnuma(void) | |||
753 | printk(KERN_DEBUG "Memory hole size: %ldMB\n", | 753 | printk(KERN_DEBUG "Memory hole size: %ldMB\n", |
754 | (top_of_ram - total_ram) >> 20); | 754 | (top_of_ram - total_ram) >> 20); |
755 | 755 | ||
756 | for (i = 0; i < lmb.memory.cnt; ++i) { | 756 | for (i = 0; i < memblock.memory.cnt; ++i) { |
757 | start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; | 757 | start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT; |
758 | end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); | 758 | end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i); |
759 | 759 | ||
760 | fake_numa_create_new_node(end_pfn, &nid); | 760 | fake_numa_create_new_node(end_pfn, &nid); |
761 | add_active_range(nid, start_pfn, end_pfn); | 761 | add_active_range(nid, start_pfn, end_pfn); |
@@ -813,7 +813,7 @@ static void __init dump_numa_memory_topology(void) | |||
813 | 813 | ||
814 | count = 0; | 814 | count = 0; |
815 | 815 | ||
816 | for (i = 0; i < lmb_end_of_DRAM(); | 816 | for (i = 0; i < memblock_end_of_DRAM(); |
817 | i += (1 << SECTION_SIZE_BITS)) { | 817 | i += (1 << SECTION_SIZE_BITS)) { |
818 | if (early_pfn_to_nid(i >> PAGE_SHIFT) == node) { | 818 | if (early_pfn_to_nid(i >> PAGE_SHIFT) == node) { |
819 | if (count == 0) | 819 | if (count == 0) |
@@ -833,7 +833,7 @@ static void __init dump_numa_memory_topology(void) | |||
833 | } | 833 | } |
834 | 834 | ||
835 | /* | 835 | /* |
836 | * Allocate some memory, satisfying the lmb or bootmem allocator where | 836 | * Allocate some memory, satisfying the memblock or bootmem allocator where |
837 | * required. nid is the preferred node and end is the physical address of | 837 | * required. nid is the preferred node and end is the physical address of |
838 | * the highest address in the node. | 838 | * the highest address in the node. |
839 | * | 839 | * |
@@ -847,11 +847,11 @@ static void __init *careful_zallocation(int nid, unsigned long size, | |||
847 | int new_nid; | 847 | int new_nid; |
848 | unsigned long ret_paddr; | 848 | unsigned long ret_paddr; |
849 | 849 | ||
850 | ret_paddr = __lmb_alloc_base(size, align, end_pfn << PAGE_SHIFT); | 850 | ret_paddr = __memblock_alloc_base(size, align, end_pfn << PAGE_SHIFT); |
851 | 851 | ||
852 | /* retry over all memory */ | 852 | /* retry over all memory */ |
853 | if (!ret_paddr) | 853 | if (!ret_paddr) |
854 | ret_paddr = __lmb_alloc_base(size, align, lmb_end_of_DRAM()); | 854 | ret_paddr = __memblock_alloc_base(size, align, memblock_end_of_DRAM()); |
855 | 855 | ||
856 | if (!ret_paddr) | 856 | if (!ret_paddr) |
857 | panic("numa.c: cannot allocate %lu bytes for node %d", | 857 | panic("numa.c: cannot allocate %lu bytes for node %d", |
@@ -861,14 +861,14 @@ static void __init *careful_zallocation(int nid, unsigned long size, | |||
861 | 861 | ||
862 | /* | 862 | /* |
863 | * We initialize the nodes in numeric order: 0, 1, 2... | 863 | * We initialize the nodes in numeric order: 0, 1, 2... |
864 | * and hand over control from the LMB allocator to the | 864 | * and hand over control from the MEMBLOCK allocator to the |
865 | * bootmem allocator. If this function is called for | 865 | * bootmem allocator. If this function is called for |
866 | * node 5, then we know that all nodes <5 are using the | 866 | * node 5, then we know that all nodes <5 are using the |
867 | * bootmem allocator instead of the LMB allocator. | 867 | * bootmem allocator instead of the MEMBLOCK allocator. |
868 | * | 868 | * |
869 | * So, check the nid from which this allocation came | 869 | * So, check the nid from which this allocation came |
870 | * and double check to see if we need to use bootmem | 870 | * and double check to see if we need to use bootmem |
871 | * instead of the LMB. We don't free the LMB memory | 871 | * instead of the MEMBLOCK. We don't free the MEMBLOCK memory |
872 | * since it would be useless. | 872 | * since it would be useless. |
873 | */ | 873 | */ |
874 | new_nid = early_pfn_to_nid(ret_paddr >> PAGE_SHIFT); | 874 | new_nid = early_pfn_to_nid(ret_paddr >> PAGE_SHIFT); |
@@ -893,9 +893,9 @@ static void mark_reserved_regions_for_nid(int nid) | |||
893 | struct pglist_data *node = NODE_DATA(nid); | 893 | struct pglist_data *node = NODE_DATA(nid); |
894 | int i; | 894 | int i; |
895 | 895 | ||
896 | for (i = 0; i < lmb.reserved.cnt; i++) { | 896 | for (i = 0; i < memblock.reserved.cnt; i++) { |
897 | unsigned long physbase = lmb.reserved.region[i].base; | 897 | unsigned long physbase = memblock.reserved.region[i].base; |
898 | unsigned long size = lmb.reserved.region[i].size; | 898 | unsigned long size = memblock.reserved.region[i].size; |
899 | unsigned long start_pfn = physbase >> PAGE_SHIFT; | 899 | unsigned long start_pfn = physbase >> PAGE_SHIFT; |
900 | unsigned long end_pfn = PFN_UP(physbase + size); | 900 | unsigned long end_pfn = PFN_UP(physbase + size); |
901 | struct node_active_region node_ar; | 901 | struct node_active_region node_ar; |
@@ -903,7 +903,7 @@ static void mark_reserved_regions_for_nid(int nid) | |||
903 | node->node_spanned_pages; | 903 | node->node_spanned_pages; |
904 | 904 | ||
905 | /* | 905 | /* |
906 | * Check to make sure that this lmb.reserved area is | 906 | * Check to make sure that this memblock.reserved area is |
907 | * within the bounds of the node that we care about. | 907 | * within the bounds of the node that we care about. |
908 | * Checking the nid of the start and end points is not | 908 | * Checking the nid of the start and end points is not |
909 | * sufficient because the reserved area could span the | 909 | * sufficient because the reserved area could span the |
@@ -961,7 +961,7 @@ void __init do_init_bootmem(void) | |||
961 | int nid; | 961 | int nid; |
962 | 962 | ||
963 | min_low_pfn = 0; | 963 | min_low_pfn = 0; |
964 | max_low_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT; | 964 | max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; |
965 | max_pfn = max_low_pfn; | 965 | max_pfn = max_low_pfn; |
966 | 966 | ||
967 | if (parse_numa_properties()) | 967 | if (parse_numa_properties()) |
@@ -1038,7 +1038,7 @@ void __init paging_init(void) | |||
1038 | { | 1038 | { |
1039 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | 1039 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
1040 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | 1040 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
1041 | max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT; | 1041 | max_zone_pfns[ZONE_DMA] = memblock_end_of_DRAM() >> PAGE_SHIFT; |
1042 | free_area_init_nodes(max_zone_pfns); | 1042 | free_area_init_nodes(max_zone_pfns); |
1043 | } | 1043 | } |
1044 | 1044 | ||
@@ -1072,7 +1072,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory, | |||
1072 | { | 1072 | { |
1073 | const u32 *dm; | 1073 | const u32 *dm; |
1074 | unsigned int drconf_cell_cnt, rc; | 1074 | unsigned int drconf_cell_cnt, rc; |
1075 | unsigned long lmb_size; | 1075 | unsigned long memblock_size; |
1076 | struct assoc_arrays aa; | 1076 | struct assoc_arrays aa; |
1077 | int nid = -1; | 1077 | int nid = -1; |
1078 | 1078 | ||
@@ -1080,8 +1080,8 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory, | |||
1080 | if (!drconf_cell_cnt) | 1080 | if (!drconf_cell_cnt) |
1081 | return -1; | 1081 | return -1; |
1082 | 1082 | ||
1083 | lmb_size = of_get_lmb_size(memory); | 1083 | memblock_size = of_get_memblock_size(memory); |
1084 | if (!lmb_size) | 1084 | if (!memblock_size) |
1085 | return -1; | 1085 | return -1; |
1086 | 1086 | ||
1087 | rc = of_get_assoc_arrays(memory, &aa); | 1087 | rc = of_get_assoc_arrays(memory, &aa); |
@@ -1100,7 +1100,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory, | |||
1100 | continue; | 1100 | continue; |
1101 | 1101 | ||
1102 | if ((scn_addr < drmem.base_addr) | 1102 | if ((scn_addr < drmem.base_addr) |
1103 | || (scn_addr >= (drmem.base_addr + lmb_size))) | 1103 | || (scn_addr >= (drmem.base_addr + memblock_size))) |
1104 | continue; | 1104 | continue; |
1105 | 1105 | ||
1106 | nid = of_drconf_to_nid_single(&drmem, &aa); | 1106 | nid = of_drconf_to_nid_single(&drmem, &aa); |
@@ -1113,7 +1113,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory, | |||
1113 | /* | 1113 | /* |
1114 | * Find the node associated with a hot added memory section for memory | 1114 | * Find the node associated with a hot added memory section for memory |
1115 | * represented in the device tree as a node (i.e. memory@XXXX) for | 1115 | * represented in the device tree as a node (i.e. memory@XXXX) for |
1116 | * each lmb. | 1116 | * each memblock. |
1117 | */ | 1117 | */ |
1118 | int hot_add_node_scn_to_nid(unsigned long scn_addr) | 1118 | int hot_add_node_scn_to_nid(unsigned long scn_addr) |
1119 | { | 1119 | { |
@@ -1154,8 +1154,8 @@ int hot_add_node_scn_to_nid(unsigned long scn_addr) | |||
1154 | 1154 | ||
1155 | /* | 1155 | /* |
1156 | * Find the node associated with a hot added memory section. Section | 1156 | * Find the node associated with a hot added memory section. Section |
1157 | * corresponds to a SPARSEMEM section, not an LMB. It is assumed that | 1157 | * corresponds to a SPARSEMEM section, not an MEMBLOCK. It is assumed that |
1158 | * sections are fully contained within a single LMB. | 1158 | * sections are fully contained within a single MEMBLOCK. |
1159 | */ | 1159 | */ |
1160 | int hot_add_scn_to_nid(unsigned long scn_addr) | 1160 | int hot_add_scn_to_nid(unsigned long scn_addr) |
1161 | { | 1161 | { |