From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: Shivaprasad G Bhat <sbhat@linux.ibm.com>,
aneesh.kumar@linux.ibm.com,
Daniel Henrique Barboza <danielhb413@gmail.com>,
groug@kaod.org, qemu-ppc@nongnu.org,
Igor Mammedov <imammedo@redhat.com>,
david@gibson.dropbear.id.au
Subject: [RFC PATCH v2 5/7] nvdimm: add PPC64 'device-node' property
Date: Tue, 15 Jun 2021 22:19:42 -0300 [thread overview]
Message-ID: <20210616011944.2996399-6-danielhb413@gmail.com> (raw)
In-Reply-To: <20210616011944.2996399-1-danielhb413@gmail.com>
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
next prev parent reply other threads:[~2021-06-16 1:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 1:19 [RFC PATCH v2 0/7] pSeries base FORM2 NUMA affinity support Daniel Henrique Barboza
2021-06-16 1:19 ` [RFC PATCH v2 1/7] spapr_numa.c: split FORM1 code into helpers Daniel Henrique Barboza
2021-06-16 1:19 ` [RFC PATCH v2 2/7] spapr: move NUMA data init to post-CAS Daniel Henrique Barboza
2021-06-16 1:19 ` [RFC PATCH v2 3/7] spapr_numa.c: base FORM2 NUMA affinity support Daniel Henrique Barboza
2021-06-16 1:19 ` [RFC PATCH v2 4/7] spapr: simplify spapr_numa_associativity_init params Daniel Henrique Barboza
2021-06-16 1:19 ` Daniel Henrique Barboza [this message]
2021-06-16 1:19 ` [RFC PATCH v2 6/7] spapr_numa, spapr_nvdimm: write secondary NUMA domain for nvdimms Daniel Henrique Barboza
2021-06-16 1:19 ` [RFC PATCH v2 7/7] spapr: move memory/cpu less check to spapr_numa_FORM1_affinity_init() Daniel Henrique Barboza
2021-06-24 5:47 ` [RFC PATCH v2 0/7] pSeries base FORM2 NUMA affinity support David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210616011944.2996399-6-danielhb413@gmail.com \
--to=danielhb413@gmail.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sbhat@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).