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 3/4] spapr: Add NVDIMM device support
Date: Fri, 3 Jan 2020 12:20:15 +1100 [thread overview]
Message-ID: <20200103012015.GP2098@umbus> (raw)
In-Reply-To: <157657253645.53829.168353921681383728.stgit@lep8c.aus.stglabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 4618 bytes --]
On Tue, Dec 17, 2019 at 02:49:14AM -0600, 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.
> 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.
>
> The device support is verified based on the machine version unlike x86.
>
> This is how it can be used ..
> Ex :
> 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 <sbhat@linux.ibm.com>
> Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
> [Early implementation]
> ---
> default-configs/ppc64-softmmu.mak | 1
> hw/mem/Kconfig | 2
> hw/ppc/spapr.c | 216 ++++++++++++++++++++++++++++++++++---
> hw/ppc/spapr_drc.c | 18 +++
> hw/ppc/spapr_events.c | 4 +
> include/hw/ppc/spapr.h | 11 ++
> include/hw/ppc/spapr_drc.h | 9 ++
> 7 files changed, 245 insertions(+), 16 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/ppc/spapr.c b/hw/ppc/spapr.c
> index 3ae7db1563..921d8d7c8e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -80,6 +80,8 @@
> #include "hw/ppc/spapr_cpu_core.h"
> #include "hw/mem/memory-device.h"
> #include "hw/ppc/spapr_tpm_proxy.h"
> +#include "hw/mem/nvdimm.h"
> +#include "qemu/nvdimm-utils.h"
>
> #include "monitor/monitor.h"
>
> @@ -685,12 +687,22 @@ static int spapr_populate_drmem_v2(SpaprMachineState *spapr, void *fdt,
> nr_entries++;
> }
>
> - /* Entry for DIMM */
> - drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, addr / lmb_size);
> - g_assert(drc);
> - elem = spapr_get_drconf_cell(size / lmb_size, addr,
> - spapr_drc_index(drc), node,
> - SPAPR_LMB_FLAGS_ASSIGNED);
> + if (info->value->type == MEMORY_DEVICE_INFO_KIND_DIMM) {
> + /* Entry for DIMM */
> + drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, addr / lmb_size);
> + g_assert(drc);
> + elem = spapr_get_drconf_cell(size / lmb_size, addr,
> + spapr_drc_index(drc), node,
> + SPAPR_LMB_FLAGS_ASSIGNED);
> + } else if (info->value->type == MEMORY_DEVICE_INFO_KIND_NVDIMM) {
> + /*
> + * NVDIMM sits here, let the DIMM LMBs be unusable here in the
> + * whole range
> + */
> + elem = spapr_get_drconf_cell(size / lmb_size, addr, 0, -1,
> + SPAPR_LMB_FLAGS_RESERVED |
> + SPAPR_LMB_FLAGS_DRC_INVALID);
> + }
As discussed in reply to an earlier thread, this whole scheme
basically breaks down in the presence of hotplug - it relies on which
GPAs are DIMMs and which are NVDIMMs not changing.
Other than that significant problem, the rest of this looks
reasonable.
--
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-01-03 2:27 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
2019-12-17 8:49 ` [PATCH v4 3/4] spapr: Add NVDIMM device support Shivaprasad G Bhat
2020-01-03 1:20 ` David Gibson [this message]
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=20200103012015.GP2098@umbus \
--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).