Support for ibm,dynamic-memory-v2
cover Support for ibm,dynamic-memory-v2
This is an RFC version of patchset to support the new ibm,dynamic-memory-v2 property which allows the LMB information to be represented in a more compact form by grouping LMBs into sets.
I have tested it very lightly and observe guest crashes (during reboot) in a few scenarios. I am still trying to figure out the reason.
Bharata B Rao (2):
pc-dimm: Make pc_dimm_built_list() global
spapr: Support ibm,dynamic-memory-v2 property
docs/specs/ppc-spapr-hotplug.txt | 19 +++ hw/mem/pc-dimm.c | 2 +- hw/ppc/spapr.c | 254 +++++++++++++++++++++++++++++++++------ include/hw/mem/pc-dimm.h | 1 + include/hw/ppc/spapr.h | 1 + include/hw/ppc/spapr_ovec.h | 1 + 6 files changed, 237 insertions(+), 41 deletions(-)
Signature · 1 line
2.7.4
RFC PATCH 1/2 pc-dimm: Make pc_dimm_built_list() global
Making pc_dimm_built_list() global allows other parts of QEMU code to build and walk through the DIMM list in address-sorted order.
This is needed in the next patch for sPAPR code to create ibm,dynamic-memory-v2 device tree property that will have entries for populated DIMMs as well as available hotpluggable areas.
CHECK: List of DIMMs is already available via qmp_pc_dimm_device_list(), but that doesn't provide a sorted list.
--- hw/mem/pc-dimm.c | 2 +- include/hw/mem/pc-dimm.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
hw/mem/pc-dimm.c +1 -1
@@ -261,7 +261,7 @@ static gint pc_dimm_addr_sort(gconstpointer a, gconstpointer b)return 0 ; } -static int pc_dimm_built_list (Object *obj,void *opaque) +int pc_dimm_built_list (Object *obj,void *opaque) {GSList **list = opaque;
include/hw/mem/pc-dimm.h +1 -0
@@ -100,4 +100,5 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms, MemoryRegion *mr, uint64_t align, Error **errp);void pc_dimm_memory_unplug (DeviceState *dev,MemoryHotplugState *hpms,MemoryRegion *mr); +int pc_dimm_built_list (Object *obj,void *opaque);#endif
Signature · 1 line
2.7.4
Re: [Qemu-devel] [RFC PATCH v0 1/2] pc-dimm: Make pc_dimm_built_list() global
Quoted 8 lines · On Mon, 19 Feb 2018 12:12:53 +0530 Bharata B Rao <[email protected]>…
Making
pc_dimm_built_list()global allows other parts of QEMU code to build and walk through the DIMM list in address-sorted order.This is needed in the next patch for sPAPR code to create ibm,dynamic-memory-v2 device tree property that will have entries for populated DIMMs as well as available hotpluggable areas.
CHECK: List of DIMMs is already available via
qmp_pc_dimm_device_list(),
maybe make it sorted first and use it?
(i.e. use pc_dimm_built_list in qmp_pc_dimm_device_list) and hide recursive callback ugliness from external users.
MemoryDeviceInfoList *qmp_pc_dimm_device_list(void) {
object_child_foreach(qdev_get_machine(), pc_dimm_built_list, &list);
...
}Quoted 31 lines
but that doesn't provide a sorted list.
Signed-off-by Bharata B Rao <[email protected]>--- hw/mem/pc-dimm.c | 2 +- include/hw/mem/pc-dimm.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)hw/mem/pc-dimm.c +1
-1@@ -261,7 +261,7 @@ static gint pc_dimm_addr_sort(gconstpointer a, gconstpointer b)return 0 ; } -static int pc_dimm_built_list (Object *obj,void *opaque) +int pc_dimm_built_list (Object *obj,void *opaque) {GSList **list = opaque;include/hw/mem/pc-dimm.h +1
-0@@ -100,4 +100,5 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms, MemoryRegion *mr, uint64_t align, Error **errp);void pc_dimm_memory_unplug (DeviceState *dev,MemoryHotplugState *hpms,MemoryRegion *mr); +int pc_dimm_built_list (Object *obj,void *opaque);#endif
Re: [Qemu-devel] [RFC PATCH v0 1/2] pc-dimm: Make pc_dimm_built_list() global
Quoted 13 lines · Igor Mammedov
Quoted 8 lines · On Mon, 19 Feb 2018 12:12:53 +0530 Bharata B Rao <[email protected]>…
Making
pc_dimm_built_list()global allows other parts of QEMU code to build and walk through the DIMM list in address-sorted order.This is needed in the next patch for sPAPR code to create ibm,dynamic-memory-v2 device tree property that will have entries for populated DIMMs as well as available hotpluggable areas.
CHECK: List of DIMMs is already available via
qmp_pc_dimm_device_list(),maybe make it sorted first and use it?
Quoted 7 lines
(i.e. use
pc_dimm_built_listinqmp_pc_dimm_device_list) and hide recursive callback ugliness from external users.MemoryDeviceInfoList *qmp_pc_dimm_device_list(void) { object_child_foreach(qdev_get_machine(), pc_dimm_built_list, &list); ... }
Thanks will attempt this in my next version.
Regards,
Bharata.
RFC PATCH 2/2 spapr: Support ibm, dynamic-memory-v2 property
In reply to Bharata B RaoThe new property ibm,dynamic-memory-v2 allows memory to be represented in a more compact manner in device tree.
--- docs/specs/ppc-spapr-hotplug.txt | 19 +++ hw/ppc/spapr.c | 254 +++++++++++++++++++++++++++++++++------ include/hw/ppc/spapr.h | 1 + include/hw/ppc/spapr_ovec.h | 1 + 4 files changed, 235 insertions(+), 40 deletions(-)
docs/specs/ppc-spapr-hotplug.txt +19 -0
@@ -387,4 +387,23 @@ Each LMB list entry consists of the following elements: - A 32bit flags word. The bit at bit position 0x00000008 defines whether the LMB is assigned to the the partition as of boot time. +ibm,dynamic-memory-v2 + +This property describes the dynamically reconfigurable memory. This is +an alternate and newer way to describe dyanamically reconfigurable memory. +It is a property encoded array that has an integer N (the number of +LMB set entries) followed by N LMB set entries. There is an LMB set entry +for each sequential group of LMBs that share common attributes. + +Each LMB set entry consists of the following elements: + +- Number of sequential LMBs in the entry represented by a 32bit integer. +- Logical address of the first LMB in the set encoded as a 64bit integer. +- DRC index of the first LMB in the set. +- Associativity list index that is used as an index into + ibm,associativity-lookup-arrays property described earlier. This + is used to retrieve the right associativity list to be used for all + the LMBs in this set. +- A 32bit flags word that applies to all the LMBs in the set. + [1] http://thread.gmane.org/gmane.linux.ports.ppc.embedded/75350/focus=106867
hw/ppc/spapr.c +214 -40
315 lines not on this page · raw message
include/hw/ppc/spapr.h +1 -0
@@ -147,6 +147,7 @@ struct sPAPRMachineState {sPAPROptionVector *ov5;/* QEMU-supported option vectors */ sPAPROptionVector *ov5_cas;/* negotiated (via CAS) option vectors */ uint32_t max_compat_pvr; +bool use_ibm_dynamic_memory_v2;/* Migration state */ int htab_save_index;
include/hw/ppc/spapr_ovec.h +1 -0
@@ -51,6 +51,7 @@ typedef struct sPAPROptionVector sPAPROptionVector;#define OV5_FORM1_AFFINITY OV_BIT(5, 0)#define OV5_HP_EVT OV_BIT(6, 5)#define OV5_HPT_RESIZE OV_BIT(6, 7) +#define OV5_DRMEM_V2 OV_BIT(22, 1)#define OV5_XIVE_BOTH OV_BIT(23, 0)#define OV5_XIVE_EXPLOIT OV_BIT(23, 1)/* 1=exploitation 0=legacy */
Signature · 1 line
2.7.4