All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] nvdimm: fix typo in label-size definition
@ 2018-04-27 21:53 ` Ross Zwisler
  0 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-04-27 21:53 UTC (permalink / raw)
  To: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
Cc: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/mem/nvdimm.c         | 2 +-
 include/hw/mem/nvdimm.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index acb656b672..4087aca25e 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -89,7 +89,7 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
 
 static void nvdimm_init(Object *obj)
 {
-    object_property_add(obj, NVDIMM_LABLE_SIZE_PROP, "int",
+    object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
                         nvdimm_get_label_size, nvdimm_set_label_size, NULL,
                         NULL, NULL);
     object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index 7fd87c4e1c..74c60332e1 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -48,7 +48,7 @@
 #define NVDIMM_GET_CLASS(obj) OBJECT_GET_CLASS(NVDIMMClass, (obj), \
                                                TYPE_NVDIMM)
 
-#define NVDIMM_LABLE_SIZE_PROP "label-size"
+#define NVDIMM_LABEL_SIZE_PROP "label-size"
 #define NVDIMM_UNARMED_PROP    "unarmed"
 
 struct NVDIMMDevice {
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [Qemu-devel] [PATCH 1/3] nvdimm: fix typo in label-size definition
@ 2018-04-27 21:53 ` Ross Zwisler
  0 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-04-27 21:53 UTC (permalink / raw)
  To: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm
  Cc: Ross Zwisler

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
Cc: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/mem/nvdimm.c         | 2 +-
 include/hw/mem/nvdimm.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index acb656b672..4087aca25e 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -89,7 +89,7 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
 
 static void nvdimm_init(Object *obj)
 {
-    object_property_add(obj, NVDIMM_LABLE_SIZE_PROP, "int",
+    object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
                         nvdimm_get_label_size, nvdimm_set_label_size, NULL,
                         NULL, NULL);
     object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index 7fd87c4e1c..74c60332e1 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -48,7 +48,7 @@
 #define NVDIMM_GET_CLASS(obj) OBJECT_GET_CLASS(NVDIMMClass, (obj), \
                                                TYPE_NVDIMM)
 
-#define NVDIMM_LABLE_SIZE_PROP "label-size"
+#define NVDIMM_LABEL_SIZE_PROP "label-size"
 #define NVDIMM_UNARMED_PROP    "unarmed"
 
 struct NVDIMMDevice {
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
  2018-04-27 21:53 ` [Qemu-devel] " Ross Zwisler
@ 2018-04-27 21:53   ` Ross Zwisler
  -1 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-04-27 21:53 UTC (permalink / raw)
  To: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm

Add support for the NFIT Platform Capabilities Structure, newly added in
ACPI 6.2 Errata A.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 59d6e4254c..859b390e07 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -169,6 +169,21 @@ struct NvdimmNfitControlRegion {
 } QEMU_PACKED;
 typedef struct NvdimmNfitControlRegion NvdimmNfitControlRegion;
 
+/*
+ * NVDIMM Platform Capabilities Structure
+ *
+ * Defined in section 5.2.25.9 of ACPI 6.2 Errata A, September 2017
+ */
+struct NvdimmNfitPlatformCaps {
+    uint16_t type;
+    uint16_t length;
+    uint8_t highest_cap;
+    uint8_t reserved[3];
+    uint32_t capabilities;
+    uint8_t reserved2[4];
+} QEMU_PACKED;
+typedef struct NvdimmNfitPlatformCaps NvdimmNfitPlatformCaps;
+
 /*
  * Module serial number is a unique number for each device. We use the
  * slot id of NVDIMM device to generate this number so that each device
@@ -351,6 +366,21 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
                                          JEDEC Annex L Release 3. */);
 }
 
+/*
+ * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
+ */
+static void
+nvdimm_build_structure_caps(GArray *structures)
+{
+    NvdimmNfitPlatformCaps *nfit_caps;
+
+    nfit_caps = acpi_data_push(structures, sizeof(*nfit_caps));
+
+    nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
+    nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
+    nfit_caps->highest_cap = 1;
+    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
+}
 static GArray *nvdimm_build_device_structure(void)
 {
     GSList *device_list = nvdimm_get_device_list();
@@ -373,6 +403,8 @@ static GArray *nvdimm_build_device_structure(void)
     }
     g_slist_free(device_list);
 
+    nvdimm_build_structure_caps(structures);
+
     return structures;
 }
 
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
@ 2018-04-27 21:53   ` Ross Zwisler
  0 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-04-27 21:53 UTC (permalink / raw)
  To: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm
  Cc: Ross Zwisler

Add support for the NFIT Platform Capabilities Structure, newly added in
ACPI 6.2 Errata A.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 59d6e4254c..859b390e07 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -169,6 +169,21 @@ struct NvdimmNfitControlRegion {
 } QEMU_PACKED;
 typedef struct NvdimmNfitControlRegion NvdimmNfitControlRegion;
 
+/*
+ * NVDIMM Platform Capabilities Structure
+ *
+ * Defined in section 5.2.25.9 of ACPI 6.2 Errata A, September 2017
+ */
+struct NvdimmNfitPlatformCaps {
+    uint16_t type;
+    uint16_t length;
+    uint8_t highest_cap;
+    uint8_t reserved[3];
+    uint32_t capabilities;
+    uint8_t reserved2[4];
+} QEMU_PACKED;
+typedef struct NvdimmNfitPlatformCaps NvdimmNfitPlatformCaps;
+
 /*
  * Module serial number is a unique number for each device. We use the
  * slot id of NVDIMM device to generate this number so that each device
@@ -351,6 +366,21 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
                                          JEDEC Annex L Release 3. */);
 }
 
+/*
+ * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
+ */
+static void
+nvdimm_build_structure_caps(GArray *structures)
+{
+    NvdimmNfitPlatformCaps *nfit_caps;
+
+    nfit_caps = acpi_data_push(structures, sizeof(*nfit_caps));
+
+    nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
+    nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
+    nfit_caps->highest_cap = 1;
+    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
+}
 static GArray *nvdimm_build_device_structure(void)
 {
     GSList *device_list = nvdimm_get_device_list();
@@ -373,6 +403,8 @@ static GArray *nvdimm_build_device_structure(void)
     }
     g_slist_free(device_list);
 
+    nvdimm_build_structure_caps(structures);
+
     return structures;
 }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/3] nvdimm: platform capabilities command line option
  2018-04-27 21:53 ` [Qemu-devel] " Ross Zwisler
