In addition to setting DRCONF_MEM_HOTREMOVABLE for boot-time hot-plugged
memory, we should set the same too for the memory that gets hot-plugged
post-boot. This ensures that correct LMB flags value is reflected in
ibm,dynamic-memory-vN property.

Signed-off-by: Bharata B Rao <[email protected]>
---
 arch/powerpc/platforms/pseries/hotplug-memory.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c 
b/arch/powerpc/platforms/pseries/hotplug-memory.c
index a4d40a3ceea3..6d75f6e182ae 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -395,7 +395,8 @@ static int dlpar_remove_lmb(struct drmem_lmb *lmb)
 
        invalidate_lmb_associativity_index(lmb);
        lmb_clear_nid(lmb);
-       lmb->flags &= ~DRCONF_MEM_ASSIGNED;
+       lmb->flags &= ~(DRCONF_MEM_ASSIGNED |
+                       DRCONF_MEM_HOTREMOVABLE);
 
        return 0;
 }
@@ -678,7 +679,8 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
                invalidate_lmb_associativity_index(lmb);
                lmb_clear_nid(lmb);
        } else {
-               lmb->flags |= DRCONF_MEM_ASSIGNED;
+               lmb->flags |= (DRCONF_MEM_ASSIGNED |
+                              DRCONF_MEM_HOTREMOVABLE);
        }
 
        return rc;
-- 
2.21.0

Reply via email to