Skip to contentSkip to conversation

hw/acpi-build: build SRAT memory affinity structures for DIMM devices

PATCH Superseded Haozhong Zhang 3 participants 14 messages Mar 5, 2018 – Mar 7, 2018

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover hw/acpi-build: build SRAT memory affinity structures for DIMM devices

ACPI 6.2A Table 5-129 "SPA Range Structure" requires the proximity domain of a NVDIMM SPA range must match with corresponding entry in SRAT table.

The address ranges of vNVDIMM in QEMU are allocated from the hot-pluggable address space, which is entirely covered by one SRAT memory affinity structure. However, users can set the vNVDIMM proximity domain in NFIT SPA range structure by the 'node' property of '-device nvdimm' to a value different than the one in the above SRAT memory affinity structure.

In order to solve such proximity domain mismatch, this patch builds one SRAT memory affinity structure for each DIMM device present at boot time, including both PC-DIMM and NVDIMM, with the proximity domain specified in '-device pc-dimm' or '-device nvdimm'.

The remaining hot-pluggable address space is covered by one or multiple SRAT memory affinity structures with the proximity domain of the last node as before.

Changes in v3:
* (Patch 1&2) Use qmp_pc_dimm_device_list to get information of DIMM devices and move it to separate patches.
* (Patch 3) Replace while loop by a more readable for loop.
* (Patch 3) Refactor the flag setting code.
* (Patch 3) s/'static-plugged'/'present at boot time' in commit message.

Changes in v2:
* Build SRAT memory affinity structures of PC-DIMM devices as well.
* Add test cases.

Haozhong Zhang (5):
pc-dimm: refactor qmp_pc_dimm_device_list
qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList hw/acpi-build: build SRAT memory affinity structures for DIMM devices tests/bios-tables-test: allow setting extra machine options tests/bios-tables-test: add test cases for DIMM proximity

 hmp.c                                 |  14 +++--
 hw/i386/acpi-build.c                  |  60 +++++++++++++++++++--
 hw/mem/pc-dimm.c                      |  99 ++++++++++++++++++++--------------
 hw/ppc/spapr.c                        |   3 +-
 include/hw/mem/pc-dimm.h              |   2 +-
 numa.c                                |  23 ++++----
 qapi-schema.json                      |  18 ++++++-
 qmp.c                                 |   7 +--
 stubs/qmp_pc_dimm.c                   |   4 +-
 tests/acpi-test-data/pc/APIC.dimmpxm  | Bin 0 -> 136 bytes
 tests/acpi-test-data/pc/DSDT.dimmpxm  | Bin 0 -> 6710 bytes
 tests/acpi-test-data/pc/NFIT.dimmpxm  | Bin 0 -> 224 bytes
 tests/acpi-test-data/pc/SRAT.dimmpxm  | Bin 0 -> 416 bytes
 tests/acpi-test-data/pc/SSDT.dimmpxm  | Bin 0 -> 685 bytes
 tests/acpi-test-data/q35/APIC.dimmpxm | Bin 0 -> 136 bytes
 tests/acpi-test-data/q35/DSDT.dimmpxm | Bin 0 -> 9394 bytes
 tests/acpi-test-data/q35/NFIT.dimmpxm | Bin 0 -> 224 bytes
 tests/acpi-test-data/q35/SRAT.dimmpxm | Bin 0 -> 416 bytes
 tests/acpi-test-data/q35/SSDT.dimmpxm | Bin 0 -> 685 bytes
 tests/bios-tables-test.c              |  78 +++++++++++++++++++++------
 20 files changed, 225 insertions(+), 83 deletions(-)
 create mode 100644 tests/acpi-test-data/pc/APIC.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/DSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/NFIT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/SRAT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/SSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/APIC.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/DSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/NFIT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/SRAT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/SSDT.dimmpxm
Signature · 1 line
2.14.1
#1 lore raw

PATCH v3 1/5 pc-dimm: refactor qmp_pc_dimm_device_list

Use pc_dimm_built_list to hide recursive callbacks from callers.

---
 hw/mem/pc-dimm.c         | 83 +++++++++++++++++++++++++-----------------------
 hw/ppc/spapr.c           |  3 +-
 include/hw/mem/pc-dimm.h |  2 +-
 numa.c                   |  4 +--
 qmp.c                    |  7 +---
 stubs/qmp_pc_dimm.c      |  4 +--
 6 files changed, 50 insertions(+), 53 deletions(-)
hw/mem/pc-dimm.c +44 -39
index 6e74b61cb6..4d050fe2cd 100644
@@ -162,45 +162,6 @@ uint64_t get_plugged_memory_size(void)
     return pc_existing_dimms_capacity(&error_abort);
 }
 
-int qmp_pc_dimm_device_list(Object *obj, void *opaque)
-{
-    MemoryDeviceInfoList ***prev = opaque;
-
-    if (object_dynamic_cast(obj, TYPE_PC_DIMM)) {
-        DeviceState *dev = DEVICE(obj);
-
-        if (dev->realized) {
-            MemoryDeviceInfoList *elem = g_new0(MemoryDeviceInfoList, 1);
-            MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1);
-            PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1);
-            DeviceClass *dc = DEVICE_GET_CLASS(obj);
-            PCDIMMDevice *dimm = PC_DIMM(obj);
-
-            if (dev->id) {
-                di->has_id = true;
-                di->id = g_strdup(dev->id);
-            }
-            di->hotplugged = dev->hotplugged;
-            di->hotpluggable = dc->hotpluggable;
-            di->addr = dimm->addr;
-            di->slot = dimm->slot;
-            di->node = dimm->node;
-            di->size = object_property_get_uint(OBJECT(dimm), PC_DIMM_SIZE_PROP,
-                                                NULL);
-            di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));
-
-            info->u.dimm.data = di;
-            elem->value = info;
-            elem->next = NULL;
-            **prev = elem;
-            *prev = &elem->next;
-        }
-    }
-
-    object_child_foreach(obj, qmp_pc_dimm_device_list, opaque);
-    return 0;
-}
-
 static int pc_dimm_slot2bitmap(Object *obj, void *opaque)
 {
     unsigned long *bitmap = opaque;
@@ -276,6 +237,50 @@ static int pc_dimm_built_list(Object *obj, void *opaque)
     return 0;
 }
 
+MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
+{
+    GSList *dimms = NULL, *item;
+    MemoryDeviceInfoList *list = NULL, *prev = NULL;
+
+    object_child_foreach(qdev_get_machine(), pc_dimm_built_list, &dimms);
+
+    for (item = dimms; item; item = g_slist_next(item)) {
+        PCDIMMDevice *dimm = PC_DIMM(item->data);
+        Object *obj = OBJECT(dimm);
+        MemoryDeviceInfoList *elem = g_new0(MemoryDeviceInfoList, 1);
+        MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1);
+        PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1);
+        DeviceClass *dc = DEVICE_GET_CLASS(obj);
+        DeviceState *dev = DEVICE(obj);
+
+        if (dev->id) {
+            di->has_id = true;
+            di->id = g_strdup(dev->id);
+        }
+        di->hotplugged = dev->hotplugged;
+        di->hotpluggable = dc->hotpluggable;
+        di->addr = dimm->addr;
+        di->slot = dimm->slot;
+        di->node = dimm->node;
+        di->size = object_property_get_uint(obj, PC_DIMM_SIZE_PROP, NULL);
+        di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));
+
+        info->u.dimm.data = di;
+        elem->value = info;
+        elem->next = NULL;
+        if (prev) {
+            prev->next = elem;
+        } else {
+            list = elem;
+        }
+        prev = elem;
+    }
+
+    g_slist_free(dimms);
+
+    return list;
+}
+
 uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
                                uint64_t address_space_size,
                                uint64_t *hint, uint64_t align, uint64_t size,
hw/ppc/spapr.c +1 -2
index 83c9d66dd5..68a81e47d2 100644
@@ -731,8 +731,7 @@ static int spapr_populate_drconf_memory(sPAPRMachineState *spapr, void *fdt)
     }
 
     if (hotplug_lmb_start) {
-        MemoryDeviceInfoList **prev = &dimms;
-        qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
+        dimms = qmp_pc_dimm_device_list();
     }
 
     /* ibm,dynamic-memory */
