Re: [Qemu-devel] [RFC v2 PATCH 2/3] spapr: Add NVDIMM device support

2019-07-16 Thread Shivaprasad G Bhat

Hi Fabiano,


On 05/22/2019 09:37 PM, Fabiano Rosas wrote:

Shivaprasad G Bhat  writes:


+/* Create DT entries for cold plugged NVDIMM devices */
+dimms = nvdimm_get_device_list();
+for (; dimms; dimms = dimms->next) {
+NVDIMMDevice *nvdimm = dimms->data;
+
+spapr_populate_nvdimm_node(fdt, offset, nvdimm);
+}
+g_slist_free(dimms);

To free the whole list you'll need another variable in the loop above,
right?


Nope. TheĀ  g_slist_free() takes care of freeing the list node pointers.

As I am iterating using the original dimms variable, I would still not
be freeing the list here though, fixing that in next version.

Valgrind pointed out few more leaks in many places, will fix them all.



Cheers





Re: [Qemu-devel] [RFC v2 PATCH 2/3] spapr: Add NVDIMM device support

2019-05-22 Thread Fabiano Rosas
Shivaprasad G Bhat  writes:

> +/* Create DT entries for cold plugged NVDIMM devices */
> +dimms = nvdimm_get_device_list();
> +for (; dimms; dimms = dimms->next) {
> +NVDIMMDevice *nvdimm = dimms->data;
> +
> +spapr_populate_nvdimm_node(fdt, offset, nvdimm);
> +}
> +g_slist_free(dimms);

To free the whole list you'll need another variable in the loop above,
right?

Cheers




Re: [Qemu-devel] [RFC v2 PATCH 2/3] spapr: Add NVDIMM device support

2019-05-17 Thread Shivaprasad G Bhat




On 05/16/2019 07:02 AM, David Gibson wrote:

On Wed, May 15, 2019 at 12:30:07PM +0530, Shivaprasad G Bhat wrote:

Hi David,

Thanks for the comments. Replies inline..

On 05/14/2019 07:52 AM, David Gibson wrote:

On Mon, May 13, 2019 at 04:28:02AM -0500, Shivaprasad G Bhat wrote:

Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
device interface in QEMU to support virtual NVDIMM devices for Power (May have
to re-look at this later).  Create the required DT entries for the
device (some entries have dummy values right now).

The patch creates the required DT node and sends a hotplug
interrupt to the guest. Guest is expected to undertake the normal
DR resource add path in response and start issuing PAPR SCM hcalls.

This is how it can be used ..
Add nvdimm=on to the qemu machine argument.
Ex : -machine pseries,nvdimm=on
For coldplug, the device to be added in qemu command line as shown below
-object 
memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
-device 
nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0

For hotplug, the device to be added from monitor as below
object_add 
memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
device_add 
nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0

Signed-off-by: Shivaprasad G Bhat 
Signed-off-by: Bharata B Rao 
 [Early implementation]
---
---
   default-configs/ppc64-softmmu.mak |1
   hw/mem/Kconfig|2
   hw/mem/nvdimm.c   |   43 
   hw/ppc/spapr.c|  202 
+++--
   hw/ppc/spapr_drc.c|   18 +++
   hw/ppc/spapr_events.c |4 +
   include/hw/mem/nvdimm.h   |6 +
   include/hw/ppc/spapr.h|   12 ++
   include/hw/ppc/spapr_drc.h|9 ++
   9 files changed, 286 insertions(+), 11 deletions(-)

diff --git a/default-configs/ppc64-softmmu.mak 
b/default-configs/ppc64-softmmu.mak
index cca52665d9..ae0841fa3a 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -8,3 +8,4 @@ CONFIG_POWERNV=y
   # For pSeries
   CONFIG_PSERIES=y
+CONFIG_NVDIMM=y
diff --git a/hw/mem/Kconfig b/hw/mem/Kconfig
index 620fd4cb59..2ad052a536 100644
--- a/hw/mem/Kconfig
+++ b/hw/mem/Kconfig
@@ -8,4 +8,4 @@ config MEM_DEVICE
   config NVDIMM
   bool
   default y
-depends on PC
+depends on (PC || PSERIES)
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index f221ec7a9a..deaeb5 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -93,11 +93,54 @@ out:
   error_propagate(errp, local_err);
   }
