From: Igor Mammedov <imammedo@redhat.com>
To: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Cc: xiaoguangrong.eric@gmail.com, mst@redhat.com,
qemu-devel@nongnu.org, sbhat@linux.vnet.ibm.com,
qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Subject: Re: [PATCH v3 1/3] mem: move nvdimm_device_list to utilities
Date: Tue, 19 Nov 2019 08:13:26 +0100 [thread overview]
Message-ID: <20191119081326.275531af@redhat.com> (raw)
In-Reply-To: <157107825148.27733.10924648339824665145.stgit@lep8c.aus.stglabs.ibm.com>
On Mon, 14 Oct 2019 13:37:37 -0500
Shivaprasad G Bhat <sbhat@linux.ibm.com> wrote:
> nvdimm_device_list is required for parsing the list for devices
> in subsequent patches. Move it to common utility area.
>
> Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
> ---
> hw/acpi/nvdimm.c | 28 +---------------------------
> include/qemu/nvdimm-utils.h | 7 +++++++
> util/Makefile.objs | 1 +
> util/nvdimm-utils.c | 29 +++++++++++++++++++++++++++++
instead of creating new file, why not to move it to existing hw/mem/nvdimm.c?
> 4 files changed, 38 insertions(+), 27 deletions(-)
> create mode 100644 include/qemu/nvdimm-utils.h
> create mode 100644 util/nvdimm-utils.c
>
> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
> index 9fdad6dc3f..5219dd0e2e 100644
> --- a/hw/acpi/nvdimm.c
> +++ b/hw/acpi/nvdimm.c
> @@ -32,33 +32,7 @@
> #include "hw/acpi/bios-linker-loader.h"
> #include "hw/nvram/fw_cfg.h"
> #include "hw/mem/nvdimm.h"
> -
> -static int nvdimm_device_list(Object *obj, void *opaque)
> -{
> - GSList **list = opaque;
> -
> - if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
> - *list = g_slist_append(*list, DEVICE(obj));
> - }
> -
> - object_child_foreach(obj, nvdimm_device_list, opaque);
> - return 0;
> -}
> -
> -/*
> - * inquire NVDIMM devices and link them into the list which is
> - * returned to the caller.
> - *
> - * Note: it is the caller's responsibility to free the list to avoid
> - * memory leak.
> - */
> -static GSList *nvdimm_get_device_list(void)
> -{
> - GSList *list = NULL;
> -
> - object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
> - return list;
> -}
> +#include "qemu/nvdimm-utils.h"
>
> #define NVDIMM_UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
> { (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
> diff --git a/include/qemu/nvdimm-utils.h b/include/qemu/nvdimm-utils.h
> new file mode 100644
> index 0000000000..4b8b198ba7
> --- /dev/null
> +++ b/include/qemu/nvdimm-utils.h
> @@ -0,0 +1,7 @@
> +#ifndef NVDIMM_UTILS_H
> +#define NVDIMM_UTILS_H
> +
> +#include "qemu/osdep.h"
> +
> +GSList *nvdimm_get_device_list(void);
> +#endif
> diff --git a/util/Makefile.objs b/util/Makefile.objs
> index 41bf59d127..a0f40d26e3 100644
> --- a/util/Makefile.objs
> +++ b/util/Makefile.objs
> @@ -20,6 +20,7 @@ util-obj-y += envlist.o path.o module.o
> util-obj-y += host-utils.o
> util-obj-y += bitmap.o bitops.o hbitmap.o
> util-obj-y += fifo8.o
> +util-obj-y += nvdimm-utils.o
> util-obj-y += cacheinfo.o
> util-obj-y += error.o qemu-error.o
> util-obj-y += qemu-print.o
> diff --git a/util/nvdimm-utils.c b/util/nvdimm-utils.c
> new file mode 100644
> index 0000000000..5cc768ca47
> --- /dev/null
> +++ b/util/nvdimm-utils.c
> @@ -0,0 +1,29 @@
> +#include "qemu/nvdimm-utils.h"
> +#include "hw/mem/nvdimm.h"
> +
> +static int nvdimm_device_list(Object *obj, void *opaque)
> +{
> + GSList **list = opaque;
> +
> + if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
> + *list = g_slist_append(*list, DEVICE(obj));
> + }
> +
> + object_child_foreach(obj, nvdimm_device_list, opaque);
> + return 0;
> +}
> +
> +/*
> + * inquire NVDIMM devices and link them into the list which is
> + * returned to the caller.
> + *
> + * Note: it is the caller's responsibility to free the list to avoid
> + * memory leak.
> + */
> +GSList *nvdimm_get_device_list(void)
> +{
> + GSList *list = NULL;
> +
> + object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
> + return list;
> +}
>
>
next prev parent reply other threads:[~2019-11-19 7:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 18:37 [PATCH v3 0/3] ppc: spapr: virtual NVDIMM support Shivaprasad G Bhat
2019-10-14 18:37 ` [PATCH v3 1/3] mem: move nvdimm_device_list to utilities Shivaprasad G Bhat
2019-11-19 2:58 ` David Gibson
2019-11-19 7:13 ` Igor Mammedov [this message]
2019-11-20 8:01 ` Shivaprasad G Bhat
2019-11-20 9:35 ` Igor Mammedov
2019-10-14 18:37 ` [PATCH v3 2/3] spapr: Add NVDIMM device support Shivaprasad G Bhat
2019-11-22 4:30 ` David Gibson
2019-11-27 4:20 ` Bharata B Rao
2019-12-06 1:52 ` David Gibson
2019-12-11 4:14 ` Shivaprasad G Bhat
2019-12-11 8:05 ` Igor Mammedov
2019-12-12 8:52 ` Shivaprasad G Bhat
2020-01-03 0:45 ` David Gibson
2019-12-16 11:15 ` Shivaprasad G Bhat
2019-10-14 18:38 ` [PATCH v3 3/3] spapr: Add Hcalls to support PAPR NVDIMM device Shivaprasad G Bhat
2019-11-22 5:11 ` David Gibson
2019-12-17 6:10 ` 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=20191119081326.275531af@redhat.com \
--to=imammedo@redhat.com \
--cc=david@gibson.dropbear.id.au \
--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).