Merge tag 'io_uring-5.15-2021-09-11' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / arch / powerpc / platforms / pseries / hotplug-memory.c
index 377d852..91cf234 100644 (file)
@@ -180,6 +180,8 @@ static int update_lmb_associativity_index(struct drmem_lmb *lmb)
                return -ENODEV;
        }
 
+       update_numa_distance(lmb_node);
+
        dr_node = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
        if (!dr_node) {
                dlpar_free_cc_nodes(lmb_node);
@@ -211,13 +213,11 @@ static int update_lmb_associativity_index(struct drmem_lmb *lmb)
 static struct memory_block *lmb_to_memblock(struct drmem_lmb *lmb)
 {
        unsigned long section_nr;
-       struct mem_section *mem_sect;
        struct memory_block *mem_block;
 
        section_nr = pfn_to_section_nr(PFN_DOWN(lmb->base_addr));
-       mem_sect = __nr_to_section(section_nr);
 
-       mem_block = find_memory_block(mem_sect);
+       mem_block = find_memory_block(section_nr);
        return mem_block;
 }
 
@@ -286,7 +286,7 @@ static int pseries_remove_memblock(unsigned long base, unsigned long memblock_si
 {
        unsigned long block_sz, start_pfn;
        int sections_per_block;
-       int i, nid;
+       int i;
 
        start_pfn = base >> PAGE_SHIFT;
 
@@ -297,10 +297,9 @@ static int pseries_remove_memblock(unsigned long base, unsigned long memblock_si
 
        block_sz = pseries_memory_block_size();
        sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
-       nid = memory_add_physaddr_to_nid(base);
 
        for (i = 0; i < sections_per_block; i++) {
-               __remove_memory(nid, base, MIN_MEMORY_BLOCK_SIZE);
+               __remove_memory(base, MIN_MEMORY_BLOCK_SIZE);
                base += MIN_MEMORY_BLOCK_SIZE;
        }
 
@@ -387,7 +386,7 @@ static int dlpar_remove_lmb(struct drmem_lmb *lmb)
 
        block_sz = pseries_memory_block_size();
 
-       __remove_memory(mem_block->nid, lmb->base_addr, block_sz);
+       __remove_memory(lmb->base_addr, block_sz);
        put_device(&mem_block->dev);
 
        /* Update memory regions for memory remove */
@@ -660,7 +659,7 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
 
        rc = dlpar_online_lmb(lmb);
        if (rc) {
-               __remove_memory(nid, lmb->base_addr, block_sz);
+               __remove_memory(lmb->base_addr, block_sz);
                invalidate_lmb_associativity_index(lmb);
        } else {
                lmb->flags |= DRCONF_MEM_ASSIGNED;
@@ -979,6 +978,10 @@ static int pseries_memory_notifier(struct notifier_block *nb,
        case OF_RECONFIG_DETACH_NODE:
                err = pseries_remove_mem_node(rd->dn);
                break;
+       case OF_RECONFIG_UPDATE_PROPERTY:
+               if (!strcmp(rd->dn->name,
+                           "ibm,dynamic-reconfiguration-memory"))
+                       drmem_update_lmbs(rd->prop);
        }
        return notifier_from_errno(err);
 }