From: David Gibson <david@gibson.dropbear.id.au>
To: Igor Mammedov <imammedo@redhat.com>
Cc: xiaoguangrong.eric@gmail.com,
Shivaprasad G Bhat <sbhat@linux.ibm.com>,
mst@redhat.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
sbhat@linux.vnet.ibm.com
Subject: Re: [PATCH v5 2/4] nvdimm: add uuid property to nvdimm
Date: Wed, 5 Feb 2020 11:49:17 +1100 [thread overview]
Message-ID: <20200205004917.GE60221@umbus.fritz.box> (raw)
In-Reply-To: <20200204155523.16d551d5@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3843 bytes --]
On Tue, Feb 04, 2020 at 03:55:23PM +0100, Igor Mammedov wrote:
> On Thu, 30 Jan 2020 05:47:59 -0600
> Shivaprasad G Bhat <sbhat@linux.ibm.com> wrote:
>
> > For ppc64, PAPR requires the nvdimm device to have UUID property
> > set in the device tree. Add an option to get it from the user.
> >
> > Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
> > Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > hw/mem/nvdimm.c | 40 ++++++++++++++++++++++++++++++++++++++++
> > include/hw/mem/nvdimm.h | 7 +++++++
> > 2 files changed, 47 insertions(+)
> >
> > diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> > index 39f1426d1f..8e426d24bb 100644
> > --- a/hw/mem/nvdimm.c
> > +++ b/hw/mem/nvdimm.c
> > @@ -69,11 +69,51 @@ 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(&nvdimm->uuid);
> > +
> > + visit_type_str(v, name, &value, errp);
> > + g_free(value);
> > +}
> > +
> > +
> > +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, &value, &local_err);
> > + if (local_err) {
> > + goto out;
> > + }
> > +
> > + if (qemu_uuid_parse(value, &nvdimm->uuid) != 0) {
> > + error_setg(errp, "Property '%s.%s' has invalid value",
> > + object_get_typename(obj), name);
> > + goto out;
> > + }
> > + g_free(value);
> > +
> > +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,
> why it's named "QemuUUID" and not just "uuid"
I almost got caught by that one. The name is NVDIMM_UUID_PROP, which
is indeed just "uuid". The "QemuUUID" is the property type identifier.
>
>
> > + nvdimm_set_uuid, NULL, NULL, NULL);
> > }
> >
> > static void nvdimm_finalize(Object *obj)
> > diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
> > index 523a9b3d4a..4807ca615b 100644
> > --- a/include/hw/mem/nvdimm.h
> > +++ b/include/hw/mem/nvdimm.h
> > @@ -25,6 +25,7 @@
> >
> > #include "hw/mem/pc-dimm.h"
> > #include "hw/acpi/bios-linker-loader.h"
> > +#include "qemu/uuid.h"
> >
> > #define NVDIMM_DEBUG 0
> > #define nvdimm_debug(fmt, ...) \
> > @@ -49,6 +50,7 @@
> > TYPE_NVDIMM)
> >
> > #define NVDIMM_LABEL_SIZE_PROP "label-size"
> > +#define NVDIMM_UUID_PROP "uuid"
> > #define NVDIMM_UNARMED_PROP "unarmed"
> >
> > struct NVDIMMDevice {
> > @@ -83,6 +85,11 @@ struct NVDIMMDevice {
> > * the guest write persistence.
> > */
> > bool unarmed;
> > +
> > + /*
> > + * The PPC64 - spapr requires each nvdimm device have a uuid.
> > + */
> > + QemuUUID uuid;
> > };
> > typedef struct NVDIMMDevice NVDIMMDevice;
> >
> >
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-02-05 2:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 11:47 [PATCH v5 0/4] ppc: spapr: virtual NVDIMM support Shivaprasad G Bhat
2020-01-30 11:47 ` [PATCH v5 1/4] mem: move nvdimm_device_list to utilities Shivaprasad G Bhat
2020-01-30 11:47 ` [PATCH v5 2/4] nvdimm: add uuid property to nvdimm Shivaprasad G Bhat
2020-02-04 14:55 ` Igor Mammedov
2020-02-05 0:49 ` David Gibson [this message]
2020-02-05 16:57 ` Igor Mammedov
2020-01-30 11:48 ` [PATCH v5 3/4] spapr: Add NVDIMM device support Shivaprasad G Bhat
2020-02-04 3:59 ` David Gibson
2020-02-10 4:55 ` Shivaprasad G Bhat
2020-01-30 11:48 ` [PATCH v5 4/4] spapr: Add Hcalls to support PAPR NVDIMM device Shivaprasad G Bhat
2020-02-04 4:09 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200205004917.GE60221@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sbhat@linux.ibm.com \
--cc=sbhat@linux.vnet.ibm.com \
--cc=xiaoguangrong.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).