+static void nvdimm_get_uuid(Object *obj, Visitor *v, const char *name,
+  void *opaque, Error **errp)
+{
+NVDIMMDevice *nvdimm = NVDIMM(obj);
+char *value = NULL;
+
+value = qemu_uuid_unparse_strdup(>uuid);
+
+visit_type_str(v, name, , errp);
+}
+
+
+static void nvdimm_set_uuid(Object *obj, Visitor *v, const char *name,
+  void *opaque, Error **errp)
+{
+NVDIMMDevice *nvdimm = NVDIMM(obj);
+Error *local_err = NULL;
+char *value;
+
+visit_type_str(v, name, , _err);
+if (local_err) {
+goto out;
+}
+
+if (strcmp(value, "") == 0) {
+error_setg(_err, "Property '%s.%s' %s is required"
+   " at least 0x%lx", object_get_typename(obj),
+   name, value, MIN_NAMESPACE_LABEL_SIZE);
+goto out;
+}
+
+if (qemu_uuid_parse(value, >uuid) != 0) {
+error_setg(errp, "Invalid UUID");
+return;
+}
+out:
+error_propagate(errp, local_err);
+}
+
+
   static void nvdimm_init(Object *obj)
   {
   object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
   nvdimm_get_label_size, nvdimm_set_label_size, NULL,
   NULL, NULL);
+
+object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid,
+nvdimm_set_uuid, NULL, NULL, NULL);
   }
   static void nvdimm_finalize(Object *obj)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 2ef3ce4362..b6951577e7 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -74,6 +74,7 @@
   #include "qemu/cutils.h"
   #include "hw/ppc/spapr_cpu_core.h"
   #include "hw/mem/memory-device.h"
+#include "hw/mem/nvdimm.h"
   #include 