include/hw/mem/pc-dimm.h +1 -1
index d83b957829..1fc479281c 100644
@@ -93,7 +93,7 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
 
 int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp);
 
-int qmp_pc_dimm_device_list(Object *obj, void *opaque);
+MemoryDeviceInfoList *qmp_pc_dimm_device_list(void);
 uint64_t pc_existing_dimms_capacity(Error **errp);
 uint64_t get_plugged_memory_size(void);
 void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
numa.c +1 -3
index 7e0e789b02..c6734ceb8c 100644
@@ -520,12 +520,10 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
 
 static void numa_stat_memory_devices(NumaNodeMem node_mem[])
 {
-    MemoryDeviceInfoList *info_list = NULL;
-    MemoryDeviceInfoList **prev = &info_list;
+    MemoryDeviceInfoList *info_list = qmp_pc_dimm_device_list();
     MemoryDeviceInfoList *info;
     PCDIMMDeviceInfo     *pcdimm_info;
 
-    qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
     for (info = info_list; info; info = info->next) {
         MemoryDeviceInfo *value = info->value;
 
qmp.c +1 -6
index 793f6f3323..c6ac7b05b4 100644
@@ -680,12 +680,7 @@ void qmp_object_del(const char *id, Error **errp)
 
 MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
 {
-    MemoryDeviceInfoList *head = NULL;
-    MemoryDeviceInfoList **prev = &head;
-
-    qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
-
-    return head;
+    return qmp_pc_dimm_device_list();
 }
 
 ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **errp)
stubs/qmp_pc_dimm.c +2 -2
index 9ddc4f619a..b6b2cca89e 100644
@@ -2,9 +2,9 @@
 #include "qom/object.h"
 #include "hw/mem/pc-dimm.h"
 
-int qmp_pc_dimm_device_list(Object *obj, void *opaque)
+MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
 {
-   return 0;
+   return NULL;
 }
 
 uint64_t get_plugged_memory_size(void)
Signature · 1 line
2.14.1
Reviewed-by on v3 1/5
#2 lore raw

Re: [Qemu-devel] [PATCH v3 1/5] pc-dimm: refactor qmp_pc_dimm_device_list

On Mon, 5 Mar 2018 14:57:06 +0800
Haozhong Zhang <[email protected]> wrote:

I'd suggest following commit subj/msg:

-----
pc-dimm: make qmp_pc_dimm_device_list() sort devices by address

Make qmp_pc_dimm_device_list() return sorted by start address list of devices so that it could be reused in places that would need sorted list*. Reuse existing pc_dimm_built_list() to get sorted list.

While at it hide recursive callbacks from callers, so that:

   qmp_pc_dimm_device_list(qdev_get_machine(), &list);

could be replaced with simpler:

   list = qmp_pc_dimm_device_list();

* follow up patch will use it in build_srat()
-----

with commit message updated:

Quoted 192 lines

Use pc_dimm_built_list to hide recursive callbacks from callers.

---
 hw/mem/pc-dimm.c         | 83 +++++++++++++++++++++++++-----------------------
 hw/ppc/spapr.c           |  3 +-
 include/hw/mem/pc-dimm.h |  2 +-
 numa.c                   |  4 +--
 qmp.c                    |  7 +---
 stubs/qmp_pc_dimm.c      |  4 +--
 6 files changed, 50 insertions(+), 53 deletions(-)
hw/mem/pc-dimm.c +44 -39
index 6e74b61cb6..4d050fe2cd 100644
@@ -162,45 +162,6 @@ uint64_t get_plugged_memory_size(void)
     return pc_existing_dimms_capacity(&error_abort);
 }
 
-int qmp_pc_dimm_device_list(Object *obj, void *opaque)
-{
-    MemoryDeviceInfoList ***prev = opaque;
-
-    if (object_dynamic_cast(obj, TYPE_PC_DIMM)) {
-        DeviceState *dev = DEVICE(obj);
-
-        if (dev->realized) {
-            MemoryDeviceInfoList *elem = g_new0(MemoryDeviceInfoList, 1);
-            MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1);
-            PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1);
-            DeviceClass *dc = DEVICE_GET_CLASS(obj);
-            PCDIMMDevice *dimm = PC_DIMM(obj);
-
-            if (dev->id) {
-                di->has_id = true;
-                di->id = g_strdup(dev->id);
-            }
-            di->hotplugged = dev->hotplugged;
-            di->hotpluggable = dc->hotpluggable;
-            di->addr = dimm->addr;
-            di->slot = dimm->slot;
-            di->node = dimm->node;
-            di->size = object_property_get_uint(OBJECT(dimm), PC_DIMM_SIZE_PROP,
-                                                NULL);
-            di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));
-
-            info->u.dimm.data = di;
-            elem->value = info;
-            elem->next = NULL;
-            **prev = elem;
-            *prev = &elem->next;
-        }
-    }
-
-    object_child_foreach(obj, qmp_pc_dimm_device_list, opaque);
-    return 0;
-}
-
 static int pc_dimm_slot2bitmap(Object *obj, void *opaque)
 {
     unsigned long *bitmap = opaque;
@@ -276,6 +237,50 @@ static int pc_dimm_built_list(Object *obj, void *opaque)
     return 0;
 }
 
+MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
+{
+    GSList *dimms = NULL, *item;
+    MemoryDeviceInfoList *list = NULL, *prev = NULL;
+
+    object_child_foreach(qdev_get_machine(), pc_dimm_built_list, &dimms);
+
+    for (item = dimms; item; item = g_slist_next(item)) {
+        PCDIMMDevice *dimm = PC_DIMM(item->data);
+        Object *obj = OBJECT(dimm);
+        MemoryDeviceInfoList *elem = g_new0(MemoryDeviceInfoList, 1);
+        MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1);
+        PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1);
+        DeviceClass *dc = DEVICE_GET_CLASS(obj);
+        DeviceState *dev = DEVICE(obj);
+
+        if (dev->id) {
+            di->has_id = true;
+            di->id = g_strdup(dev->id);
+        }
+        di->hotplugged = dev->hotplugged;
+        di->hotpluggable = dc->hotpluggable;
+        di->addr = dimm->addr;
+        di->slot = dimm->slot;
+        di->node = dimm->node;
+        di->size = object_property_get_uint(obj, PC_DIMM_SIZE_PROP, NULL);
+        di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));
+
+        info->u.dimm.data = di;
+        elem->value = info;
+        elem->next = NULL;
+        if (prev) {
+            prev->next = elem;
+        } else {
+            list = elem;
+        }
+        prev = elem;
+    }
+
+    g_slist_free(dimms);
+
+    return list;
+}
+
 uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
                                uint64_t address_space_size,
                                uint64_t *hint, uint64_t align, uint64_t size,
hw/ppc/spapr.c +1 -2
index 83c9d66dd5..68a81e47d2 100644
@@ -731,8 +731,7 @@ static int spapr_populate_drconf_memory(sPAPRMachineState *spapr, void *fdt)
     }
 
     if (hotplug_lmb_start) {
-        MemoryDeviceInfoList **prev = &dimms;
-        qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
+        dimms = qmp_pc_dimm_device_list();
     }
 
     /* ibm,dynamic-memory */
include/hw/mem/pc-dimm.h +1 -1
index d83b957829..1fc479281c 100644
@@ -93,7 +93,7 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
 
 int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp);
 
-int qmp_pc_dimm_device_list(Object *obj, void *opaque);
+MemoryDeviceInfoList *qmp_pc_dimm_device_list(void);
 uint64_t pc_existing_dimms_capacity(Error **errp);
 uint64_t get_plugged_memory_size(void);
 void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