@ 2018-04-27 21:53   ` Ross Zwisler
  -1 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-04-27 21:53 UTC (permalink / raw)
  To: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm

Add a device command line option to allow the user to control the Platform
Capabilities Structure in the virtualized NFIT.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 docs/nvdimm.txt         | 22 ++++++++++++++++++++++
 hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
 hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
 include/hw/mem/nvdimm.h |  6 ++++++
 4 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
index e903d8bb09..13a2c15b70 100644
--- a/docs/nvdimm.txt
+++ b/docs/nvdimm.txt
@@ -153,3 +153,25 @@ guest NVDIMM region mapping structure.  This unarmed flag indicates
 guest software that this vNVDIMM device contains a region that cannot
 accept persistent writes. In result, for example, the guest Linux
 NVDIMM driver, marks such vNVDIMM device as read-only.
+
+Platform Capabilities
+---------------------
+
+ACPI 6.2 Errata A added support for a new Platform Capabilities Structure
+which allows the platform to communicate what features it supports related to
+NVDIMM data durability.  Users can provide a capabilities value to a guest via
+the optional "cap" device command line option:
+
+ -device nvdimm,id=nvdimm1,memdev=mem1,cap=3
+
+As of ACPI 6.2 Errata A, the following values are valid for the bottom two
+bits:
+
+2 - Memory Controller Flush to NVDIMM Durability on Power Loss Capable.
+3 - CPU Cache Flush to NVDIMM Durability on Power Loss Capable.
+
+For a complete list of the flags available please consult the ACPI spec.
+
+These platform capabilities apply to the entire virtual platform, so it is
+recommended that only one "cap" device command option be given per virtual
+machine.  This value will apply to all NVDIMMs in the virtual platform.
diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 859b390e07..375237c96c 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -370,7 +370,7 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
  * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
  */
 static void
-nvdimm_build_structure_caps(GArray *structures)
+nvdimm_build_structure_caps(GArray *structures, uint32_t capabilities)
 {
     NvdimmNfitPlatformCaps *nfit_caps;
 
@@ -378,13 +378,31 @@ nvdimm_build_structure_caps(GArray *structures)
 
     nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
     nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
-    nfit_caps->highest_cap = 1;
-    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
+    nfit_caps->highest_cap = 2;
+    nfit_caps->capabilities = cpu_to_le32(capabilities);
 }
+
+static uint32_t nvdimm_get_capabilities(DeviceState *dev)
+{
+    static uint32_t capabilities = 0;
+    uint32_t this_cap = object_property_get_uint(OBJECT(dev),
+                                            NVDIMM_CAPABILITIES_PROP, NULL);
+
+    if (this_cap && !capabilities)
+        capabilities = this_cap;
+
+    if (this_cap && this_cap != capabilities)
+        nvdimm_debug("WARNING: multiple capabilities (%d and %d) defined\n",
+                this_cap, capabilities);
+
+    return capabilities;
+}
+
 static GArray *nvdimm_build_device_structure(void)
 {
     GSList *device_list = nvdimm_get_device_list();
     GArray *structures = g_array_new(false, true /* clear */, 1);
+    uint32_t capabilities = 0;
 
     for (; device_list; device_list = device_list->next) {
         DeviceState *dev = device_list->data;
@@ -400,10 +418,13 @@ static GArray *nvdimm_build_device_structure(void)
 
         /* build NVDIMM Control Region Structure. */
         nvdimm_build_structure_dcr(structures, dev);
+
+        capabilities = nvdimm_get_capabilities(dev);
     }
     g_slist_free(device_list);
 
-    nvdimm_build_structure_caps(structures);
+    if (capabilities)
+        nvdimm_build_structure_caps(structures, capabilities);
 
     return structures;
 }
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 4087aca25e..923364e190 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -87,6 +87,31 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
     error_propagate(errp, local_err);
 }
 
+static void nvdimm_get_capabilities(Object *obj, Visitor *v, const char *name,
+                                  void *opaque, Error **errp)
+{
+    NVDIMMDevice *nvdimm = NVDIMM(obj);
+    uint32_t value = nvdimm->capabilities;
+
+    visit_type_uint32(v, name, &value, errp);
+}
+
+static void nvdimm_set_capabilities(Object *obj, Visitor *v, const char *name,
+                                  void *opaque, Error **errp)
+{
+    NVDIMMDevice *nvdimm = NVDIMM(obj);
+    Error *local_err = NULL;
+    uint32_t value;
+
+    visit_type_uint32(v, name, &value, &local_err);
+    if (local_err)
+        goto out;
+
+    nvdimm->capabilities = value;
+out:
+    error_propagate(errp, local_err);
+}
+
 static void nvdimm_init(Object *obj)
 {
     object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
@@ -94,6 +119,9 @@ static void nvdimm_init(Object *obj)
                         NULL, NULL);
     object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
                              nvdimm_get_unarmed, nvdimm_set_unarmed, NULL);
+    object_property_add(obj, NVDIMM_CAPABILITIES_PROP, "uint32",
+                        nvdimm_get_capabilities, nvdimm_set_capabilities,
+                        NULL, NULL, NULL);
 }
 
 static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index 74c60332e1..68af64ff46 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -50,6 +50,7 @@
 
 #define NVDIMM_LABEL_SIZE_PROP "label-size"
 #define NVDIMM_UNARMED_PROP    "unarmed"
+#define NVDIMM_CAPABILITIES_PROP "cap"
 
 struct NVDIMMDevice {
     /* private */
@@ -83,6 +84,11 @@ struct NVDIMMDevice {
      * the guest write persistence.
      */
     bool unarmed;
+
+    /*
+     * Platform capabilities, section 5.2.25.9 of ACPI 6.2 Errata A
+     */
+    uint32_t capabilities;
 };
 typedef struct NVDIMMDevice NVDIMMDevice;
 
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
@ 2018-04-27 21:53   ` Ross Zwisler
  0 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-04-27 21:53 UTC (permalink / raw)
  To: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm
  Cc: Ross Zwisler

Add a device command line option to allow the user to control the Platform
Capabilities Structure in the virtualized NFIT.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 docs/nvdimm.txt         | 22 ++++++++++++++++++++++
 hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
 hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
 include/hw/mem/nvdimm.h |  6 ++++++
 4 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
index e903d8bb09..13a2c15b70 100644
--- a/docs/nvdimm.txt
+++ b/docs/nvdimm.txt
@@ -153,3 +153,25 @@ guest NVDIMM region mapping structure.  This unarmed flag indicates
 guest software that this vNVDIMM device contains a region that cannot
 accept persistent writes. In result, for example, the guest Linux
 NVDIMM driver, marks such vNVDIMM device as read-only.
+
+Platform Capabilities
+---------------------
+
+ACPI 6.2 Errata A added support for a new Platform Capabilities Structure
+which allows the platform to communicate what features it supports related to
+NVDIMM data durability.  Users can provide a capabilities value to a guest via
+the optional "cap" device command line option:
+
+ -device nvdimm,id=nvdimm1,memdev=mem1,cap=3
+
+As of ACPI 6.2 Errata A, the following values are valid for the bottom two
+bits:
+
+2 - Memory Controller Flush to NVDIMM Durability on Power Loss Capable.
+3 - CPU Cache Flush to NVDIMM Durability on Power Loss Capable.
+
+For a complete list of the flags available please consult the ACPI spec.
+
+These platform capabilities apply to the entire virtual platform, so it is
+recommended that only one "cap" device command option be given per virtual
+machine.  This value will apply to all NVDIMMs in the virtual platform.
diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 859b390e07..375237c96c 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -370,7 +370,7 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
  * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
  */
 static void
-nvdimm_build_structure_caps(GArray *structures)
+nvdimm_build_structure_caps(GArray *structures, uint32_t capabilities)
 {
     NvdimmNfitPlatformCaps *nfit_caps;
 
@@ -378,13 +378,31 @@ nvdimm_build_structure_caps(GArray *structures)
 
     nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
     nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
-    nfit_caps->highest_cap = 1;
-    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
+    nfit_caps->highest_cap = 2;
+    nfit_caps->capabilities = cpu_to_le32(capabilities);
 }