@@ -699,6 +700,7 @@ static int spapr_populate_drmem_v2(SpaprMachineState 
*spapr, void *fdt,
   uint8_t *int_buf, *cur_index;
   int ret;
   uint64_t lmb_size = SPAPR_MEMORY_BLOCK_SIZE;
+uint64_t scm_block_size = SPAPR_MINIMUM_SCM_BLOCK_SIZE;
   uint64_t addr, cur_addr, size;
   uint32_t nr_boot_lmbs = (machine->device_memory->base / lmb_size);
   uint64_t mem_end = machine->device_memory->base +
@@ -735,12 +737,20 @@ static int 

Re: [Qemu-devel] [RFC v2 PATCH 2/3] spapr: Add NVDIMM device support

2019-05-15 Thread David Gibson
On Wed, May 15, 2019 at 12:30:07PM +0530, Shivaprasad G Bhat wrote:
> Hi David,
> 
> Thanks for the comments. Replies inline..
> 
> On 05/14/2019 07:52 AM, David Gibson wrote:
> > On Mon, May 13, 2019 at 04:28:02AM -0500, Shivaprasad G Bhat wrote:
> > > Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
> > > device interface in QEMU to support virtual NVDIMM devices for Power (May 
> > > have
> > > to re-look at this later).  Create the required DT entries for the
> > > device (some entries have dummy values right now).
> > > 
> > > The patch creates the required DT node and sends a hotplug
> > > interrupt to the guest. Guest is expected to undertake the normal
> > > DR resource add path in response and start issuing PAPR SCM hcalls.
> > > 
> > > This is how it can be used ..
> > > Add nvdimm=on to the qemu machine argument.
> > > Ex : -machine pseries,nvdimm=on
> > > For coldplug, the device to be added in qemu command line as shown below
> > > -object 
> > > memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
> > > -device 
> > > nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
> > > 
> > > For hotplug, the device to be added from monitor as below
> > > object_add 
> > > memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
> > > device_add 
> > > nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
> > > 
> > > Signed-off-by: Shivaprasad G Bhat 
> > > Signed-off-by: Bharata B Rao 
> > > [Early implementation]
> > > ---
> > > ---
> > >   default-configs/ppc64-softmmu.mak |1
> > >   hw/mem/Kconfig|2
> > >   hw/mem/nvdimm.c   |   43 
> > >   hw/ppc/spapr.c|  202 
> > > +++--
> > >   hw/ppc/spapr_drc.c|   18 +++
> > >   hw/ppc/spapr_events.c |4 +
> > >   include/hw/mem/nvdimm.h   |6 +
> > >   include/hw/ppc/spapr.h|   12 ++
> > >   include/hw/ppc/spapr_drc.h|9 ++
> > >   9 files changed, 286 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/default-configs/ppc64-softmmu.mak 
> > > b/default-configs/ppc64-softmmu.mak
> > > index cca52665d9..ae0841fa3a 100644
> > > --- a/default-configs/ppc64-softmmu.mak
> > > +++ b/default-configs/ppc64-softmmu.mak
> > > @@ -8,3 +8,4 @@ CONFIG_POWERNV=y
> > >   # For pSeries
> > >   CONFIG_PSERIES=y
> > > +CONFIG_NVDIMM=y
> > > diff --git a/hw/mem/Kconfig b/hw/mem/Kconfig
> > > index 620fd4cb59..2ad052a536 100644
> > > --- a/hw/mem/Kconfig
> > > +++ b/hw/mem/Kconfig
> > > @@ -8,4 +8,4 @@ config MEM_DEVICE
> > >   config NVDIMM
> > >   bool
> > >   default y
> > > -depends on PC
> > > +depends on (PC || PSERIES)
> > > diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> > > index f221ec7a9a..deaeb5 100644
> > > --- a/hw/mem/nvdimm.c
> > > +++ b/hw/mem/nvdimm.c
> > > @@ -93,11 +93,54 @@ out:
> > >   error_propagate(errp, local_err);
> > >   }
> > > +static void nvdimm_get_uuid(Object *obj, Visitor *v, const char *name,
> > > +  void *opaque, Error **errp)
> > > +{
> > > +NVDIMMDevice *nvdimm = NVDIMM(obj);
> > > +char *value = NULL;
> > > +
> > > +value = qemu_uuid_unparse_strdup(>uuid);
> > > +
> > > +visit_type_str(v, name, , errp);
> > > +}
> > > +
> > > +
> > > +static void nvdimm_set_uuid(Object *obj, Visitor *v, const char *name,
> > > +  void *opaque, Error **errp)
> > > +{
> > > +NVDIMMDevice *nvdimm = NVDIMM(obj);
> > > +Error *local_err = NULL;
> > > +char *value;
> > > +
> > > +visit_type_str(v, name, , _err);
> > > +if (local_err) {
> > > +goto out;
> > > +}
> > > +
> > > +if (strcmp(value, "") == 0) {
> > > +error_setg(_err, "Property '%s.%s' %s is required"
> > > +   " at least 0x%lx", object_get_typename(obj),
> > > +   name, value, MIN_NAMESPACE_LABEL_SIZE);
> > > +goto out;
> > > +}
> > > +
> > > +if (qemu_uuid_parse(value, >uuid) != 0) {
> > > +error_setg(errp, "Invalid UUID");
> > > +return;
> > > +}
> > > +out:
> > > +error_propagate(errp, local_err);
> > > +}
> > > +
> > > +
> > >   static void nvdimm_init(Object *obj)
> > >   {
> > >   object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
> > >   nvdimm_get_label_size, nvdimm_set_label_size, 
> > > NULL,
> > >   NULL, NULL);
> > > +
> > > +object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", 
> > > nvdimm_get_uuid,
> > > +nvdimm_set_uuid, NULL, NULL, NULL);
> > >   }
> > >   static void nvdimm_finalize(Object *obj)
> > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > > index 2ef3ce4362..b6951577e7 100644
> > > --- 

Re: [Qemu-devel] [RFC v2 PATCH 2/3] spapr: Add NVDIMM device support

2019-05-15 Thread Shivaprasad G Bhat

Hi David,

Thanks for the comments. Replies inline..

On 05/14/2019 07:52 AM, David Gibson wrote:

On Mon, May 13, 2019 at 04:28:02AM -0500, Shivaprasad G Bhat wrote:

Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
device interface in QEMU to support virtual NVDIMM devices for Power (May have
to re-look at this later).  Create the required DT entries for the
device (some entries have dummy values right now).

The patch creates the required DT node and sends a hotplug
interrupt to the guest. Guest is expected to undertake the normal
DR resource add path in response and start issuing PAPR SCM hcalls.

This is how it can be used ..
Add nvdimm=on to the qemu machine argument.
Ex : -machine pseries,nvdimm=on
For coldplug, the device to be added in qemu command line as shown below
-object 
memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
-device 
nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0

For hotplug, the device to be added from monitor as below
object_add 
memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
device_add 
nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0

Signed-off-by: Shivaprasad G Bhat 
Signed-off-by: Bharata B Rao 
[Early implementation]
---
---
  default-configs/ppc64-softmmu.mak |1
  hw/mem/Kconfig|2
  hw/mem/nvdimm.c   |   43 
  hw/ppc/spapr.c|  202 +++--
  hw/ppc/spapr_drc.c|   18 +++
  hw/ppc/spapr_events.c |4 +
  include/hw/mem/nvdimm.h   |6 +
  include/hw/ppc/spapr.h|   12 ++
  include/hw/ppc/spapr_drc.h|9 ++
  9 files changed, 286 insertions(+), 11 deletions(-)