numa.c +1 -3
index 7e0e789b02..c6734ceb8c 100644
@@ -520,12 +520,10 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
 
 static void numa_stat_memory_devices(NumaNodeMem node_mem[])
 {
-    MemoryDeviceInfoList *info_list = NULL;
-    MemoryDeviceInfoList **prev = &info_list;
+    MemoryDeviceInfoList *info_list = qmp_pc_dimm_device_list();
     MemoryDeviceInfoList *info;
     PCDIMMDeviceInfo     *pcdimm_info;
 
-    qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
     for (info = info_list; info; info = info->next) {
         MemoryDeviceInfo *value = info->value;
 
qmp.c +1 -6
index 793f6f3323..c6ac7b05b4 100644
@@ -680,12 +680,7 @@ void qmp_object_del(const char *id, Error **errp)
 
 MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
 {
-    MemoryDeviceInfoList *head = NULL;
-    MemoryDeviceInfoList **prev = &head;
-
-    qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
-
-    return head;
+    return qmp_pc_dimm_device_list();
 }
 
 ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **errp)
stubs/qmp_pc_dimm.c +2 -2
index 9ddc4f619a..b6b2cca89e 100644
@@ -2,9 +2,9 @@
 #include "qom/object.h"
 #include "hw/mem/pc-dimm.h"
 
-int qmp_pc_dimm_device_list(Object *obj, void *opaque)
+MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
 {
-   return 0;
+   return NULL;
 }
 
 uint64_t get_plugged_memory_size(void)
#3 lore raw

PATCH v3 2/5 qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

In reply to Haozhong Zhang

It may need to treat PC-DIMM and NVDIMM differently, e.g., when deciding the necessity of non-volatile flag bit in SRAT memory affinity structures.

NVDIMMDeviceInfo, which inherits from PCDIMMDeviceInfo, is added to union type MemoryDeviceInfo to record information of NVDIMM devices. The NVDIMM-specific data is currently left empty and will be filled when necessary in the future.

---
 hmp.c            | 14 +++++++++++---
 hw/mem/pc-dimm.c | 20 ++++++++++++++++++--
 numa.c           | 19 +++++++++++++------
 qapi-schema.json | 18 +++++++++++++++++-
 4 files changed, 59 insertions(+), 12 deletions(-)
hmp.c +11 -3
index ae86bfbade..3f06407c5e 100644
@@ -2413,7 +2413,18 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
             switch (value->type) {
             case MEMORY_DEVICE_INFO_KIND_DIMM:
                 di = value->u.dimm.data;
+                break;
+
+            case MEMORY_DEVICE_INFO_KIND_NVDIMM:
+                di = qapi_NVDIMMDeviceInfo_base(value->u.nvdimm.data);
+                break;
+
+            default:
+                di = NULL;
+                break;
+            }
 
+            if (di) {
                 monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
                                MemoryDeviceInfoKind_str(value->type),
                                di->id ? di->id : "");
@@ -2426,9 +2437,6 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
                                di->hotplugged ? "true" : "false");
                 monitor_printf(mon, "  hotpluggable: %s\n",
                                di->hotpluggable ? "true" : "false");
-                break;
-            default:
-                break;
             }
         }
     }
hw/mem/pc-dimm.c +18 -2
index 4d050fe2cd..866ecc699a 100644
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
 #include "qapi/error.h"
 #include "qemu/config-file.h"
 #include "qapi/visitor.h"
@@ -249,10 +250,19 @@ MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
         Object *obj = OBJECT(dimm);
         MemoryDeviceInfoList *elem = g_new0(MemoryDeviceInfoList, 1);
         MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1);
-        PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1);
+        PCDIMMDeviceInfo *di;
+        NVDIMMDeviceInfo *ndi;
+        bool is_nvdimm = object_dynamic_cast(obj, TYPE_NVDIMM);
         DeviceClass *dc = DEVICE_GET_CLASS(obj);
         DeviceState *dev = DEVICE(obj);
 
+        if (!is_nvdimm) {
+            di = g_new0(PCDIMMDeviceInfo, 1);
+        } else {
+            ndi = g_new0(NVDIMMDeviceInfo, 1);
+            di = qapi_NVDIMMDeviceInfo_base(ndi);
+        }
+
         if (dev->id) {
             di->has_id = true;
             di->id = g_strdup(dev->id);
@@ -265,7 +275,13 @@ MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
         di->size = object_property_get_uint(obj, PC_DIMM_SIZE_PROP, NULL);
         di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));
 
-        info->u.dimm.data = di;
+        if (!is_nvdimm) {
+            info->u.dimm.data = di;
+            info->type = MEMORY_DEVICE_INFO_KIND_DIMM;
+        } else {
+            info->u.nvdimm.data = ndi;
+            info->type = MEMORY_DEVICE_INFO_KIND_NVDIMM;
+        }
         elem->value = info;
         elem->next = NULL;
         if (prev) {
numa.c +13 -6
index c6734ceb8c..23c4371e51 100644
@@ -529,18 +529,25 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[])
 
         if (value) {
             switch (value->type) {
-            case MEMORY_DEVICE_INFO_KIND_DIMM: {
+            case MEMORY_DEVICE_INFO_KIND_DIMM:
                 pcdimm_info = value->u.dimm.data;
+                break;
+
+            case MEMORY_DEVICE_INFO_KIND_NVDIMM:
+                pcdimm_info = qapi_NVDIMMDeviceInfo_base(value->u.nvdimm.data);
+                break;
+
+            default:
+                pcdimm_info = NULL;
+                break;
+            }
+
+            if (pcdimm_info) {
                 node_mem[pcdimm_info->node].node_mem += pcdimm_info->size;
                 if (pcdimm_info->hotpluggable && pcdimm_info->hotplugged) {
                     node_mem[pcdimm_info->node].node_plugged_mem +=
                         pcdimm_info->size;
                 }
-                break;
-            }
-
-            default:
-                break;
             }
         }
     }
qapi-schema.json +17 -1
index cd98a94388..1c2d281749 100644
@@ -2920,6 +2920,18 @@
           }
 }
 
+##
+# @NVDIMMDeviceInfo:
+#
+# NVDIMMDevice state information
+#
+# Since: 2.12
+##
+{ 'struct': 'NVDIMMDeviceInfo',
+  'base': 'PCDIMMDeviceInfo',
+  'data': {}
+}
+
 ##
 # @MemoryDeviceInfo:
 #
@@ -2927,7 +2939,11 @@
 #
 # Since: 2.1
 ##
-{ 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} }
+{ 'union': 'MemoryDeviceInfo',
+  'data': { 'dimm': 'PCDIMMDeviceInfo',
+            'nvdimm': 'NVDIMMDeviceInfo'
+          }
+}
 
 ##
 # @query-memory-devices:
Signature · 1 line
2.14.1
#4 lore raw

Re: [Qemu-devel] [PATCH v3 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

Quoted 9 lines · Haozhong Zhang

It may need to treat PC-DIMM and NVDIMM differently, e.g., when deciding the necessity of non-volatile flag bit in SRAT memory affinity structures.

NVDIMMDeviceInfo, which inherits from PCDIMMDeviceInfo, is added to union type MemoryDeviceInfo to record information of NVDIMM devices. The NVDIMM-specific data is currently left empty and will be filled when necessary in the future.

Quoted 6 lines
---
  hmp.c            | 14 +++++++++++---
  hw/mem/pc-dimm.c | 20 ++++++++++++++++++--
  numa.c           | 19 +++++++++++++------
  qapi-schema.json | 18 +++++++++++++++++-

Will need rebasing now that the contents live in qapi/misc.json.

Quoted 6 lines

+++ b/qapi-schema.json

qapi-schema.json +1 -0
@@ -2920,6 +2920,18 @@
            }
  }
 
+##

qapi-schema.json line 2933

Quoted 10 lines
qapi-schema.json +10 -0
+# @NVDIMMDeviceInfo:
+#
+# NVDIMMDevice state information
+#
+# Since: 2.12
+##
+{ 'struct': 'NVDIMMDeviceInfo',
+  'base': 'PCDIMMDeviceInfo',
+  'data': {}
+}

You added no data, so why did you need the type?

qapi-schema.json line 2944

Quoted 12 lines
qapi-schema.json +4 -1
+
  ##
  # @MemoryDeviceInfo:
  #
@@ -2927,7 +2939,11 @@
  #
  # Since: 2.1
  ##