+
+static uint32_t nvdimm_get_capabilities(DeviceState *dev)
+{
+    static uint32_t capabilities = 0;
+    uint32_t this_cap = object_property_get_uint(OBJECT(dev),
+                                            NVDIMM_CAPABILITIES_PROP, NULL);
+
+    if (this_cap && !capabilities)
+        capabilities = this_cap;
+
+    if (this_cap && this_cap != capabilities)
+        nvdimm_debug("WARNING: multiple capabilities (%d and %d) defined\n",
+                this_cap, capabilities);
+
+    return capabilities;
+}
+
 static GArray *nvdimm_build_device_structure(void)
 {
     GSList *device_list = nvdimm_get_device_list();
     GArray *structures = g_array_new(false, true /* clear */, 1);
+    uint32_t capabilities = 0;
 
     for (; device_list; device_list = device_list->next) {
         DeviceState *dev = device_list->data;
@@ -400,10 +418,13 @@ static GArray *nvdimm_build_device_structure(void)
 
         /* build NVDIMM Control Region Structure. */
         nvdimm_build_structure_dcr(structures, dev);
+
+        capabilities = nvdimm_get_capabilities(dev);
     }
     g_slist_free(device_list);
 
-    nvdimm_build_structure_caps(structures);
+    if (capabilities)
+        nvdimm_build_structure_caps(structures, capabilities);
 
     return structures;
 }
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 4087aca25e..923364e190 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -87,6 +87,31 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
     error_propagate(errp, local_err);
 }
 
+static void nvdimm_get_capabilities(Object *obj, Visitor *v, const char *name,
+                                  void *opaque, Error **errp)
+{
+    NVDIMMDevice *nvdimm = NVDIMM(obj);
+    uint32_t value = nvdimm->capabilities;
+
+    visit_type_uint32(v, name, &value, errp);
+}
+
+static void nvdimm_set_capabilities(Object *obj, Visitor *v, const char *name,
+                                  void *opaque, Error **errp)
+{
+    NVDIMMDevice *nvdimm = NVDIMM(obj);
+    Error *local_err = NULL;
+    uint32_t value;
+
+    visit_type_uint32(v, name, &value, &local_err);
+    if (local_err)
+        goto out;
+
+    nvdimm->capabilities = value;
+out:
+    error_propagate(errp, local_err);
+}
+
 static void nvdimm_init(Object *obj)
 {
     object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
@@ -94,6 +119,9 @@ static void nvdimm_init(Object *obj)
                         NULL, NULL);
     object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
                              nvdimm_get_unarmed, nvdimm_set_unarmed, NULL);
+    object_property_add(obj, NVDIMM_CAPABILITIES_PROP, "uint32",
+                        nvdimm_get_capabilities, nvdimm_set_capabilities,
+                        NULL, NULL, NULL);
 }
 
 static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index 74c60332e1..68af64ff46 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -50,6 +50,7 @@
 
 #define NVDIMM_LABEL_SIZE_PROP "label-size"
 #define NVDIMM_UNARMED_PROP    "unarmed"
+#define NVDIMM_CAPABILITIES_PROP "cap"
 
 struct NVDIMMDevice {
     /* private */
@@ -83,6 +84,11 @@ struct NVDIMMDevice {
      * the guest write persistence.
      */
     bool unarmed;
+
+    /*
+     * Platform capabilities, section 5.2.25.9 of ACPI 6.2 Errata A
+     */
+    uint32_t capabilities;
 };
 typedef struct NVDIMMDevice NVDIMMDevice;
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/3] nvdimm: fix typo in label-size definition
  2018-04-27 21:53 ` [Qemu-devel] " Ross Zwisler
@ 2018-04-30 11:38   ` Stefan Hajnoczi
  -1 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 11:38 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: qemu-devel, Haozhong Zhang, linux-nvdimm, Eduardo Habkost,
	Michael S . Tsirkin

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Fri, Apr 27, 2018 at 03:53:12PM -0600, Ross Zwisler wrote:
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  hw/mem/nvdimm.c         | 2 +-
>  include/hw/mem/nvdimm.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] nvdimm: fix typo in label-size definition
@ 2018-04-30 11:38   ` Stefan Hajnoczi
  0 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 11:38 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Eduardo Habkost, qemu-devel,
	linux-nvdimm

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Fri, Apr 27, 2018 at 03:53:12PM -0600, Ross Zwisler wrote:
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  hw/mem/nvdimm.c         | 2 +-
>  include/hw/mem/nvdimm.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
  2018-04-27 21:53   ` [Qemu-devel] " Ross Zwisler
@ 2018-04-30 11:39     ` Stefan Hajnoczi
  -1 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 11:39 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: qemu-devel, Haozhong Zhang, linux-nvdimm, Eduardo Habkost,
	Michael S . Tsirkin

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

On Fri, Apr 27, 2018 at 03:53:13PM -0600, Ross Zwisler wrote:
> Add support for the NFIT Platform Capabilities Structure, newly added in
> ACPI 6.2 Errata A.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
@ 2018-04-30 11:39     ` Stefan Hajnoczi
  0 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 11:39 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Eduardo Habkost, qemu-devel,
	linux-nvdimm

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

On Fri, Apr 27, 2018 at 03:53:13PM -0600, Ross Zwisler wrote:
> Add support for the NFIT Platform Capabilities Structure, newly added in
> ACPI 6.2 Errata A.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/3] nvdimm: platform capabilities command line option
  2018-04-27 21:53   ` [Qemu-devel] " Ross Zwisler
@ 2018-04-30 11:39     ` Stefan Hajnoczi
  -1 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 11:39 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: qemu-devel, Haozhong Zhang, linux-nvdimm, Eduardo Habkost,
	Michael S . Tsirkin

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

On Fri, Apr 27, 2018 at 03:53:14PM -0600, Ross Zwisler wrote:
> Add a device command line option to allow the user to control the Platform
> Capabilities Structure in the virtualized NFIT.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  docs/nvdimm.txt         | 22 ++++++++++++++++++++++
>  hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
>  hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
>  include/hw/mem/nvdimm.h |  6 ++++++
>  4 files changed, 81 insertions(+), 4 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
@ 2018-04-30 11:39     ` Stefan Hajnoczi
  0 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-04-30 11:39 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Eduardo Habkost, qemu-devel,
	linux-nvdimm

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

On Fri, Apr 27, 2018 at 03:53:14PM -0600, Ross Zwisler wrote:
> Add a device command line option to allow the user to control the Platform
> Capabilities Structure in the virtualized NFIT.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  docs/nvdimm.txt         | 22 ++++++++++++++++++++++
>  hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
>  hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
>  include/hw/mem/nvdimm.h |  6 ++++++
>  4 files changed, 81 insertions(+), 4 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/3] nvdimm: fix typo in label-size definition
  2018-04-30 11:38   ` [Qemu-devel] " Stefan Hajnoczi