diff --git a/default-configs/ppc64-softmmu.mak 
b/default-configs/ppc64-softmmu.mak
index cca52665d9..ae0841fa3a 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -8,3 +8,4 @@ CONFIG_POWERNV=y
  
  # For pSeries

  CONFIG_PSERIES=y
+CONFIG_NVDIMM=y
diff --git a/hw/mem/Kconfig b/hw/mem/Kconfig
index 620fd4cb59..2ad052a536 100644
--- a/hw/mem/Kconfig
+++ b/hw/mem/Kconfig
@@ -8,4 +8,4 @@ config MEM_DEVICE
  config NVDIMM
  bool
  default y
-depends on PC
+depends on (PC || PSERIES)
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index f221ec7a9a..deaeb5 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -93,11 +93,54 @@ out:
  error_propagate(errp, local_err);
  }
  
+static void nvdimm_get_uuid(Object *obj, Visitor *v, const char *name,

+  void *opaque, Error **errp)
+{
+NVDIMMDevice *nvdimm = NVDIMM(obj);
+char *value = NULL;
+
+value = qemu_uuid_unparse_strdup(>uuid);
+
+visit_type_str(v, name, , errp);
+}
+
+
+static void nvdimm_set_uuid(Object *obj, Visitor *v, const char *name,
+  void *opaque, Error **errp)
+{
+NVDIMMDevice *nvdimm = NVDIMM(obj);
+Error *local_err = NULL;
+char *value;
+
+visit_type_str(v, name, , _err);
+if (local_err) {
+goto out;
+}
+
+if (strcmp(value, "") == 0) {
+error_setg(_err, "Property '%s.%s' %s is required"
+   " at least 0x%lx", object_get_typename(obj),
+   name, value, MIN_NAMESPACE_LABEL_SIZE);
+goto out;
+}
+
+if (qemu_uuid_parse(value, >uuid) != 0) {
+error_setg(errp, "Invalid UUID");
+return;
+}
+out:
+error_propagate(errp, local_err);
+}
+
+
  static void nvdimm_init(Object *obj)
  {
  object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
  nvdimm_get_label_size, nvdimm_set_label_size, NULL,
  NULL, NULL);
+
+object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid,
+nvdimm_set_uuid, NULL, NULL, NULL);
  }
  
  static void nvdimm_finalize(Object *obj)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 2ef3ce4362..b6951577e7 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -74,6 +74,7 @@
  #include "qemu/cutils.h"
  #include "hw/ppc/spapr_cpu_core.h"
  #include "hw/mem/memory-device.h"
+#include "hw/mem/nvdimm.h"
  
  #include 
  