-{ 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} }
+{ 'union': 'MemoryDeviceInfo',
+  'data': { 'dimm': 'PCDIMMDeviceInfo',
+            'nvdimm': 'NVDIMMDeviceInfo'

Names aren't part of the interface; would it be better to rename PCDIMMDeviceInfo into something that can be generically shared between both the 'dimm' and 'nvdimm' branches without having to create a pointless subtype?

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#5 lore raw

Re: [Qemu-devel] [PATCH v3 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

Quoted 10 lines · Eric Blake
Quoted 9 lines · Haozhong Zhang

It may need to treat PC-DIMM and NVDIMM differently, e.g., when deciding the necessity of non-volatile flag bit in SRAT memory affinity structures.

NVDIMMDeviceInfo, which inherits from PCDIMMDeviceInfo, is added to union type MemoryDeviceInfo to record information of NVDIMM devices. The NVDIMM-specific data is currently left empty and will be filled when necessary in the future.

Quoted 8 lines
Quoted 6 lines
---
  hmp.c            | 14 +++++++++++---
  hw/mem/pc-dimm.c | 20 ++++++++++++++++++--
  numa.c           | 19 +++++++++++++------
  qapi-schema.json | 18 +++++++++++++++++-

Will need rebasing now that the contents live in qapi/misc.json.

will do

Quoted 28 lines
Quoted 6 lines

+++ b/qapi-schema.json

qapi-schema.json +1 -0
@@ -2920,6 +2920,18 @@
            }
  }
+##

qapi-schema.json line 2932

Quoted 10 lines
qapi-schema.json +10 -0
+# @NVDIMMDeviceInfo:
+#
+# NVDIMMDevice state information
+#
+# Since: 2.12
+##
+{ 'struct': 'NVDIMMDeviceInfo',
+  'base': 'PCDIMMDeviceInfo',
+  'data': {}
+}

You added no data, so why did you need the type?

Quoted 9 lines
qapi-schema.json +1 -1
+
  ##
  # @MemoryDeviceInfo:
  #
@@ -2927,7 +2939,11 @@
  #
  # Since: 2.1
  ##
-{ 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} }
Quoted 9 lines

qapi-schema.json line 2944

Quoted 3 lines
qapi-schema.json +3 -0
+{ 'union': 'MemoryDeviceInfo',
+  'data': { 'dimm': 'PCDIMMDeviceInfo',
+            'nvdimm': 'NVDIMMDeviceInfo'

Names aren't part of the interface; would it be better to rename PCDIMMDeviceInfo into something that can be generically shared between both the 'dimm' and 'nvdimm' branches without having to create a pointless subtype?

The purpose of this NVDIMMDeviceInfo is to introduce MEMORY_DEVICE_INFO_KIND_NVDIMM, which can be used to distinguish NVDIMM from PC-DIMM in the list returned from query-memory-device.

If 'data' of NVDIMMDeviceInfo is filled with NVDIMM-specific information (there does have some), would it make this type less pointless?

Thanks,
Haozhong

#6 lore raw

Re: [Qemu-devel] [PATCH v3 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

In reply to Eric Blake
Quoted 47 lines · On Mon, 5 Mar 2018 13:14:34 -0600 Eric Blake <[email protected]> wrote:
Quoted 9 lines · Haozhong Zhang

It may need to treat PC-DIMM and NVDIMM differently, e.g., when deciding the necessity of non-volatile flag bit in SRAT memory affinity structures.

NVDIMMDeviceInfo, which inherits from PCDIMMDeviceInfo, is added to union type MemoryDeviceInfo to record information of NVDIMM devices. The NVDIMM-specific data is currently left empty and will be filled when necessary in the future.

Quoted 6 lines
---
  hmp.c            | 14 +++++++++++---
  hw/mem/pc-dimm.c | 20 ++++++++++++++++++--
  numa.c           | 19 +++++++++++++------
  qapi-schema.json | 18 +++++++++++++++++-  

Will need rebasing now that the contents live in qapi/misc.json.

Quoted 6 lines

+++ b/qapi-schema.json

qapi-schema.json +1 -0
@@ -2920,6 +2920,18 @@
            }
  }
 
+##

qapi-schema.json line 2933

Quoted 10 lines
qapi-schema.json +10 -0
+# @NVDIMMDeviceInfo:
+#
+# NVDIMMDevice state information
+#
+# Since: 2.12
+##
+{ 'struct': 'NVDIMMDeviceInfo',
+  'base': 'PCDIMMDeviceInfo',
+  'data': {}
+}  

You added no data, so why did you need the type?

Quoted 9 lines
qapi-schema.json +1 -1
+
  ##
  # @MemoryDeviceInfo:
  #
@@ -2927,7 +2939,11 @@
  #
  # Since: 2.1
  ##
-{ 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} }
Quoted 8 lines

qapi-schema.json line 2944

Quoted 3 lines
qapi-schema.json +3 -0
+{ 'union': 'MemoryDeviceInfo',
+  'data': { 'dimm': 'PCDIMMDeviceInfo',
+            'nvdimm': 'NVDIMMDeviceInfo'  

Names aren't part of the interface; would it be better to rename PCDIMMDeviceInfo into something that can be generically shared between both the 'dimm' and 'nvdimm' branches without having to create a pointless subtype?

Currently we are lying on query-memory-devices and reporting nvdimm devices as pcdimm (I haven't noticed it when nvdimms were introduced), this patch fixes it so it will be clear what type of device is used where.

Later we can extend data{} section with nvdimm specific info as needed.

The second goal of this patch (well, the actual reason I've asked for it), is to reuse qmp_pc_dimm_device_list() internally in QEMU to get list of dimm based memory devices, instead of creating yet another API to do that for internal usage.

#7 lore raw

Re: [Qemu-devel] [PATCH v3 2/5] qmp: distinguish PC-DIMM and NVDIMM in MemoryDeviceInfoList

In reply to Haozhong Zhang
Quoted 8 lines · On Mon, 5 Mar 2018 14:57:07 +0800 Haozhong Zhang <[email protected]>…

It may need to treat PC-DIMM and NVDIMM differently, e.g., when deciding the necessity of non-volatile flag bit in SRAT memory affinity structures.

NVDIMMDeviceInfo, which inherits from PCDIMMDeviceInfo, is added to union type MemoryDeviceInfo to record information of NVDIMM devices. The NVDIMM-specific data is currently left empty and will be filled when necessary in the future.

Maybe add to commit message that:

It also fixes "info memory-devices"/query-memory-devices which currently show nvdimm devices as dimm devices since object_dynamic_cast(obj, TYPE_PC_DIMM) happily cast nvdimm to TYPE_PC_DIMM which it's been inherited from.

Otherwise patch looks good,
I'll ack it after rebase with is necessary for this patch.

Quoted 161 lines
---
 hmp.c            | 14 +++++++++++---
 hw/mem/pc-dimm.c | 20 ++++++++++++++++++--
 numa.c           | 19 +++++++++++++------
 qapi-schema.json | 18 +++++++++++++++++-
 4 files changed, 59 insertions(+), 12 deletions(-)
hmp.c +11 -3
index ae86bfbade..3f06407c5e 100644
@@ -2413,7 +2413,18 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
             switch (value->type) {
             case MEMORY_DEVICE_INFO_KIND_DIMM:
                 di = value->u.dimm.data;
+                break;
+
+            case MEMORY_DEVICE_INFO_KIND_NVDIMM:
+                di = qapi_NVDIMMDeviceInfo_base(value->u.nvdimm.data);
+                break;
+
+            default:
+                di = NULL;
+                break;
+            }
 
+            if (di) {
                 monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
                                MemoryDeviceInfoKind_str(value->type),
                                di->id ? di->id : "");
@@ -2426,9 +2437,6 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
                                di->hotplugged ? "true" : "false");
                 monitor_printf(mon, "  hotpluggable: %s\n",
                                di->hotpluggable ? "true" : "false");
-                break;
-            default:
-                break;
             }
         }
     }
hw/mem/pc-dimm.c +18 -2
index 4d050fe2cd..866ecc699a 100644
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
 #include "qapi/error.h"
 #include "qemu/config-file.h"
 #include "qapi/visitor.h"
@@ -249,10 +250,19 @@ MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
         Object *obj = OBJECT(dimm);
         MemoryDeviceInfoList *elem = g_new0(MemoryDeviceInfoList, 1);
         MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1);
-        PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1);
+        PCDIMMDeviceInfo *di;
+        NVDIMMDeviceInfo *ndi;
+        bool is_nvdimm = object_dynamic_cast(obj, TYPE_NVDIMM);
         DeviceClass *dc = DEVICE_GET_CLASS(obj);
         DeviceState *dev = DEVICE(obj);
 