@ 2018-05-03 22:20     ` Ross Zwisler
  -1 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-05-03 22:20 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Eduardo Habkost, linux-nvdimm, Michael S . Tsirkin, qemu-devel

On Mon, Apr 30, 2018 at 12:38:58PM +0100, Stefan Hajnoczi wrote:
> On Fri, Apr 27, 2018 at 03:53:12PM -0600, Ross Zwisler wrote:
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> > Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> >  hw/mem/nvdimm.c         | 2 +-
> >  include/hw/mem/nvdimm.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Thank you for the review.

This is my first QEMU submission - do I need to do anything else to get this
merged (create a pull request somewhere), or do I just wait for a maintainer
to pull it in?

Thanks,
- Ross
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] nvdimm: fix typo in label-size definition
@ 2018-05-03 22:20     ` Ross Zwisler
  0 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-05-03 22:20 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Ross Zwisler, Haozhong Zhang, Michael S . Tsirkin,
	Eduardo Habkost, qemu-devel, linux-nvdimm

On Mon, Apr 30, 2018 at 12:38:58PM +0100, Stefan Hajnoczi wrote:
> On Fri, Apr 27, 2018 at 03:53:12PM -0600, Ross Zwisler wrote:
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> > Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> >  hw/mem/nvdimm.c         | 2 +-
> >  include/hw/mem/nvdimm.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Thank you for the review.

This is my first QEMU submission - do I need to do anything else to get this
merged (create a pull request somewhere), or do I just wait for a maintainer
to pull it in?

Thanks,
- Ross

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/3] nvdimm: fix typo in label-size definition
  2018-05-03 22:20     ` [Qemu-devel] " Ross Zwisler
@ 2018-05-04  8:44       ` Stefan Hajnoczi
  -1 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-05-04  8:44 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Eduardo Habkost, linux-nvdimm,
	Michael S . Tsirkin, qemu-devel, Igor Mammedov

[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]

On Thu, May 03, 2018 at 04:20:13PM -0600, Ross Zwisler wrote:
> On Mon, Apr 30, 2018 at 12:38:58PM +0100, Stefan Hajnoczi wrote:
> > On Fri, Apr 27, 2018 at 03:53:12PM -0600, Ross Zwisler wrote:
> > > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > > Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> > > Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> > > Cc: Michael S. Tsirkin <mst@redhat.com>
> > > Cc: Stefan Hajnoczi <stefanha@redhat.com>
> > > ---
> > >  hw/mem/nvdimm.c         | 2 +-
> > >  include/hw/mem/nvdimm.h | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> Thank you for the review.
> 
> This is my first QEMU submission - do I need to do anything else to get this
> merged (create a pull request somewhere), or do I just wait for a maintainer
> to pull it in?

Michael Tsirkin and Igor Mammedov are the maintainers who will review
and merge this series.  You don't need to do anything (I have CCed Igor
now).

Please include a cover letter in a multi-patch series in the future.
This doesn't prevent this patch series from being merged.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] nvdimm: fix typo in label-size definition
@ 2018-05-04  8:44       ` Stefan Hajnoczi
  0 siblings, 0 replies; 26+ messages in thread
From: Stefan Hajnoczi @ 2018-05-04  8:44 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Eduardo Habkost, qemu-devel,
	linux-nvdimm, Igor Mammedov

[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]

On Thu, May 03, 2018 at 04:20:13PM -0600, Ross Zwisler wrote:
> On Mon, Apr 30, 2018 at 12:38:58PM +0100, Stefan Hajnoczi wrote:
> > On Fri, Apr 27, 2018 at 03:53:12PM -0600, Ross Zwisler wrote:
> > > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > > Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> > > Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> > > Cc: Michael S. Tsirkin <mst@redhat.com>
> > > Cc: Stefan Hajnoczi <stefanha@redhat.com>
> > > ---
> > >  hw/mem/nvdimm.c         | 2 +-
> > >  include/hw/mem/nvdimm.h | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> Thank you for the review.
> 
> This is my first QEMU submission - do I need to do anything else to get this
> merged (create a pull request somewhere), or do I just wait for a maintainer
> to pull it in?

Michael Tsirkin and Igor Mammedov are the maintainers who will review
and merge this series.  You don't need to do anything (I have CCed Igor
now).

Please include a cover letter in a multi-patch series in the future.
This doesn't prevent this patch series from being merged.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] nvdimm: fix typo in label-size definition
  2018-04-27 21:53 ` [Qemu-devel] " Ross Zwisler
@ 2018-05-10 13:06   ` Igor Mammedov
  -1 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-10 13:06 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Eduardo Habkost, linux-nvdimm, Michael S . Tsirkin, qemu-devel,
	Stefan Hajnoczi

On Fri, 27 Apr 2018 15:53:12 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/mem/nvdimm.c         | 2 +-
>  include/hw/mem/nvdimm.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index acb656b672..4087aca25e 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -89,7 +89,7 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
>  
>  static void nvdimm_init(Object *obj)
>  {
> -    object_property_add(obj, NVDIMM_LABLE_SIZE_PROP, "int",
> +    object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
>                          nvdimm_get_label_size, nvdimm_set_label_size, NULL,
>                          NULL, NULL);
>      object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
> diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
> index 7fd87c4e1c..74c60332e1 100644
> --- a/include/hw/mem/nvdimm.h
> +++ b/include/hw/mem/nvdimm.h
> @@ -48,7 +48,7 @@
>  #define NVDIMM_GET_CLASS(obj) OBJECT_GET_CLASS(NVDIMMClass, (obj), \
>                                                 TYPE_NVDIMM)
>  
> -#define NVDIMM_LABLE_SIZE_PROP "label-size"
> +#define NVDIMM_LABEL_SIZE_PROP "label-size"
>  #define NVDIMM_UNARMED_PROP    "unarmed"
>  
>  struct NVDIMMDevice {

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] nvdimm: fix typo in label-size definition
@ 2018-05-10 13:06   ` Igor Mammedov
  0 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-10 13:06 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm

