From: David Gibson <david@gibson.dropbear.id.au>
To: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Cc: qemu-devel@nongnu.org, imammedo@redhat.com, qemu-ppc@nongnu.org,
xiaoguangrong.eric@gmail.com, mst@redhat.com
Subject: Re: [PATCH v4 2/4] nvdimm: add uuid property to nvdimm
Date: Mon, 23 Dec 2019 15:33:39 +1100 [thread overview]
Message-ID: <20191223043339.GB38380@umbus.modem> (raw)
In-Reply-To: <157657250781.53829.2713365565241605642.stgit@lep8c.aus.stglabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3350 bytes --]
On Tue, Dec 17, 2019 at 02:48:49AM -0600, Shivaprasad G Bhat 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 375f9a588a..e1238b5bed 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,
> + 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:[~2019-12-23 4:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 8:47 [PATCH v4 0/4] ppc: spapr: virtual NVDIMM support Shivaprasad G Bhat
2019-12-17 8:48 ` [PATCH v4 1/4] mem: move nvdimm_device_list to utilities Shivaprasad G Bhat
2019-12-23 4:31 ` David Gibson
2019-12-17 8:48 ` [PATCH v4 2/4] nvdimm: add uuid property to nvdimm Shivaprasad G Bhat
2019-12-23 4:33 ` David Gibson [this message]
2019-12-17 8:49 ` [PATCH v4 3/4] spapr: Add NVDIMM device support Shivaprasad G Bhat
2020-01-03 1:20 ` David Gibson
2020-01-30 11:44 ` Shivaprasad G Bhat
2019-12-17 8:49 ` [PATCH v4 4/4] spapr: Add Hcalls to support PAPR NVDIMM device Shivaprasad G Bhat
2020-01-03 1:44 ` David Gibson
2020-01-30 11:46 ` Shivaprasad G Bhat
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=20191223043339.GB38380@umbus.modem \
--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=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).