@@ -699,6 +700,7 @@ static int spapr_populate_drmem_v2(SpaprMachineState *spapr, void *fdt,

  uint8_t *int_buf, *cur_index;
  int ret;
  uint64_t lmb_size = SPAPR_MEMORY_BLOCK_SIZE;
+uint64_t scm_block_size = SPAPR_MINIMUM_SCM_BLOCK_SIZE;
  uint64_t addr, cur_addr, size;
  uint32_t nr_boot_lmbs = (machine->device_memory->base / lmb_size);
  uint64_t mem_end = machine->device_memory->base +
@@ -735,12 +737,20 @@ static int spapr_populate_drmem_v2(SpaprMachineState 
*spapr, void *fdt,
  nr_entries++;
  }
  
-/* Entry for DIMM */

-drc = 

Re: [Qemu-devel] [RFC v2 PATCH 2/3] spapr: Add NVDIMM device support

2019-05-13 Thread David Gibson
On Mon, May 13, 2019 at 04:28:02AM -0500, Shivaprasad G Bhat wrote:
> Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
> device interface in QEMU to support virtual NVDIMM devices for Power (May have
> to re-look at this later).  Create the required DT entries for the
> device (some entries have dummy values right now).
> 
> The patch creates the required DT node and sends a hotplug
> interrupt to the guest. Guest is expected to undertake the normal
> DR resource add path in response and start issuing PAPR SCM hcalls.
> 
> This is how it can be used ..
> Add nvdimm=on to the qemu machine argument.
> Ex : -machine pseries,nvdimm=on
> For coldplug, the device to be added in qemu command line as shown below
> -object 
> memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
> -device 
> nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
> 
> For hotplug, the device to be added from monitor as below
> object_add 
> memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
> device_add 
> nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
> 
> Signed-off-by: Shivaprasad G Bhat 
> Signed-off-by: Bharata B Rao 
>[Early implementation]
> ---
> ---
>  default-configs/ppc64-softmmu.mak |1 
>  hw/mem/Kconfig|2 
>  hw/mem/nvdimm.c   |   43 
>  hw/ppc/spapr.c|  202 
> +++--
>  hw/ppc/spapr_drc.c|   18 +++
>  hw/ppc/spapr_events.c |4 +
>  include/hw/mem/nvdimm.h   |6 +
>  include/hw/ppc/spapr.h|   12 ++
>  include/hw/ppc/spapr_drc.h|9 ++
>  9 files changed, 286 insertions(+), 11 deletions(-)
> 
> diff --git a/default-configs/ppc64-softmmu.mak 
> b/default-configs/ppc64-softmmu.mak
> index cca52665d9..ae0841fa3a 100644
> --- a/default-configs/ppc64-softmmu.mak
> +++ b/default-configs/ppc64-softmmu.mak
> @@ -8,3 +8,4 @@ CONFIG_POWERNV=y
>  
>  # For pSeries
>  CONFIG_PSERIES=y
> +CONFIG_NVDIMM=y
> diff --git a/hw/mem/Kconfig b/hw/mem/Kconfig
> index 620fd4cb59..2ad052a536 100644
> --- a/hw/mem/Kconfig
> +++ b/hw/mem/Kconfig
> @@ -8,4 +8,4 @@ config MEM_DEVICE
>  config NVDIMM
>  bool
>  default y
> -depends on PC
> +depends on (PC || PSERIES)
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index f221ec7a9a..deaeb5 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -93,11 +93,54 @@ out:
>  error_propagate(errp, local_err);
>  }
>  
> +static void nvdimm_get_uuid(Object *obj, Visitor *v, const char *name,
> +  void *opaque, Error **errp)
> +{
> +NVDIMMDevice *nvdimm = NVDIMM(obj);
> +char *value = NULL;
> +
> +value = qemu_uuid_unparse_strdup(>uuid);
> +
> +visit_type_str(v, name, , errp);
> +}
> +
> +
> +static void nvdimm_set_uuid(Object *obj, Visitor *v, const char *name,
> +  void *opaque, Error **errp)
> +{
> +NVDIMMDevice *nvdimm = NVDIMM(obj);
> +Error *local_err = NULL;
> +char *value;
> +
> +visit_type_str(v, name, , _err);
> +if (local_err) {
> +goto out;
> +}
> +
> +if (strcmp(value, "") == 0) {
> +error_setg(_err, "Property '%s.%s' %s is required"
> +   " at least 0x%lx", object_get_typename(obj),
> +   name, value, MIN_NAMESPACE_LABEL_SIZE);
> +goto out;
> +}
> +
> +if (qemu_uuid_parse(value, >uuid) != 0) {
> +error_setg(errp, "Invalid UUID");
> +return;
> +}
> +out:
> +error_propagate(errp, local_err);
> +}
> +
> +
>  static void nvdimm_init(Object *obj)
>  {
>  object_property_add(obj, NVDIMM_LABEL_SIZE_PROP, "int",
>  nvdimm_get_label_size, nvdimm_set_label_size, NULL,
>  NULL, NULL);
> +
> +object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid,
> +nvdimm_set_uuid, NULL, NULL, NULL);
>  }
>  
>  static void nvdimm_finalize(Object *obj)
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 2ef3ce4362..b6951577e7 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -74,6 +74,7 @@
>  #include "qemu/cutils.h"
>  #include "hw/ppc/spapr_cpu_core.h"
>  #include "hw/mem/memory-device.h"
> +#include "hw/mem/nvdimm.h"
>  
>  #include 
>  
> @@ -699,6 +700,7 @@ static int spapr_populate_drmem_v2(SpaprMachineState 
> *spapr, void *fdt,
>  uint8_t *int_buf, *cur_index;
>  int ret;
>  uint64_t lmb_size = SPAPR_MEMORY_BLOCK_SIZE;
> +uint64_t scm_block_size = SPAPR_MINIMUM_SCM_BLOCK_SIZE;
>  uint64_t addr, cur_addr, size;
>  uint32_t nr_boot_lmbs = (machine->device_memory->base / lmb_size);
>  uint64_t mem_end = machine->device_memory->base +
> @@ -735,12 +737,20 @@ static int