On Fri, 27 Apr 2018 15:53:12 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Fixes: commit da6789c27c2e ("nvdimm: add a macro for property "label-size"")
> Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/mem/nvdimm.c         | 2 +-
>  include/hw/mem/nvdimm.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index acb656b672..4087aca25e 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -89,7 +89,7 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
>  
>  static void nvdimm_init(Object *obj)
>  {
> -    object_property_add(obj, NVDIMM_LABLE_SIZE_PROP, "int",
> +    object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
>                          nvdimm_get_label_size, nvdimm_set_label_size, NULL,
>                          NULL, NULL);
>      object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
> diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
> index 7fd87c4e1c..74c60332e1 100644
> --- a/include/hw/mem/nvdimm.h
> +++ b/include/hw/mem/nvdimm.h
> @@ -48,7 +48,7 @@
>  #define NVDIMM_GET_CLASS(obj) OBJECT_GET_CLASS(NVDIMMClass, (obj), \
>                                                 TYPE_NVDIMM)
>  
> -#define NVDIMM_LABLE_SIZE_PROP "label-size"
> +#define NVDIMM_LABEL_SIZE_PROP "label-size"
>  #define NVDIMM_UNARMED_PROP    "unarmed"
>  
>  struct NVDIMMDevice {

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
  2018-04-27 21:53   ` [Qemu-devel] " Ross Zwisler
@ 2018-05-10 13:28     ` Igor Mammedov
  -1 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-10 13:28 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Eduardo Habkost, linux-nvdimm, Michael S . Tsirkin, qemu-devel,
	Stefan Hajnoczi

On Fri, 27 Apr 2018 15:53:14 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> Add a device command line option to allow the user to control the Platform
> Capabilities Structure in the virtualized NFIT.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  docs/nvdimm.txt         | 22 ++++++++++++++++++++++
>  hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
>  hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
>  include/hw/mem/nvdimm.h |  6 ++++++
>  4 files changed, 81 insertions(+), 4 deletions(-)
> 
> diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
> index e903d8bb09..13a2c15b70 100644
> --- a/docs/nvdimm.txt
> +++ b/docs/nvdimm.txt
> @@ -153,3 +153,25 @@ guest NVDIMM region mapping structure.  This unarmed flag indicates
>  guest software that this vNVDIMM device contains a region that cannot
>  accept persistent writes. In result, for example, the guest Linux
>  NVDIMM driver, marks such vNVDIMM device as read-only.
> +
> +Platform Capabilities
> +---------------------
> +
> +ACPI 6.2 Errata A added support for a new Platform Capabilities Structure
> +which allows the platform to communicate what features it supports related to
> +NVDIMM data durability.  Users can provide a capabilities value to a guest via
> +the optional "cap" device command line option:
> +
> + -device nvdimm,id=nvdimm1,memdev=mem1,cap=3
> +
> +As of ACPI 6.2 Errata A, the following values are valid for the bottom two
> +bits:
> +
> +2 - Memory Controller Flush to NVDIMM Durability on Power Loss Capable.
> +3 - CPU Cache Flush to NVDIMM Durability on Power Loss Capable.
> +
> +For a complete list of the flags available please consult the ACPI spec.
> +
> +These platform capabilities apply to the entire virtual platform, so it is
> +recommended that only one "cap" device command option be given per virtual
> +machine.  This value will apply to all NVDIMMs in the virtual platform.
This looks like it should be machine property instead of per device one,
you can get rid of static variable and mismatch check and a weird nvdimm CLI
option that implies that the option is per device.

Also an extra patch to for make check that will test setting 'cap'
would be nice (an extra testcase in tests/bios-tables-test.c)

> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
> index 859b390e07..375237c96c 100644
> --- a/hw/acpi/nvdimm.c
> +++ b/hw/acpi/nvdimm.c
> @@ -370,7 +370,7 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
>   * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
>   */
>  static void
> -nvdimm_build_structure_caps(GArray *structures)
> +nvdimm_build_structure_caps(GArray *structures, uint32_t capabilities)
>  {
>      NvdimmNfitPlatformCaps *nfit_caps;
>  
> @@ -378,13 +378,31 @@ nvdimm_build_structure_caps(GArray *structures)
>  
>      nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
>      nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
> -    nfit_caps->highest_cap = 1;
> -    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
> +    nfit_caps->highest_cap = 2;
> +    nfit_caps->capabilities = cpu_to_le32(capabilities);
>  }
> +
> +static uint32_t nvdimm_get_capabilities(DeviceState *dev)
> +{
> +    static uint32_t capabilities = 0;
> +    uint32_t this_cap = object_property_get_uint(OBJECT(dev),
> +                                            NVDIMM_CAPABILITIES_PROP, NULL);
> +
> +    if (this_cap && !capabilities)
> +        capabilities = this_cap;
> +
> +    if (this_cap && this_cap != capabilities)
> +        nvdimm_debug("WARNING: multiple capabilities (%d and %d) defined\n",
> +                this_cap, capabilities);
> +
> +    return capabilities;
> +}
> +
>  static GArray *nvdimm_build_device_structure(void)
>  {
>      GSList *device_list = nvdimm_get_device_list();
>      GArray *structures = g_array_new(false, true /* clear */, 1);
> +    uint32_t capabilities = 0;
>  
>      for (; device_list; device_list = device_list->next) {
>          DeviceState *dev = device_list->data;
> @@ -400,10 +418,13 @@ static GArray *nvdimm_build_device_structure(void)
>  
>          /* build NVDIMM Control Region Structure. */
>          nvdimm_build_structure_dcr(structures, dev);
> +
> +        capabilities = nvdimm_get_capabilities(dev);
>      }
>      g_slist_free(device_list);
>  
> -    nvdimm_build_structure_caps(structures);
> +    if (capabilities)
> +        nvdimm_build_structure_caps(structures, capabilities);
>  
>      return structures;
>  }
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index 4087aca25e..923364e190 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -87,6 +87,31 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
>      error_propagate(errp, local_err);
>  }
>  
> +static void nvdimm_get_capabilities(Object *obj, Visitor *v, const char *name,
> +                                  void *opaque, Error **errp)
> +{
> +    NVDIMMDevice *nvdimm = NVDIMM(obj);
> +    uint32_t value = nvdimm->capabilities;
> +
> +    visit_type_uint32(v, name, &value, errp);
> +}
> +
> +static void nvdimm_set_capabilities(Object *obj, Visitor *v, const char *name,
> +                                  void *opaque, Error **errp)
> +{
> +    NVDIMMDevice *nvdimm = NVDIMM(obj);
> +    Error *local_err = NULL;
> +    uint32_t value;
> +
> +    visit_type_uint32(v, name, &value, &local_err);
> +    if (local_err)
> +        goto out;
> +
> +    nvdimm->capabilities = value;
> +out:
> +    error_propagate(errp, local_err);
> +}
> +
>  static void nvdimm_init(Object *obj)
>  {
>      object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
> @@ -94,6 +119,9 @@ static void nvdimm_init(Object *obj)
>                          NULL, NULL);
>      object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
>                               nvdimm_get_unarmed, nvdimm_set_unarmed, NULL);
> +    object_property_add(obj, NVDIMM_CAPABILITIES_PROP, "uint32",
> +                        nvdimm_get_capabilities, nvdimm_set_capabilities,
> +                        NULL, NULL, NULL);
>  }
>  
>  static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)
> diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
> index 74c60332e1..68af64ff46 100644
> --- a/include/hw/mem/nvdimm.h
> +++ b/include/hw/mem/nvdimm.h
> @@ -50,6 +50,7 @@
>  
>  #define NVDIMM_LABEL_SIZE_PROP "label-size"
>  #define NVDIMM_UNARMED_PROP    "unarmed"
> +#define NVDIMM_CAPABILITIES_PROP "cap"
>  
>  struct NVDIMMDevice {
>      /* private */
> @@ -83,6 +84,11 @@ struct NVDIMMDevice {
>       * the guest write persistence.
>       */
>      bool unarmed;
> +
> +    /*
> +     * Platform capabilities, section 5.2.25.9 of ACPI 6.2 Errata A
> +     */
> +    uint32_t capabilities;
>  };
>  typedef struct NVDIMMDevice NVDIMMDevice;
>  

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
@ 2018-05-10 13:28     ` Igor Mammedov
  0 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-10 13:28 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm

On Fri, 27 Apr 2018 15:53:14 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> Add a device command line option to allow the user to control the Platform
> Capabilities Structure in the virtualized NFIT.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  docs/nvdimm.txt         | 22 ++++++++++++++++++++++
>  hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
>  hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
>  include/hw/mem/nvdimm.h |  6 ++++++
>  4 files changed, 81 insertions(+), 4 deletions(-)
> 
> diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
> index e903d8bb09..13a2c15b70 100644
> --- a/docs/nvdimm.txt
> +++ b/docs/nvdimm.txt
> @@ -153,3 +153,25 @@ guest NVDIMM region mapping structure.  This unarmed flag indicates
>  guest software that this vNVDIMM device contains a region that cannot
>  accept persistent writes. In result, for example, the guest Linux
>  NVDIMM driver, marks such vNVDIMM device as read-only.
> +
> +Platform Capabilities
> +---------------------
> +
> +ACPI 6.2 Errata A added support for a new Platform Capabilities Structure
> +which allows the platform to communicate what features it supports related to
> +NVDIMM data durability.  Users can provide a capabilities value to a guest via
> +the optional "cap" device command line option:
> +
> + -device nvdimm,id=nvdimm1,memdev=mem1,cap=3
> +
> +As of ACPI 6.2 Errata A, the following values are valid for the bottom two
> +bits:
> +
> +2 - Memory Controller Flush to NVDIMM Durability on Power Loss Capable.
> +3 - CPU Cache Flush to NVDIMM Durability on Power Loss Capable.
> +
> +For a complete list of the flags available please consult the ACPI spec.
> +
> +These platform capabilities apply to the entire virtual platform, so it is
> +recommended that only one "cap" device command option be given per virtual
> +machine.  This value will apply to all NVDIMMs in the virtual platform.
This looks like it should be machine property instead of per device one,
you can get rid of static variable and mismatch check and a weird nvdimm CLI
option that implies that the option is per device.

Also an extra patch to for make check that will test setting 'cap'
would be nice (an extra testcase in tests/bios-tables-test.c)

> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
> index 859b390e07..375237c96c 100644
> --- a/hw/acpi/nvdimm.c
> +++ b/hw/acpi/nvdimm.c
> @@ -370,7 +370,7 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
>   * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
>   */
>  static void
> -nvdimm_build_structure_caps(GArray *structures)
> +nvdimm_build_structure_caps(GArray *structures, uint32_t capabilities)
>  {
>      NvdimmNfitPlatformCaps *nfit_caps;
>  
> @@ -378,13 +378,31 @@ nvdimm_build_structure_caps(GArray *structures)
>  
>      nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
>      nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
> -    nfit_caps->highest_cap = 1;
> -    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
> +    nfit_caps->highest_cap = 2;
> +    nfit_caps->capabilities = cpu_to_le32(capabilities);
>  }
> +
> +static uint32_t nvdimm_get_capabilities(DeviceState *dev)
> +{
> +    static uint32_t capabilities = 0;
> +    uint32_t this_cap = object_property_get_uint(OBJECT(dev),
> +                                            NVDIMM_CAPABILITIES_PROP, NULL);
> +
> +    if (this_cap && !capabilities)
> +        capabilities = this_cap;
> +
> +    if (this_cap && this_cap != capabilities)
> +        nvdimm_debug("WARNING: multiple capabilities (%d and %d) defined\n",
> +                this_cap, capabilities);
> +
> +    return capabilities;
> +}
> +
>  static GArray *nvdimm_build_device_structure(void)
>  {
>      GSList *device_list = nvdimm_get_device_list();
>      GArray *structures = g_array_new(false, true /* clear */, 1);
> +    uint32_t capabilities = 0;
>  
>      for (; device_list; device_list = device_list->next) {
>          DeviceState *dev = device_list->data;
> @@ -400,10 +418,13 @@ static GArray *nvdimm_build_device_structure(void)
>  
>          /* build NVDIMM Control Region Structure. */
>          nvdimm_build_structure_dcr(structures, dev);
> +
> +        capabilities = nvdimm_get_capabilities(dev);
>      }
>      g_slist_free(device_list);
>  
> -    nvdimm_build_structure_caps(structures);
> +    if (capabilities)
> +        nvdimm_build_structure_caps(structures, capabilities);
>  
>      return structures;
>  }
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index 4087aca25e..923364e190 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -87,6 +87,31 @@ static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
>      error_propagate(errp, local_err);
>  }
>  
> +static void nvdimm_get_capabilities(Object *obj, Visitor *v, const char *name,
> +                                  void *opaque, Error **errp)
> +{
> +    NVDIMMDevice *nvdimm = NVDIMM(obj);
> +    uint32_t value = nvdimm->capabilities;
> +
> +    visit_type_uint32(v, name, &value, errp);
> +}
> +
> +static void nvdimm_set_capabilities(Object *obj, Visitor *v, const char *name,
> +                                  void *opaque, Error **errp)
> +{
> +    NVDIMMDevice *nvdimm = NVDIMM(obj);
> +    Error *local_err = NULL;
> +    uint32_t value;
> +
> +    visit_type_uint32(v, name, &value, &local_err);
> +    if (local_err)
> +        goto out;
> +
> +    nvdimm->capabilities = value;
> +out:
> +    error_propagate(errp, local_err);
> +}
> +
>  static void nvdimm_init(Object *obj)
>  {
>      object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
> @@ -94,6 +119,9 @@ static void nvdimm_init(Object *obj)
>                          NULL, NULL);
>      object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
>                               nvdimm_get_unarmed, nvdimm_set_unarmed, NULL);
> +    object_property_add(obj, NVDIMM_CAPABILITIES_PROP, "uint32",
> +                        nvdimm_get_capabilities, nvdimm_set_capabilities,
> +                        NULL, NULL, NULL);
>  }
>  
>  static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)
> diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
> index 74c60332e1..68af64ff46 100644
> --- a/include/hw/mem/nvdimm.h
> +++ b/include/hw/mem/nvdimm.h
> @@ -50,6 +50,7 @@
>  
>  #define NVDIMM_LABEL_SIZE_PROP "label-size"
>  #define NVDIMM_UNARMED_PROP    "unarmed"
> +#define NVDIMM_CAPABILITIES_PROP "cap"
>  
>  struct NVDIMMDevice {
>      /* private */
> @@ -83,6 +84,11 @@ struct NVDIMMDevice {
>       * the guest write persistence.
>       */
>      bool unarmed;
> +
> +    /*
> +     * Platform capabilities, section 5.2.25.9 of ACPI 6.2 Errata A
> +     */
> +    uint32_t capabilities;
>  };
>  typedef struct NVDIMMDevice NVDIMMDevice;
>  

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
  2018-04-27 21:53   ` [Qemu-devel] " Ross Zwisler
@ 2018-05-10 13:39     ` Igor Mammedov
  -1 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-10 13:39 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Eduardo Habkost, linux-nvdimm, Michael S . Tsirkin, qemu-devel,
	Stefan Hajnoczi

On Fri, 27 Apr 2018 15:53:13 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> Add support for the NFIT Platform Capabilities Structure, newly added in
> ACPI 6.2 Errata A.

Look fine but I'd squash it into the next 3/3 patch.

> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
> index 59d6e4254c..859b390e07 100644
> --- a/hw/acpi/nvdimm.c
> +++ b/hw/acpi/nvdimm.c
> @@ -169,6 +169,21 @@ struct NvdimmNfitControlRegion {
>  } QEMU_PACKED;
>  typedef struct NvdimmNfitControlRegion NvdimmNfitControlRegion;
>  
> +/*
> + * NVDIMM Platform Capabilities Structure
> + *
> + * Defined in section 5.2.25.9 of ACPI 6.2 Errata A, September 2017
> + */
> +struct NvdimmNfitPlatformCaps {
> +    uint16_t type;
> +    uint16_t length;
> +    uint8_t highest_cap;
> +    uint8_t reserved[3];
> +    uint32_t capabilities;
> +    uint8_t reserved2[4];
> +} QEMU_PACKED;
> +typedef struct NvdimmNfitPlatformCaps NvdimmNfitPlatformCaps;
> +
>  /*
>   * Module serial number is a unique number for each device. We use the
>   * slot id of NVDIMM device to generate this number so that each device
> @@ -351,6 +366,21 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
>                                           JEDEC Annex L Release 3. */);
>  }
>  
> +/*
> + * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
> + */
> +static void
> +nvdimm_build_structure_caps(GArray *structures)
> +{
> +    NvdimmNfitPlatformCaps *nfit_caps;
> +
> +    nfit_caps = acpi_data_push(structures, sizeof(*nfit_caps));
> +
> +    nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
> +    nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
> +    nfit_caps->highest_cap = 1;
> +    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
> +}
>  static GArray *nvdimm_build_device_structure(void)
>  {
>      GSList *device_list = nvdimm_get_device_list();
> @@ -373,6 +403,8 @@ static GArray *nvdimm_build_device_structure(void)
>      }
>      g_slist_free(device_list);
>  
> +    nvdimm_build_structure_caps(structures);
> +
>      return structures;
>  }
>  

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
@ 2018-05-10 13:39     ` Igor Mammedov
  0 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-10 13:39 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm

On Fri, 27 Apr 2018 15:53:13 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> Add support for the NFIT Platform Capabilities Structure, newly added in
> ACPI 6.2 Errata A.

Look fine but I'd squash it into the next 3/3 patch.

> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
> index 59d6e4254c..859b390e07 100644
> --- a/hw/acpi/nvdimm.c
> +++ b/hw/acpi/nvdimm.c
> @@ -169,6 +169,21 @@ struct NvdimmNfitControlRegion {
>  } QEMU_PACKED;
>  typedef struct NvdimmNfitControlRegion NvdimmNfitControlRegion;
>  
> +/*
> + * NVDIMM Platform Capabilities Structure
> + *
> + * Defined in section 5.2.25.9 of ACPI 6.2 Errata A, September 2017
> + */
> +struct NvdimmNfitPlatformCaps {
> +    uint16_t type;
> +    uint16_t length;
> +    uint8_t highest_cap;
> +    uint8_t reserved[3];
> +    uint32_t capabilities;
> +    uint8_t reserved2[4];
> +} QEMU_PACKED;
> +typedef struct NvdimmNfitPlatformCaps NvdimmNfitPlatformCaps;
> +
>  /*
>   * Module serial number is a unique number for each device. We use the
>   * slot id of NVDIMM device to generate this number so that each device
> @@ -351,6 +366,21 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
>                                           JEDEC Annex L Release 3. */);
>  }
>  
> +/*
> + * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
> + */
> +static void
> +nvdimm_build_structure_caps(GArray *structures)
> +{
> +    NvdimmNfitPlatformCaps *nfit_caps;
> +
> +    nfit_caps = acpi_data_push(structures, sizeof(*nfit_caps));
> +
> +    nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
> +    nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
> +    nfit_caps->highest_cap = 1;
> +    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
> +}
>  static GArray *nvdimm_build_device_structure(void)
>  {
>      GSList *device_list = nvdimm_get_device_list();
> @@ -373,6 +403,8 @@ static GArray *nvdimm_build_device_structure(void)
>      }
>      g_slist_free(device_list);
>  
> +    nvdimm_build_structure_caps(structures);
> +
>      return structures;
>  }
>  

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
  2018-05-10 13:28     ` Igor Mammedov
@ 2018-05-15 23:03       ` Ross Zwisler
  -1 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-05-15 23:03 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Eduardo Habkost, Michael S . Tsirkin, linux-nvdimm, qemu-devel,
	Stefan Hajnoczi

