[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 5/7] nvdimm: add PPC64 'device-node' property
From: |
Daniel Henrique Barboza |
Subject: |
[RFC PATCH v2 5/7] nvdimm: add PPC64 'device-node' property |
Date: |
Tue, 15 Jun 2021 22:19:42 -0300 |
The spapr-nvdimm driver is able to operate in two ways. The first
one is as a regular memory in which the NUMA node of the parent
pc-dimm class is used. The second mode, as persistent memory, allows for
a different NUMA node to be used based on the locality of the device.
At this moment we don't have a way to express this second NUMA node for
the persistent memory mode. This patch introduces a new 'device-node'
property that will be used by the PPC64 spapr-nvdimm driver to set a
second NUMA node for the nvdimm.
CC: Shivaprasad G Bhat <sbhat@linux.ibm.com>
CC: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
hw/mem/nvdimm.c | 31 +++++++++++++++++++++++++++++++
include/hw/mem/nvdimm.h | 12 ++++++++++++
2 files changed, 43 insertions(+)
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 7397b67156..96298e3fda 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -96,15 +96,46 @@ static void nvdimm_set_uuid(Object *obj, Visitor *v, const
char *name,
g_free(value);
}
+static void nvdimm_get_device_node(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ NVDIMMDevice *nvdimm = NVDIMM(obj);
+ int64_t value = nvdimm->device_node;
+
+ visit_type_int(v, name, &value, errp);
+}
+
+static void nvdimm_set_device_node(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ NVDIMMDevice *nvdimm = NVDIMM(obj);
+ int64_t value;
+
+ if (!visit_type_int(v, name, &value, errp)) {
+ return;
+ }
+
+ nvdimm->device_node = value;
+}
static void nvdimm_init(Object *obj)
{
+ NVDIMMDevice *nvdimm = NVDIMM(obj);
+
object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
nvdimm_get_label_size, nvdimm_set_label_size, NULL,
NULL);
object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid,
nvdimm_set_uuid, NULL, NULL);
+
+ nvdimm->device_node = -1;
+ object_property_add(obj, NVDIMM_DEVICE_NODE, "int",
+ nvdimm_get_device_node,
+ nvdimm_set_device_node,
+ NULL, NULL);
}
static void nvdimm_finalize(Object *obj)
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index bcf62f825c..e3298ef841 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -49,6 +49,7 @@
OBJECT_DECLARE_TYPE(NVDIMMDevice, NVDIMMClass, NVDIMM)
#define NVDIMM_LABEL_SIZE_PROP "label-size"
+#define NVDIMM_DEVICE_NODE "device-node"
#define NVDIMM_UUID_PROP "uuid"
#define NVDIMM_UNARMED_PROP "unarmed"
@@ -89,6 +90,17 @@ struct NVDIMMDevice {
* The PPC64 - spapr requires each nvdimm device have a uuid.
*/
QemuUUID uuid;
+
+ /*
+ * The spapr-nvdimm (PPC64 NVDIMM) driver supports two modes of
+ * operation: regular memory and persistent memory. When using the
+ * device as regular memory, the NUMA nodeid that comes from
+ * PC_DIMM_NODEPROP is to be used. When used as persistent memory,
+ * the guest should consider the 'device-node' instead since it
+ * indicates the locality of the device to an established NUMA
+ * node, which is more relevant to this type of usage.
+ */
+ int device_node;
};
struct NVDIMMClass {
--
2.31.1
- [RFC PATCH v2 0/7] pSeries base FORM2 NUMA affinity support, Daniel Henrique Barboza, 2021/06/15
- [RFC PATCH v2 1/7] spapr_numa.c: split FORM1 code into helpers, Daniel Henrique Barboza, 2021/06/15
- [RFC PATCH v2 2/7] spapr: move NUMA data init to post-CAS, Daniel Henrique Barboza, 2021/06/15
- [RFC PATCH v2 3/7] spapr_numa.c: base FORM2 NUMA affinity support, Daniel Henrique Barboza, 2021/06/15
- [RFC PATCH v2 4/7] spapr: simplify spapr_numa_associativity_init params, Daniel Henrique Barboza, 2021/06/15
- [RFC PATCH v2 5/7] nvdimm: add PPC64 'device-node' property,
Daniel Henrique Barboza <=
- [RFC PATCH v2 7/7] spapr: move memory/cpu less check to spapr_numa_FORM1_affinity_init(), Daniel Henrique Barboza, 2021/06/15
- [RFC PATCH v2 6/7] spapr_numa, spapr_nvdimm: write secondary NUMA domain for nvdimms, Daniel Henrique Barboza, 2021/06/15
- Re: [RFC PATCH v2 0/7] pSeries base FORM2 NUMA affinity support, David Gibson, 2021/06/24