ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2
PATCH RESEND v3 1/1 ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2
From: Leonardo Bras <[email protected]>
On reboot, all memory that was previously added using object_add and device_add is placed in this DIMM area.
The new SPAPR_LMB_FLAGS_HOTREMOVABLE flag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed by device_del and object_del.
This new flag was accepted in Power Architecture documentation.
---
Changes since v1:
- Flag name changed from SPAPR_LMB_FLAGS_HOTPLUGGED to SPAPR_LMB_FLAGS_HOTREMOVABLE
--- hw/ppc/spapr.c | 3 ++- include/hw/ppc/spapr.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +2 -1
@@ -446,7 +446,8 @@ static int spapr_dt_dynamic_memory_v2(SpaprMachineState *spapr, void *fdt,g_assert (drc); elem =spapr_get_drconf_cell (size / lmb_size, addr,spapr_drc_index (drc), node, -SPAPR_LMB_FLAGS_ASSIGNED ); + (SPAPR_LMB_FLAGS_ASSIGNED | + SPAPR_LMB_FLAGS_HOTREMOVABLE);QSIMPLEQ_INSERT_TAIL (&drconf_queue, elem, entry); nr_entries++; cur_addr = addr + size;
include/hw/ppc/spapr.h +1 -0
@@ -880,6 +880,7 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset);#define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008#define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020#define SPAPR_LMB_FLAGS_RESERVED 0x00000080 +#define SPAPR_LMB_FLAGS_HOTREMOVABLE 0x00000100void spapr_do_system_reset_on_cpu (CPUState *cs,run_on_cpu_data arg);
Signature · 1 line
2.25.1
David Gibson
AppliedQuoted 10 lines · Leonardo Bras
From: Leonardo Bras <[email protected]>
On reboot, all memory that was previously added using
object_addanddevice_addis placed in this DIMM area.The new
SPAPR_LMB_FLAGS_HOTREMOVABLEflag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed bydevice_delandobject_del.
Quoted 4 lines
This new flag was accepted in Power Architecture documentation.
Signed-off-by Leonardo Bras <[email protected]>Reviewed-by Bharata B Rao <[email protected]>
Applied to ppc-for-5.1, thanks.
Quoted 36 lines
---
Changes since v1:
- Flag name changed fromSPAPR_LMB_FLAGS_HOTPLUGGEDtoSPAPR_LMB_FLAGS_HOTREMOVABLE--- hw/ppc/spapr.c | 3 ++- include/hw/ppc/spapr.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)hw/ppc/spapr.c +2
-1@@ -446,7 +446,8 @@ static int spapr_dt_dynamic_memory_v2(SpaprMachineState *spapr, void *fdt,g_assert (drc); elem =spapr_get_drconf_cell (size / lmb_size, addr,spapr_drc_index (drc), node, -SPAPR_LMB_FLAGS_ASSIGNED ); + (SPAPR_LMB_FLAGS_ASSIGNED | + SPAPR_LMB_FLAGS_HOTREMOVABLE);QSIMPLEQ_INSERT_TAIL (&drconf_queue, elem, entry); nr_entries++; cur_addr = addr + size;include/hw/ppc/spapr.h +1
-0@@ -880,6 +880,7 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset);#define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008#define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020#define SPAPR_LMB_FLAGS_RESERVED 0x00000080 +#define SPAPR_LMB_FLAGS_HOTREMOVABLE 0x00000100void spapr_do_system_reset_on_cpu (CPUState *cs,run_on_cpu_data arg);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 9 lines
hw/ppc/spapr.c static int spapr_dt_dynamic_memory_v2(SpaprMachineState *spapr, void *fdt, · line 450
Quoted 9 lines
hw/ppc/spapr.c +2
-1@@ -446,7 +446,8 @@ static int spapr_dt_dynamic_memory_v2(SpaprMachineState *spapr, void *fdt,g_assert (drc); elem =spapr_get_drconf_cell (size / lmb_size, addr,spapr_drc_index (drc), node, -SPAPR_LMB_FLAGS_ASSIGNED ); + (SPAPR_LMB_FLAGS_ASSIGNED | + SPAPR_LMB_FLAGS_HOTREMOVABLE);
This is missing a ')'
C.
Quoted 4 lines · Cédric Le Goater
Quoted 4 lines
Quoted 4 lines
hw/ppc/spapr.c +0
-0@@ -446,7 +446,8 @@ static int spapr_dt_dynamic_memory_v2(SpaprMachineState *spapr, void *fdt,g_assert (drc);
Quoted 8 lines
Quoted 5 lines
hw/ppc/spapr.c static int spapr_dt_dynamic_memory_v2(SpaprMachineState *spapr, void *fdt, · line 450
Quoted 5 lines
hw/ppc/spapr.c +2
-1elem =spapr_get_drconf_cell (size / lmb_size, addr,spapr_drc_index (drc), node, -SPAPR_LMB_FLAGS_ASSIGNED ); + (SPAPR_LMB_FLAGS_ASSIGNED | + SPAPR_LMB_FLAGS_HOTREMOVABLE);This is missing a ')'
So it is. I've corrected this in my tree, but please do compile test your patches before sending.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 6 lines · Leonardo Bras
The new
SPAPR_LMB_FLAGS_HOTREMOVABLEflag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed bydevice_delandobject_del.This new flag was accepted in Power Architecture documentation.
FYI: LoPAR released for public review.
https://openpowerfoundation.org/?resource_lib=linux-on-power-architecture-reference-a-papr-linux-subset-review-draft
It contains the new flag implemented by this patch.