On Thu, May 10, 2018 at 03:28:48PM +0200, Igor Mammedov wrote:
> On Fri, 27 Apr 2018 15:53:14 -0600
> Ross Zwisler <ross.zwisler@linux.intel.com> wrote:
> 
> > Add a device command line option to allow the user to control the Platform
> > Capabilities Structure in the virtualized NFIT.
> > 
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > ---
> >  docs/nvdimm.txt         | 22 ++++++++++++++++++++++
> >  hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
> >  hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
> >  include/hw/mem/nvdimm.h |  6 ++++++
> >  4 files changed, 81 insertions(+), 4 deletions(-)
> > 
> > diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
> > index e903d8bb09..13a2c15b70 100644
> > --- a/docs/nvdimm.txt
> > +++ b/docs/nvdimm.txt
> > @@ -153,3 +153,25 @@ guest NVDIMM region mapping structure.  This unarmed flag indicates
> >  guest software that this vNVDIMM device contains a region that cannot
> >  accept persistent writes. In result, for example, the guest Linux
> >  NVDIMM driver, marks such vNVDIMM device as read-only.
> > +
> > +Platform Capabilities
> > +---------------------
> > +
> > +ACPI 6.2 Errata A added support for a new Platform Capabilities Structure
> > +which allows the platform to communicate what features it supports related to
> > +NVDIMM data durability.  Users can provide a capabilities value to a guest via
> > +the optional "cap" device command line option:
> > +
> > + -device nvdimm,id=nvdimm1,memdev=mem1,cap=3
> > +
> > +As of ACPI 6.2 Errata A, the following values are valid for the bottom two
> > +bits:
> > +
> > +2 - Memory Controller Flush to NVDIMM Durability on Power Loss Capable.
> > +3 - CPU Cache Flush to NVDIMM Durability on Power Loss Capable.
> > +
> > +For a complete list of the flags available please consult the ACPI spec.
> > +
> > +These platform capabilities apply to the entire virtual platform, so it is
> > +recommended that only one "cap" device command option be given per virtual
> > +machine.  This value will apply to all NVDIMMs in the virtual platform.
> This looks like it should be machine property instead of per device one,
> you can get rid of static variable and mismatch check and a weird nvdimm CLI
> option that implies that the option is per device.

