Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Fix erroneous lmb->memblock conversions

Oooops... we missed these. We incorrectly converted strings
used when parsing the device-tree on pseries, thus breaking
access to drconf memory and hotplug memory.

While at it, also revert some variable names that represent
something the FW calls "lmb" and thus don't need to be converted
to "memblock".

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

+24 -24
+1 -1
arch/powerpc/kernel/prom.c
··· 414 414 u64 base, size, memblock_size; 415 415 unsigned int is_kexec_kdump = 0, rngs; 416 416 417 - ls = of_get_flat_dt_prop(node, "ibm,memblock-size", &l); 417 + ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l); 418 418 if (ls == NULL || l < dt_root_size_cells * sizeof(__be32)) 419 419 return 0; 420 420 memblock_size = dt_mem_next_cell(dt_root_size_cells, &ls);
+12 -12
arch/powerpc/mm/numa.c
··· 398 398 } 399 399 400 400 /* 401 - * Retreive and validate the ibm,memblock-size property for drconf memory 401 + * Retreive and validate the ibm,lmb-size property for drconf memory 402 402 * from the device tree. 403 403 */ 404 - static u64 of_get_memblock_size(struct device_node *memory) 404 + static u64 of_get_lmb_size(struct device_node *memory) 405 405 { 406 406 const u32 *prop; 407 407 u32 len; 408 408 409 - prop = of_get_property(memory, "ibm,memblock-size", &len); 409 + prop = of_get_property(memory, "ibm,lmb-size", &len); 410 410 if (!prop || len < sizeof(unsigned int)) 411 411 return 0; 412 412 ··· 562 562 static inline int __init read_usm_ranges(const u32 **usm) 563 563 { 564 564 /* 565 - * For each memblock in ibm,dynamic-memory a corresponding 565 + * For each lmb in ibm,dynamic-memory a corresponding 566 566 * entry in linux,drconf-usable-memory property contains 567 567 * a counter followed by that many (base, size) duple. 568 568 * read the counter from linux,drconf-usable-memory ··· 578 578 { 579 579 const u32 *dm, *usm; 580 580 unsigned int n, rc, ranges, is_kexec_kdump = 0; 581 - unsigned long memblock_size, base, size, sz; 581 + unsigned long lmb_size, base, size, sz; 582 582 int nid; 583 583 struct assoc_arrays aa; 584 584 ··· 586 586 if (!n) 587 587 return; 588 588 589 - memblock_size = of_get_memblock_size(memory); 590 - if (!memblock_size) 589 + lmb_size = of_get_lmb_size(memory); 590 + if (!lmb_size) 591 591 return; 592 592 593 593 rc = of_get_assoc_arrays(memory, &aa); ··· 611 611 continue; 612 612 613 613 base = drmem.base_addr; 614 - size = memblock_size; 614 + size = lmb_size; 615 615 ranges = 1; 616 616 617 617 if (is_kexec_kdump) { ··· 1072 1072 { 1073 1073 const u32 *dm; 1074 1074 unsigned int drconf_cell_cnt, rc; 1075 - unsigned long memblock_size; 1075 + unsigned long lmb_size; 1076 1076 struct assoc_arrays aa; 1077 1077 int nid = -1; 1078 1078 ··· 1080 1080 if (!drconf_cell_cnt) 1081 1081 return -1; 1082 1082 1083 - memblock_size = of_get_memblock_size(memory); 1084 - if (!memblock_size) 1083 + lmb_size = of_get_lmb_size(memory); 1084 + if (!lmb_size) 1085 1085 return -1; 1086 1086 1087 1087 rc = of_get_assoc_arrays(memory, &aa); ··· 1100 1100 continue; 1101 1101 1102 1102 if ((scn_addr < drmem.base_addr) 1103 - || (scn_addr >= (drmem.base_addr + memblock_size))) 1103 + || (scn_addr >= (drmem.base_addr + lmb_size))) 1104 1104 continue; 1105 1105 1106 1106 nid = of_drconf_to_nid_single(&drmem, &aa);
+11 -11
arch/powerpc/platforms/pseries/hotplug-memory.c
··· 69 69 const char *type; 70 70 const unsigned int *regs; 71 71 unsigned long base; 72 - unsigned int memblock_size; 72 + unsigned int lmb_size; 73 73 int ret = -EINVAL; 74 74 75 75 /* ··· 87 87 return ret; 88 88 89 89 base = *(unsigned long *)regs; 90 - memblock_size = regs[3]; 90 + lmb_size = regs[3]; 91 91 92 - ret = pseries_remove_memblock(base, memblock_size); 92 + ret = pseries_remove_memblock(base, lmb_size); 93 93 return ret; 94 94 } 95 95 ··· 98 98 const char *type; 99 99 const unsigned int *regs; 100 100 unsigned long base; 101 - unsigned int memblock_size; 101 + unsigned int lmb_size; 102 102 int ret = -EINVAL; 103 103 104 104 /* ··· 116 116 return ret; 117 117 118 118 base = *(unsigned long *)regs; 119 - memblock_size = regs[3]; 119 + lmb_size = regs[3]; 120 120 121 121 /* 122 122 * Update memory region to represent the memory add 123 123 */ 124 - ret = memblock_add(base, memblock_size); 124 + ret = memblock_add(base, lmb_size); 125 125 return (ret < 0) ? -EINVAL : 0; 126 126 } 127 127 128 128 static int pseries_drconf_memory(unsigned long *base, unsigned int action) 129 129 { 130 130 struct device_node *np; 131 - const unsigned long *memblock_size; 131 + const unsigned long *lmb_size; 132 132 int rc; 133 133 134 134 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); 135 135 if (!np) 136 136 return -EINVAL; 137 137 138 - memblock_size = of_get_property(np, "ibm,memblock-size", NULL); 139 - if (!memblock_size) { 138 + lmb_size = of_get_property(np, "ibm,lmb-size", NULL); 139 + if (!lmb_size) { 140 140 of_node_put(np); 141 141 return -EINVAL; 142 142 } 143 143 144 144 if (action == PSERIES_DRCONF_MEM_ADD) { 145 - rc = memblock_add(*base, *memblock_size); 145 + rc = memblock_add(*base, *lmb_size); 146 146 rc = (rc < 0) ? -EINVAL : 0; 147 147 } else if (action == PSERIES_DRCONF_MEM_REMOVE) { 148 - rc = pseries_remove_memblock(*base, *memblock_size); 148 + rc = pseries_remove_memblock(*base, *lmb_size); 149 149 } else { 150 150 rc = -EINVAL; 151 151 }