+        if (!is_nvdimm) {
+            di = g_new0(PCDIMMDeviceInfo, 1);
+        } else {
+            ndi = g_new0(NVDIMMDeviceInfo, 1);
+            di = qapi_NVDIMMDeviceInfo_base(ndi);
+        }
+
         if (dev->id) {
             di->has_id = true;
             di->id = g_strdup(dev->id);
@@ -265,7 +275,13 @@ MemoryDeviceInfoList *qmp_pc_dimm_device_list(void)
         di->size = object_property_get_uint(obj, PC_DIMM_SIZE_PROP, NULL);
         di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));
 
-        info->u.dimm.data = di;
+        if (!is_nvdimm) {
+            info->u.dimm.data = di;
+            info->type = MEMORY_DEVICE_INFO_KIND_DIMM;
+        } else {
+            info->u.nvdimm.data = ndi;
+            info->type = MEMORY_DEVICE_INFO_KIND_NVDIMM;
+        }
         elem->value = info;
         elem->next = NULL;
         if (prev) {
numa.c +13 -6
index c6734ceb8c..23c4371e51 100644
@@ -529,18 +529,25 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[])
 
         if (value) {
             switch (value->type) {
-            case MEMORY_DEVICE_INFO_KIND_DIMM: {
+            case MEMORY_DEVICE_INFO_KIND_DIMM:
                 pcdimm_info = value->u.dimm.data;
+                break;
+
+            case MEMORY_DEVICE_INFO_KIND_NVDIMM:
+                pcdimm_info = qapi_NVDIMMDeviceInfo_base(value->u.nvdimm.data);
+                break;
+
+            default:
+                pcdimm_info = NULL;
+                break;
+            }
+
+            if (pcdimm_info) {
                 node_mem[pcdimm_info->node].node_mem += pcdimm_info->size;
                 if (pcdimm_info->hotpluggable && pcdimm_info->hotplugged) {
                     node_mem[pcdimm_info->node].node_plugged_mem +=
                         pcdimm_info->size;
                 }
-                break;
-            }
-
-            default:
-                break;
             }
         }
     }
qapi-schema.json +17 -1
index cd98a94388..1c2d281749 100644
@@ -2920,6 +2920,18 @@
           }
 }
 
+##
+# @NVDIMMDeviceInfo:
+#
+# NVDIMMDevice state information
+#
+# Since: 2.12
+##
+{ 'struct': 'NVDIMMDeviceInfo',
+  'base': 'PCDIMMDeviceInfo',
+  'data': {}
+}
+
 ##
 # @MemoryDeviceInfo:
 #
@@ -2927,7 +2939,11 @@
 #
 # Since: 2.1
 ##
-{ 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} }
+{ 'union': 'MemoryDeviceInfo',
+  'data': { 'dimm': 'PCDIMMDeviceInfo',
+            'nvdimm': 'NVDIMMDeviceInfo'
+          }
+}
 
 ##
 # @query-memory-devices:
#8 lore raw

PATCH v3 3/5 hw/acpi-build: build SRAT memory affinity structures for DIMM devices

In reply to Haozhong Zhang

ACPI 6.2A Table 5-129 "SPA Range Structure" requires the proximity domain of a NVDIMM SPA range must match with corresponding entry in SRAT table.

The address ranges of vNVDIMM in QEMU are allocated from the hot-pluggable address space, which is entirely covered by one SRAT memory affinity structure. However, users can set the vNVDIMM proximity domain in NFIT SPA range structure by the 'node' property of '-device nvdimm' to a value different than the one in the above SRAT memory affinity structure.

In order to solve such proximity domain mismatch, this patch builds one SRAT memory affinity structure for each DIMM device present at boot time, including both PC-DIMM and NVDIMM, with the proximity domain specified in '-device pc-dimm' or '-device nvdimm'.

The remaining hot-pluggable address space is covered by one or multiple SRAT memory affinity structures with the proximity domain of the last node as before.

---
 hw/i386/acpi-build.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 56 insertions(+), 4 deletions(-)
hw/i386/acpi-build.c +56 -4
index deb440f286..2ca0317386 100644
@@ -2323,6 +2323,59 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
 #define HOLE_640K_START  (640 * 1024)
 #define HOLE_640K_END   (1024 * 1024)
 