Yep, that's much better.  I have this implemented and ready to go.

> Also an extra patch to for make check that will test setting 'cap'
> would be nice (an extra testcase in tests/bios-tables-test.c)

Hmm...I've been looking at this, and it doesn't look like there is any
verification around a lot of the ACPI tables (NFIT, SRAT, etc).

I've verified my patch by interacting with a guest with various settings - is
this good enough, or do you really want me to test the value (which I think
would just be "do I get out what I put in at the command line") via the unit
test infrastructure?

Thank you for the review.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
@ 2018-05-15 23:03       ` Ross Zwisler
  0 siblings, 0 replies; 26+ messages in thread
From: Ross Zwisler @ 2018-05-15 23:03 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Ross Zwisler, Haozhong Zhang, Michael S . Tsirkin,
	Stefan Hajnoczi, Eduardo Habkost, qemu-devel, linux-nvdimm

On Thu, May 10, 2018 at 03:28:48PM +0200, Igor Mammedov wrote:
> On Fri, 27 Apr 2018 15:53:14 -0600
> Ross Zwisler <ross.zwisler@linux.intel.com> wrote:
> 
> > Add a device command line option to allow the user to control the Platform
> > Capabilities Structure in the virtualized NFIT.
> > 
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > ---
> >  docs/nvdimm.txt         | 22 ++++++++++++++++++++++
> >  hw/acpi/nvdimm.c        | 29 +++++++++++++++++++++++++----
> >  hw/mem/nvdimm.c         | 28 ++++++++++++++++++++++++++++
> >  include/hw/mem/nvdimm.h |  6 ++++++
> >  4 files changed, 81 insertions(+), 4 deletions(-)
> > 
> > diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
> > index e903d8bb09..13a2c15b70 100644
> > --- a/docs/nvdimm.txt
> > +++ b/docs/nvdimm.txt
> > @@ -153,3 +153,25 @@ guest NVDIMM region mapping structure.  This unarmed flag indicates
> >  guest software that this vNVDIMM device contains a region that cannot
> >  accept persistent writes. In result, for example, the guest Linux
> >  NVDIMM driver, marks such vNVDIMM device as read-only.
> > +
> > +Platform Capabilities
> > +---------------------
> > +
> > +ACPI 6.2 Errata A added support for a new Platform Capabilities Structure
> > +which allows the platform to communicate what features it supports related to
> > +NVDIMM data durability.  Users can provide a capabilities value to a guest via
> > +the optional "cap" device command line option:
> > +
> > + -device nvdimm,id=nvdimm1,memdev=mem1,cap=3
> > +
> > +As of ACPI 6.2 Errata A, the following values are valid for the bottom two
> > +bits:
> > +
> > +2 - Memory Controller Flush to NVDIMM Durability on Power Loss Capable.
> > +3 - CPU Cache Flush to NVDIMM Durability on Power Loss Capable.
> > +
> > +For a complete list of the flags available please consult the ACPI spec.
> > +
> > +These platform capabilities apply to the entire virtual platform, so it is
> > +recommended that only one "cap" device command option be given per virtual
> > +machine.  This value will apply to all NVDIMMs in the virtual platform.
> This looks like it should be machine property instead of per device one,
> you can get rid of static variable and mismatch check and a weird nvdimm CLI
> option that implies that the option is per device.

Yep, that's much better.  I have this implemented and ready to go.

> Also an extra patch to for make check that will test setting 'cap'
> would be nice (an extra testcase in tests/bios-tables-test.c)

Hmm...I've been looking at this, and it doesn't look like there is any
verification around a lot of the ACPI tables (NFIT, SRAT, etc).

I've verified my patch by interacting with a guest with various settings - is
this good enough, or do you really want me to test the value (which I think
would just be "do I get out what I put in at the command line") via the unit
test infrastructure?

Thank you for the review.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
  2018-05-15 23:03       ` Ross Zwisler
