All of lore.kernel.org
 help / color / mirror / Atom feed
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 6/8] nvdimm: add PPC64 'device-node' property
Date: Mon, 14 Jun 2021 22:33:07 -0300	[thread overview]
Message-ID: <20210615013309.2833323-7-danielhb413@gmail.com> (raw)
In-Reply-To: <20210615013309.2833323-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         | 28 ++++++++++++++++++++++++++++
 include/hw/mem/nvdimm.h | 12 ++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 7397b67156..030ccf7575 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -96,6 +96,29 @@ 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);
+    uint8_t value = nvdimm->device_node;
+
+    visit_type_uint8(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);
+    uint8_t value;
+
+    if (!visit_type_uint8(v, name, &value, errp)) {
+        return;
+    }
+
+    nvdimm->device_node = value;
+}
 
 static void nvdimm_init(Object *obj)
 {
@@ -105,6 +128,11 @@ static void nvdimm_init(Object *obj)
 
     object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid,
                         nvdimm_set_uuid, NULL, NULL);
+
+    object_property_add(obj, NVDIMM_DEVICE_NODE, "uint8",
+                        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..430169322f 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.
+    */
+    uint8_t device_node;
 };
 
 struct NVDIMMClass {
-- 
2.31.1



  parent reply	other threads:[~2021-06-15  1:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  1:33 [RFC PATCH 0/8] pSeries base FORM2 NUMA affinity support Daniel Henrique Barboza
2021-06-15  1:33 ` [RFC PATCH 1/8] spapr: move NUMA data init to do_client_architecture_support() Daniel Henrique Barboza
2021-06-15  1:33 ` [RFC PATCH 2/8] spapr_numa.c: split FORM1 code into helpers Daniel Henrique Barboza
2021-06-15  1:33 ` [RFC PATCH 3/8] spapr_numa.c: wait for CAS before writing rtas DT Daniel Henrique Barboza
2021-06-15  4:02   ` David Gibson
2021-06-15 20:26     ` Daniel Henrique Barboza
2021-06-15  1:33 ` [RFC PATCH 4/8] spapr_numa.c: base FORM2 NUMA affinity support Daniel Henrique Barboza
2021-06-15  1:33 ` [RFC PATCH 5/8] spapr: simplify spapr_numa_associativity_init params Daniel Henrique Barboza
2021-06-15  1:33 ` Daniel Henrique Barboza [this message]
2021-06-15  9:33   ` [RFC PATCH 6/8] nvdimm: add PPC64 'device-node' property Aneesh Kumar K.V
2021-06-15 20:13     ` Daniel Henrique Barboza
2021-06-15  1:33 ` [RFC PATCH 7/8] spapr_numa, spapar_nvdimm: write secondary NUMA domain for nvdimms Daniel Henrique Barboza
2021-06-15  1:33 ` [RFC PATCH 8/8] spapr: move memory/cpu less check to spapr_numa_FORM1_affinity_init() Daniel Henrique Barboza

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=20210615013309.2833323-7-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.