+static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
+                                           uint64_t len, int default_node)
+{
+    MemoryDeviceInfoList *info_list = qmp_pc_dimm_device_list();
+    MemoryDeviceInfoList *info;
+    MemoryDeviceInfo *mi;
+    PCDIMMDeviceInfo *di;
+    uint64_t end = base + len, cur, addr, size;
+    int node;
+    bool is_nvdimm;
+    AcpiSratMemoryAffinity *numamem;
+    MemoryAffinityFlags flags;
+
+    for (cur = base, info = info_list;
+         cur < end;
+         cur += size, info = info->next) {
+        numamem = acpi_data_push(table_data, sizeof *numamem);
+
+        if (!info) {
+            build_srat_memory(numamem, cur, end - cur, default_node,
+                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
+            break;
+        }
+
+        mi = info->value;
+        is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
+        di = !is_nvdimm ? mi->u.dimm.data :
+                          qapi_NVDIMMDeviceInfo_base(mi->u.nvdimm.data);
+
+        addr = di->addr;
+        if (cur < addr) {
+            build_srat_memory(numamem, cur, addr - cur, default_node,
+                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
+            numamem = acpi_data_push(table_data, sizeof *numamem);
+        }
+
+        size = di->size;
+        node = di->node;
+
+        flags = MEM_AFFINITY_ENABLED;
+        if (di->hotpluggable) {
+            flags |= MEM_AFFINITY_HOTPLUGGABLE;
+        }
+        if (is_nvdimm) {
+            flags |= MEM_AFFINITY_NON_VOLATILE;
+        }
+
+        build_srat_memory(numamem, addr, size, node, flags);
+    }
+
+    qapi_free_MemoryDeviceInfoList(info_list);
+}
+
 static void
 build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
 {
@@ -2434,10 +2487,9 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
      * providing _PXM method if necessary.
      */
     if (hotplugabble_address_space_size) {
-        numamem = acpi_data_push(table_data, sizeof *numamem);
-        build_srat_memory(numamem, pcms->hotplug_memory.base,
-                          hotplugabble_address_space_size, pcms->numa_nodes - 1,
-                          MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
+        build_srat_hotpluggable_memory(table_data, pcms->hotplug_memory.base,
+                                       hotplugabble_address_space_size,
+                                       pcms->numa_nodes - 1);
     }
 
     build_header(linker, table_data,
Signature · 1 line
2.14.1
#9 lore raw
Quoted 53 lines · On Mon, 5 Mar 2018 14:57:08 +0800 Haozhong Zhang <[email protected]>…

ACPI 6.2A Table 5-129 "SPA Range Structure" requires the proximity domain of a NVDIMM SPA range must match with corresponding entry in SRAT table.

The address ranges of vNVDIMM in QEMU are allocated from the hot-pluggable address space, which is entirely covered by one SRAT memory affinity structure. However, users can set the vNVDIMM proximity domain in NFIT SPA range structure by the 'node' property of '-device nvdimm' to a value different than the one in the above SRAT memory affinity structure.

In order to solve such proximity domain mismatch, this patch builds one SRAT memory affinity structure for each DIMM device present at boot time, including both PC-DIMM and NVDIMM, with the proximity domain specified in '-device pc-dimm' or '-device nvdimm'.

The remaining hot-pluggable address space is covered by one or multiple SRAT memory affinity structures with the proximity domain of the last node as before.

---
 hw/i386/acpi-build.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 56 insertions(+), 4 deletions(-)
hw/i386/acpi-build.c +20 -0
index deb440f286..2ca0317386 100644
@@ -2323,6 +2323,59 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
 #define HOLE_640K_START  (640 * 1024)
 #define HOLE_640K_END   (1024 * 1024)
 
+static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
+                                           uint64_t len, int default_node)
+{
+    MemoryDeviceInfoList *info_list = qmp_pc_dimm_device_list();
+    MemoryDeviceInfoList *info;
+    MemoryDeviceInfo *mi;
+    PCDIMMDeviceInfo *di;
+    uint64_t end = base + len, cur, addr, size;
+    int node;
+    bool is_nvdimm;
+    AcpiSratMemoryAffinity *numamem;
+    MemoryAffinityFlags flags;
+
+    for (cur = base, info = info_list;
+         cur < end;
+         cur += size, info = info->next) {
+        numamem = acpi_data_push(table_data, sizeof *numamem);
+
+        if (!info) {
+            build_srat_memory(numamem, cur, end - cur, default_node,

hw/i386/acpi-build.c build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) · line 2355

Quoted 10 lines
hw/i386/acpi-build.c +10 -0
+                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
+            break;
+        }
+
+        mi = info->value;
+        is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
+        di = !is_nvdimm ? mi->u.dimm.data :
+                          qapi_NVDIMMDeviceInfo_base(mi->u.nvdimm.data);
+
+        addr = di->addr;

maybe drop addr and use di->addr directly

hw/i386/acpi-build.c build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) · line 2363

Quoted 8 lines
hw/i386/acpi-build.c +8 -0
+        if (cur < addr) {
+            build_srat_memory(numamem, cur, addr - cur, default_node,
+                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
+            numamem = acpi_data_push(table_data, sizeof *numamem);
+        }
+
+        size = di->size;
+        node = di->node;

the same wrt di->node

Quoted 32 lines
hw/i386/acpi-build.c +18 -4
+
+        flags = MEM_AFFINITY_ENABLED;
+        if (di->hotpluggable) {
+            flags |= MEM_AFFINITY_HOTPLUGGABLE;
+        }
+        if (is_nvdimm) {
+            flags |= MEM_AFFINITY_NON_VOLATILE;
+        }
+
+        build_srat_memory(numamem, addr, size, node, flags);
+    }
+
+    qapi_free_MemoryDeviceInfoList(info_list);
+}
+
 static void
 build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
 {
@@ -2434,10 +2487,9 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
      * providing _PXM method if necessary.
      */
     if (hotplugabble_address_space_size) {
-        numamem = acpi_data_push(table_data, sizeof *numamem);
-        build_srat_memory(numamem, pcms->hotplug_memory.base,
-                          hotplugabble_address_space_size, pcms->numa_nodes - 1,
-                          MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
+        build_srat_hotpluggable_memory(table_data, pcms->hotplug_memory.base,
+                                       hotplugabble_address_space_size,
+                                       pcms->numa_nodes - 1);
     }
 
     build_header(linker, table_data,
#10 lore raw

PATCH v3 4/5 tests/bios-tables-test: allow setting extra machine options

In reply to Haozhong Zhang

Some test cases may require extra machine options than those used in the current test_acpi_ones(), e.g., nvdimm test cases require the machine option 'nvdimm=on'.

---
 tests/bios-tables-test.c | 45 +++++++++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 16 deletions(-)
tests/bios-tables-test.c +29 -16
index 65b271a173..d45181aa51 100644
@@ -654,17 +654,22 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *extra_machine_opts,
+                          const char *params, test_data *data)
 {
     char *args;
 
     /* Disable kernel irqchip to be able to override apic irq0. */
-    args = g_strdup_printf("-machine %s,accel=%s,kernel-irqchip=off "
+    args = g_strdup_printf("-machine %s,accel=%s,kernel-irqchip=off",
+                           data->machine, "kvm:tcg");
+    if (extra_machine_opts) {
+        args = g_strdup_printf("%s,%s", args, extra_machine_opts);
+    }
+    args = g_strdup_printf("%s "
                            "-net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
-                           data->machine, "kvm:tcg",
-                           params ? params : "", disk);
+                           args, params ? params : "", disk);
 
     qtest_start(args);
 
@@ -711,7 +716,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one(NULL, &data);
+    test_acpi_one(NULL, NULL, &data);
     free_test_data(&data);
 }
 
@@ -724,7 +729,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one(NULL, "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -736,7 +741,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one(NULL, &data);
+    test_acpi_one(NULL, NULL, &data);
     free_test_data(&data);
 }
 
@@ -749,7 +754,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-device pci-bridge,chassis_nr=1",
+    test_acpi_one(NULL, "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -761,7 +766,8 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6"
+    test_acpi_one(NULL,
+                  "-smp 2,cores=3,sockets=2,maxcpus=6"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -775,7 +781,8 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one(" -smp 2,cores=3,sockets=2,maxcpus=6"
+    test_acpi_one(NULL,
+                  " -smp 2,cores=3,sockets=2,maxcpus=6"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -795,7 +802,8 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one(NULL,
+                  "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -813,7 +821,8 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one(NULL,
+                  "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -826,7 +835,8 @@ static void test_acpi_q35_tcg_memhp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".memhp";
-    test_acpi_one(" -m 128,slots=3,maxmem=1G"
+    test_acpi_one(NULL,
+                  " -m 128,slots=3,maxmem=1G"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -840,7 +850,8 @@ static void test_acpi_piix4_tcg_memhp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".memhp";
-    test_acpi_one(" -m 128,slots=3,maxmem=1G"
+    test_acpi_one(NULL,
+                  " -m 128,slots=3,maxmem=1G"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -854,7 +865,8 @@ static void test_acpi_q35_tcg_numamem(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".numamem";
-    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    test_acpi_one(NULL,
+                  " -numa node -numa node,mem=128", &data);
     free_test_data(&data);
 }
 
@@ -865,7 +877,8 @@ static void test_acpi_piix4_tcg_numamem(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".numamem";
-    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    test_acpi_one(NULL,
+                  " -numa node -numa node,mem=128", &data);
     free_test_data(&data);
 }
 
Signature · 1 line
2.14.1
#11 lore raw

Re: [Qemu-devel] [PATCH v3 4/5] tests/bios-tables-test: allow setting extra machine options

Quoted 21 lines · On Mon, 5 Mar 2018 14:57:09 +0800 Haozhong Zhang <[email protected]>…

Some test cases may require extra machine options than those used in the current test_acpi_ones(), e.g., nvdimm test cases require the machine option 'nvdimm=on'.

---
 tests/bios-tables-test.c | 45 +++++++++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 16 deletions(-)
tests/bios-tables-test.c +2 -1
index 65b271a173..d45181aa51 100644
@@ -654,17 +654,22 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *extra_machine_opts,
+                          const char *params, test_data *data)
 {

tests/bios-tables-test.c static void test_smbios_structs(test_data *data) · line 668

Quoted 10 lines
tests/bios-tables-test.c +6 -1
     char *args;
 
     /* Disable kernel irqchip to be able to override apic irq0. */
-    args = g_strdup_printf("-machine %s,accel=%s,kernel-irqchip=off "
+    args = g_strdup_printf("-machine %s,accel=%s,kernel-irqchip=off",
+                           data->machine, "kvm:tcg");
+    if (extra_machine_opts) {
+        args = g_strdup_printf("%s,%s", args, extra_machine_opts);
+    }
+    args = g_strdup_printf("%s "

wouldn't 2nd and the rest of "args = g_strdup_printf", leak memory?

btw you don't really need this patch, you can just add
"-machine nvdimm=on" to params argument at call site.
it's allowed to have several -FOO options on CLI, since they are merged together and applied to machine object in QEMU.

Quoted 125 lines
tests/bios-tables-test.c +21 -14
                            "-net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
-                           data->machine, "kvm:tcg",
-                           params ? params : "", disk);
+                           args, params ? params : "", disk);
 
     qtest_start(args);
 
@@ -711,7 +716,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one(NULL, &data);
+    test_acpi_one(NULL, NULL, &data);
     free_test_data(&data);
 }
 
@@ -724,7 +729,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one(NULL, "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -736,7 +741,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one(NULL, &data);
+    test_acpi_one(NULL, NULL, &data);
     free_test_data(&data);
 }
 
@@ -749,7 +754,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-device pci-bridge,chassis_nr=1",
+    test_acpi_one(NULL, "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -761,7 +766,8 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6"
+    test_acpi_one(NULL,
+                  "-smp 2,cores=3,sockets=2,maxcpus=6"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -775,7 +781,8 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one(" -smp 2,cores=3,sockets=2,maxcpus=6"
+    test_acpi_one(NULL,
+                  " -smp 2,cores=3,sockets=2,maxcpus=6"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -795,7 +802,8 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one(NULL,
+                  "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -813,7 +821,8 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one(NULL,
+                  "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -826,7 +835,8 @@ static void test_acpi_q35_tcg_memhp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".memhp";
-    test_acpi_one(" -m 128,slots=3,maxmem=1G"
+    test_acpi_one(NULL,
+                  " -m 128,slots=3,maxmem=1G"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -840,7 +850,8 @@ static void test_acpi_piix4_tcg_memhp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".memhp";
-    test_acpi_one(" -m 128,slots=3,maxmem=1G"
+    test_acpi_one(NULL,
+                  " -m 128,slots=3,maxmem=1G"
                   " -numa node -numa node"
                   " -numa dist,src=0,dst=1,val=21",
                   &data);
@@ -854,7 +865,8 @@ static void test_acpi_q35_tcg_numamem(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".numamem";
-    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    test_acpi_one(NULL,
+                  " -numa node -numa node,mem=128", &data);
     free_test_data(&data);
 }
 
@@ -865,7 +877,8 @@ static void test_acpi_piix4_tcg_numamem(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".numamem";
-    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    test_acpi_one(NULL,
+                  " -numa node -numa node,mem=128", &data);
     free_test_data(&data);
 }
 
#12 lore raw

PATCH v3 5/5 tests/bios-tables-test: add test cases for DIMM proximity

In reply to Haozhong Zhang

QEMU now builds one SRAT memory affinity structure for each static-plugged PC-DIMM and NVDIMM device with the proximity domain specified in the device option 'node', rather than only one SRAT memory affinity structure covering the entire hotpluggable address space with the proximity domain of the last node.

Add test cases on PC and Q35 machines with 3 proximity domains, and one PC-DIMM and one NVDIMM attached to the second proximity domain. Check whether the QEMU-built SRAT tables match with the expected ones.

---
 tests/acpi-test-data/pc/APIC.dimmpxm  | Bin 0 -> 136 bytes
 tests/acpi-test-data/pc/DSDT.dimmpxm  | Bin 0 -> 6710 bytes
 tests/acpi-test-data/pc/NFIT.dimmpxm  | Bin 0 -> 224 bytes
 tests/acpi-test-data/pc/SRAT.dimmpxm  | Bin 0 -> 416 bytes
 tests/acpi-test-data/pc/SSDT.dimmpxm  | Bin 0 -> 685 bytes
 tests/acpi-test-data/q35/APIC.dimmpxm | Bin 0 -> 136 bytes
 tests/acpi-test-data/q35/DSDT.dimmpxm | Bin 0 -> 9394 bytes
 tests/acpi-test-data/q35/NFIT.dimmpxm | Bin 0 -> 224 bytes
 tests/acpi-test-data/q35/SRAT.dimmpxm | Bin 0 -> 416 bytes
 tests/acpi-test-data/q35/SSDT.dimmpxm | Bin 0 -> 685 bytes
 tests/bios-tables-test.c              |  33 +++++++++++++++++++++++++++++++++
 11 files changed, 33 insertions(+)
 create mode 100644 tests/acpi-test-data/pc/APIC.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/DSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/NFIT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/SRAT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/SSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/APIC.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/DSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/NFIT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/SRAT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/SSDT.dimmpxm
tests/acpi-test-data/pc/APIC.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..658d7e748e37540ff85a02f4391efc7eaae3c8b4
GIT binary patch
tests/acpi-test-data/pc/DSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..20e6433725bb3e70085cf6227f981106772bdaea
GIT binary patch
tests/acpi-test-data/pc/NFIT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..207328ed9357409e4098df64f951a29527ab52de
GIT binary patch
tests/acpi-test-data/pc/SRAT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..b308d09b94cb8547f611bf8eb3a956359a71576c
GIT binary patch
tests/acpi-test-data/pc/SSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2d5b721bcf9c398feb6d005761f898015042e8a4
GIT binary patch
tests/acpi-test-data/q35/APIC.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..658d7e748e37540ff85a02f4391efc7eaae3c8b4
GIT binary patch
tests/acpi-test-data/q35/DSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..92f2385765ccba9b8cac2db64a68a96caeaab373
GIT binary patch
tests/acpi-test-data/q35/NFIT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..207328ed9357409e4098df64f951a29527ab52de
GIT binary patch
tests/acpi-test-data/q35/SRAT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..b308d09b94cb8547f611bf8eb3a956359a71576c
GIT binary patch
tests/acpi-test-data/q35/SSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2d5b721bcf9c398feb6d005761f898015042e8a4
GIT binary patch
tests/bios-tables-test.c +33 -0
index d45181aa51..319cf84c1a 100644
@@ -882,6 +882,37 @@ static void test_acpi_piix4_tcg_numamem(void)
     free_test_data(&data);
 }
 
+static void test_acpi_tcg_dimm_pxm(const char *machine)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = machine;
+    data.variant = ".dimmpxm";
+    test_acpi_one("nvdimm=on",
+                  " -smp 3"
+                  " -m 128M,slots=3,maxmem=1G"
+                  " -numa node,mem=32M,cpus=0,nodeid=0"
+                  " -numa node,mem=32M,cpus=1,nodeid=1"
+                  " -numa node,mem=64M,cpus=2,nodeid=2"
+                  " -object memory-backend-ram,id=ram0,size=128M"
+                  " -object memory-backend-ram,id=nvm0,size=128M"
+                  " -device pc-dimm,id=dimm0,memdev=ram0,node=1"
+                  " -device nvdimm,id=dimm1,memdev=nvm0,node=1",
+                  &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_q35_tcg_dimm_pxm(void)
+{
+    test_acpi_tcg_dimm_pxm(MACHINE_Q35);
+}
+
+static void test_acpi_piix4_tcg_dimm_pxm(void)
+{
+    test_acpi_tcg_dimm_pxm(MACHINE_PC);
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -906,6 +937,8 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
         qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
         qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
+        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
+        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
Signature · 1 line
2.14.1
#13 lore raw

Re: [Qemu-devel] [PATCH v3 5/5] tests/bios-tables-test: add test cases for DIMM proximity

Quoted 27 lines · On Mon, 5 Mar 2018 14:57:10 +0800 Haozhong Zhang <[email protected]>…

QEMU now builds one SRAT memory affinity structure for each static-plugged PC-DIMM and NVDIMM device with the proximity domain specified in the device option 'node', rather than only one SRAT memory affinity structure covering the entire hotpluggable address space with the proximity domain of the last node.

Add test cases on PC and Q35 machines with 3 proximity domains, and one PC-DIMM and one NVDIMM attached to the second proximity domain. Check whether the QEMU-built SRAT tables match with the expected ones.

---
 tests/acpi-test-data/pc/APIC.dimmpxm  | Bin 0 -> 136 bytes
 tests/acpi-test-data/pc/DSDT.dimmpxm  | Bin 0 -> 6710 bytes
 tests/acpi-test-data/pc/NFIT.dimmpxm  | Bin 0 -> 224 bytes
 tests/acpi-test-data/pc/SRAT.dimmpxm  | Bin 0 -> 416 bytes
 tests/acpi-test-data/pc/SSDT.dimmpxm  | Bin 0 -> 685 bytes
 tests/acpi-test-data/q35/APIC.dimmpxm | Bin 0 -> 136 bytes
 tests/acpi-test-data/q35/DSDT.dimmpxm | Bin 0 -> 9394 bytes
 tests/acpi-test-data/q35/NFIT.dimmpxm | Bin 0 -> 224 bytes
 tests/acpi-test-data/q35/SRAT.dimmpxm | Bin 0 -> 416 bytes
 tests/acpi-test-data/q35/SSDT.dimmpxm | Bin 0 -> 685 bytes
 tests/bios-tables-test.c              |  33 +++++++++++++++++++++++++++++++++
 11 files changed, 33 insertions(+)
 create mode 100644 tests/acpi-test-data/pc/APIC.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/DSDT.dimmpxm
Quoted 8 lines
 create mode 100644 tests/acpi-test-data/pc/NFIT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/SRAT.dimmpxm
 create mode 100644 tests/acpi-test-data/pc/SSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/APIC.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/DSDT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/NFIT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/SRAT.dimmpxm
 create mode 100644 tests/acpi-test-data/q35/SSDT.dimmpxm

drop binary blobs from patch,
just add in patch description which tables new and differ from default ones, like

Note to maintainer, please update/add following tables
tests/acpi-test-data/pc/APIC.dimmpxm tests/acpi-test-data/pc/NFIT.dimmpxm tests/acpi-test-data/pc/SRAT.dimmpxm
...

If you wish to simplify testing for reviewers it's ok post an additional patch with blobs and "DO NOT APPLY" note in subj.

Quoted 263 lines
tests/acpi-test-data/pc/APIC.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..658d7e748e37540ff85a02f4391efc7eaae3c8b4
GIT binary patch
tests/acpi-test-data/pc/DSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..20e6433725bb3e70085cf6227f981106772bdaea
GIT binary patch

zcmcgxUvJyi6~C9H9O_E4DVt54IBf){ZQ8C)^e1&vY#1z&vZYv*8BxwMFc>Mv!QSt z2satx2ENwaMQjOT80hSgA(XD{sMg=tt<jLWi|^s&@{_ODnPov=5tr(D&T)<L{hv z@44sR%jlNgUOGbv-KeZ<H7i%SX=*z3Q9=l|@vl;sZV|huS5_UG5+rIrO8ISgRAlvi zy|S@N|Jrr;=1>~aB0UQo6nV}n;q}*6L*s!=>De17&eqe$ErAXf5Fu1dD*Ge^>q0g zCdy7(ZxPwqsOwZQ<N#BZYi700K@>os1~+PE+aPH|zWFglB>Rzq^4yJTQ_q<#-N~s- zj@2#4|k>yE>n_OmT<luLmv}xT%AK5gAT@J?M}>chclv|4EF<h|S23*0Qo$HocdG zh=H6)gzOUKt&8Xlx@-4On>Pz3-BKAD7a!4N}52}fwG(!gK1LTDmwuV1{QIb^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&!Ie~UjYbJ<|732EBR?k1p{43iyE-rx5nK4H`CdCjJ)(Bz;=|

literal 0
HcmV?d00001

tests/acpi-test-data/pc/NFIT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..207328ed9357409e4098df64f951a29527ab52de
GIT binary patch

NAqGZ>^~k~m*#MLQ69E7K

literal 0
HcmV?d00001

tests/acpi-test-data/pc/SRAT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..b308d09b94cb8547f611bf8eb3a956359a71576c
GIT binary patch
tests/acpi-test-data/pc/SSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2d5b721bcf9c398feb6d005761f898015042e8a4
GIT binary patch

zbd~4x^lU38j7uPR%M#XE%he6ZTQ*Q&J6g9b+3let=>toZbj7~2_*w9l)l9X!ZA<ED zio5t#NUq0oAYzRd(yzje^{aF7>F4TR{A2%pu(_FR$MZ5GXAR$9KD)R1R8>#E7$4s? zKSaUiN>-QO6jiZuF0R)cNaYvfAi4G^9>ZBY2_PxPQ%FUY$pS;>NJb73jZBd(X*Ud z&-i?NGNWsr%m5<tI2w@=GLtd7I!0bTACd<l&qC<c5FNr^YoH&AIlz379@GV2bIg2- zH#Rw(&VaKWSAn&uyw;Nay{K~flM$F>_N+y9WhLGi@}b}bZ{B~9Wfvna9C14i?d2f z*OHSUJPs*V!o?wVmjkaB@KVM|iS!gh{gzLcbA+l9fzfN3AxJX{@b5&7acT*ezxqZ< zws2T<e-w_6q9F2C4QnXNoUdp$bJ-!|t+uJUo2h)RF8+G~eC|STUg+$9I?Lg^D#N$m Fg+DfN!vO#Q

literal 0
HcmV?d00001

tests/acpi-test-data/q35/APIC.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..658d7e748e37540ff85a02f4391efc7eaae3c8b4
GIT binary patch
tests/acpi-test-data/q35/DSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..92f2385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Wf5gKAvYOymO_gN(cN* z;X(dE-m=ke$?5zpPCv+x<9RW$|E*7Vj%iNs8R##?#2M*JjD2-{{I~DqnXg&TouT1 z=n)Y=1CcOsgbiYMir;_AWr^-Cb5cBzqZZ9&se%;p3}^sm@Q^4{DQ*y;Z5Af&PIPJ zn;|<y%-_&&hQjRbwod=GgQ_2*~1IeJ9>We6;E#Q=dV_SYcOt_56LRdj59-<S!X+Q zQ~ZiyGb4Y!lIxU8_}K>i&Zl?uOsDjs3~((ihR+?HH6JTHHP%&QLo~82Z@bI>3mRqN Ac>n+a

literal 0
HcmV?d00001

tests/acpi-test-data/q35/NFIT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..207328ed9357409e4098df64f951a29527ab52de
GIT binary patch

NAqGZ>^~k~m*#MLQ69E7K

literal 0
HcmV?d00001

tests/acpi-test-data/q35/SRAT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..b308d09b94cb8547f611bf8eb3a956359a71576c
GIT binary patch
tests/acpi-test-data/q35/SSDT.dimmpxm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2d5b721bcf9c398feb6d005761f898015042e8a4
GIT binary patch

zbd~4x^lU38j7uPR%M#XE%he6ZTQ*Q&J6g9b+3let=>toZbj7~2_*w9l)l9X!ZA<ED zio5t#NUq0oAYzRd(yzje^{aF7>F4TR{A2%pu(_FR$MZ5GXAR$9KD)R1R8>#E7$4s? zKSaUiN>-QO6jiZuF0R)cNaYvfAi4G^9>ZBY2_PxPQ%FUY$pS;>NJb73jZBd(X*Ud z&-i?NGNWsr%m5<tI2w@=GLtd7I!0bTACd<l&qC<c5FNr^YoH&AIlz379@GV2bIg2- zH#Rw(&VaKWSAn&uyw;Nay{K~flM$F>_N+y9WhLGi@}b}bZ{B~9Wfvna9C14i?d2f z*OHSUJPs*V!o?wVmjkaB@KVM|iS!gh{gzLcbA+l9fzfN3AxJX{@b5&7acT*ezxqZ< zws2T<e-w_6q9F2C4QnXNoUdp$bJ-!|t+uJUo2h)RF8+G~eC|STUg+$9I?Lg^D#N$m Fg+DfN!vO#Q

literal 0
HcmV?d00001

tests/bios-tables-test.c +3 -0
index d45181aa51..319cf84c1a 100644
@@ -882,6 +882,37 @@ static void test_acpi_piix4_tcg_numamem(void)
     free_test_data(&data);
 }
 
+static void test_acpi_tcg_dimm_pxm(const char *machine)
+{
+    test_data data;

tests/bios-tables-test.c static void test_acpi_piix4_tcg_numamem(void) · line 897

Quoted 10 lines
tests/bios-tables-test.c +8 -0
+
+    memset(&data, 0, sizeof(data));
+    data.machine = machine;
+    data.variant = ".dimmpxm";
+    test_acpi_one("nvdimm=on",
+                  " -smp 3"
+                  " -m 128M,slots=3,maxmem=1G"
 
 
+                  " -numa node,mem=32M,cpus=0,nodeid=0"

I'd use new CLI syntax to specify CPUs, see pc_numa_cpu(), so we won't have to touch it later when deprecating "cpus=" option.

tests/bios-tables-test.c static void test_acpi_piix4_tcg_numamem(void) · line 901

Quoted 6 lines
tests/bios-tables-test.c +6 -0
+                  " -numa node,mem=32M,cpus=1,nodeid=1"
+                  " -numa node,mem=64M,cpus=2,nodeid=2"
+                  " -object memory-backend-ram,id=ram0,size=128M"
+                  " -object memory-backend-ram,id=nvm0,size=128M"
+                  " -device pc-dimm,id=dimm0,memdev=ram0,node=1"
+                  " -device nvdimm,id=dimm1,memdev=nvm0,node=1",

maybe use a different node for dimm and nvdimm

Quoted 26 lines
tests/bios-tables-test.c +14 -0
+                  &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_q35_tcg_dimm_pxm(void)
+{
+    test_acpi_tcg_dimm_pxm(MACHINE_Q35);
+}
+
+static void test_acpi_piix4_tcg_dimm_pxm(void)
+{
+    test_acpi_tcg_dimm_pxm(MACHINE_PC);
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
tests/bios-tables-test.c +2 -0
@@ -906,6 +937,8 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
         qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
         qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
+        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
+        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);