@ 2018-05-16  7:22         ` Igor Mammedov
  -1 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-16  7:22 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Eduardo Habkost, linux-nvdimm, Michael S . Tsirkin, qemu-devel,
	Stefan Hajnoczi

On Tue, 15 May 2018 17:03:51 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> On Thu, May 10, 2018 at 03:28:48PM +0200, Igor Mammedov wrote:
[...]
> 
> > Also an extra patch to for make check that will test setting 'cap'
> > would be nice (an extra testcase in tests/bios-tables-test.c)  
> 
> Hmm...I've been looking at this, and it doesn't look like there is any
> verification around a lot of the ACPI tables (NFIT, SRAT, etc).
as far as I recall NFIT and SRAT are verified against expected template
(limited but at least something)

Following commits can serve as an example:
 e0e5c85 test/acpi-test-data: add ACPI tables for dimmpxm test
 adae91c tests/bios-tables-test: add test cases for DIMM proximity

> I've verified my patch by interacting with a guest with various settings - is
> this good enough, or do you really want me to test the value (which I think
> would just be "do I get out what I put in at the command line") via the unit
> test infrastructure?
It would be better to add test especially for a new code.
The reason for it is to catch regressions down the road,
it also makes easier for maintainer to review/test series.

> Thank you for the review.

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] nvdimm: platform capabilities command line option
@ 2018-05-16  7:22         ` Igor Mammedov
  0 siblings, 0 replies; 26+ messages in thread
From: Igor Mammedov @ 2018-05-16  7:22 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Haozhong Zhang, Michael S . Tsirkin, Stefan Hajnoczi,
	Eduardo Habkost, qemu-devel, linux-nvdimm

On Tue, 15 May 2018 17:03:51 -0600
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:

> On Thu, May 10, 2018 at 03:28:48PM +0200, Igor Mammedov wrote:
[...]
> 
> > Also an extra patch to for make check that will test setting 'cap'
> > would be nice (an extra testcase in tests/bios-tables-test.c)  
> 
> Hmm...I've been looking at this, and it doesn't look like there is any
> verification around a lot of the ACPI tables (NFIT, SRAT, etc).
as far as I recall NFIT and SRAT are verified against expected template
(limited but at least something)

Following commits can serve as an example:
 e0e5c85 test/acpi-test-data: add ACPI tables for dimmpxm test
 adae91c tests/bios-tables-test: add test cases for DIMM proximity

> I've verified my patch by interacting with a guest with various settings - is
> this good enough, or do you really want me to test the value (which I think
> would just be "do I get out what I put in at the command line") via the unit
> test infrastructure?
It would be better to add test especially for a new code.
The reason for it is to catch regressions down the road,
it also makes easier for maintainer to review/test series.

> Thank you for the review.

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-05-16  7:22 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 21:53 [PATCH 1/3] nvdimm: fix typo in label-size definition Ross Zwisler
2018-04-27 21:53 ` [Qemu-devel] " Ross Zwisler
2018-04-27 21:53 ` [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities Ross Zwisler
2018-04-27 21:53   ` [Qemu-devel] " Ross Zwisler
2018-04-30 11:39   ` Stefan Hajnoczi
2018-04-30 11:39     ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10 13:39   ` Igor Mammedov
2018-05-10 13:39     ` Igor Mammedov
2018-04-27 21:53 ` [PATCH 3/3] nvdimm: platform capabilities command line option Ross Zwisler
2018-04-27 21:53   ` [Qemu-devel] " Ross Zwisler
2018-04-30 11:39   ` Stefan Hajnoczi
2018-04-30 11:39     ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10 13:28   ` Igor Mammedov
2018-05-10 13:28     ` Igor Mammedov
2018-05-15 23:03     ` Ross Zwisler
2018-05-15 23:03       ` Ross Zwisler
2018-05-16  7:22       ` Igor Mammedov
2018-05-16  7:22         ` Igor Mammedov
2018-04-30 11:38 ` [PATCH 1/3] nvdimm: fix typo in label-size definition Stefan Hajnoczi
2018-04-30 11:38   ` [Qemu-devel] " Stefan Hajnoczi
2018-05-03 22:20   ` Ross Zwisler
2018-05-03 22:20     ` [Qemu-devel] " Ross Zwisler
2018-05-04  8:44     ` Stefan Hajnoczi
2018-05-04  8:44       ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10 13:06 ` Igor Mammedov
2018-05-10 13:06   ` Igor Mammedov

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.