qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Maxim Davydov <maxim.davydov@openvz.org>
Cc: eduardo@habkost.net, v.sementsov-og@mail.ru, berrange@redhat.com,
	xiaoguangrong.eric@gmail.com, mst@redhat.com, armbru@redhat.com,
	crosa@redhat.com, qemu-devel@nongnu.org, lizhijian@fujitsu.com,
	f4bug@amsat.org, wangyanan55@huawei.com,
	marcandre.lureau@redhat.com, chen.zhang@intel.com,
	jsnow@redhat.com, pbonzini@redhat.com, ani@anisinha.ca,
	den@openvz.org, eblake@redhat.com
Subject: Re: [PATCH v1 3/9] mem: appropriate handling getting mem region
Date: Thu, 31 Mar 2022 13:43:28 +0200	[thread overview]
Message-ID: <20220331134328.65d15a93@redhat.com> (raw)
In-Reply-To: <20220328211539.90170-4-maxim.davydov@openvz.org>

On Tue, 29 Mar 2022 00:15:33 +0300
Maxim Davydov <maxim.davydov@openvz.org> wrote:

> Attempt to get memory region if the device doesn't have hostmem may not be
> an error. This can be happen immediately after initialization (getting
> value without default one).

Above statement begs for expanded explanation
Pls rephrase and explain why it's needed and how it will be used.

> 
> Signed-off-by: Maxim Davydov <maxim.davydov@openvz.org>
> ---
>  hw/i386/sgx-epc.c | 5 ++++-
>  hw/mem/nvdimm.c   | 6 ++++++
>  hw/mem/pc-dimm.c  | 5 +++++
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
> index d664829d35..1a4c8acdcc 100644
> --- a/hw/i386/sgx-epc.c
> +++ b/hw/i386/sgx-epc.c
> @@ -121,9 +121,12 @@ static MemoryRegion *sgx_epc_md_get_memory_region(MemoryDeviceState *md,
>  {
>      SGXEPCDevice *epc = SGX_EPC(md);
>      HostMemoryBackend *hostmem;
> +    DeviceState *dev = DEVICE(epc);
>  
>      if (!epc->hostmem) {
> -        error_setg(errp, "'" SGX_EPC_MEMDEV_PROP "' property must be set");
> +        if (dev->realized) {
> +            error_setg(errp, "'" SGX_EPC_MEMDEV_PROP "' property must be set");
> +        }
>          return NULL;
>      }
>  
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index 7c7d777781..61e77e5476 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -166,9 +166,15 @@ static MemoryRegion *nvdimm_md_get_memory_region(MemoryDeviceState *md,
>                                                   Error **errp)
>  {
>      NVDIMMDevice *nvdimm = NVDIMM(md);
> +    PCDIMMDevice *dimm = PC_DIMM(nvdimm);
>      Error *local_err = NULL;
>  
>      if (!nvdimm->nvdimm_mr) {
> +        /* Not error if we try get memory region after init */
> +        if (!dimm->hostmem) {
> +            return NULL;
> +        }
> +
>          nvdimm_prepare_memory_region(nvdimm, &local_err);
>          if (local_err) {
>              error_propagate(errp, local_err);
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index f27e1a11ba..6fd74de97f 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -240,6 +240,11 @@ static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,
>  static MemoryRegion *pc_dimm_md_get_memory_region(MemoryDeviceState *md,
>                                                    Error **errp)
>  {
> +    PCDIMMDevice *dimm = PC_DIMM(md);
> +    /* Not error if we try get memory region after init */
> +    if (!dimm->hostmem) {
> +        return NULL;
> +    }
>      return pc_dimm_get_memory_region(PC_DIMM(md), errp);
>  }
>  



  parent reply	other threads:[~2022-03-31 11:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 21:15 [PATCH v1 0/9] Machine type compatible properties Maxim Davydov
2022-03-28 21:15 ` [PATCH v1 1/9] qmp: Add dump machine " Maxim Davydov
2022-03-30 11:03   ` Vladimir Sementsov-Ogievskiy
2022-04-04  9:08     ` Maxim Davydov
2022-03-28 21:15 ` [PATCH v1 2/9] pci: add null-pointer check Maxim Davydov
2022-03-30 11:07   ` Vladimir Sementsov-Ogievskiy
2022-04-04 11:07     ` Maxim Davydov
2022-03-31 11:46   ` Igor Mammedov
2022-03-28 21:15 ` [PATCH v1 3/9] mem: appropriate handling getting mem region Maxim Davydov
2022-03-30 11:27   ` Vladimir Sementsov-Ogievskiy
2022-04-04 11:57     ` Maxim Davydov
2022-03-31 11:43   ` Igor Mammedov [this message]
2022-03-28 21:15 ` [PATCH v1 4/9] msmouse: add appropriate unregister handler Maxim Davydov
2022-03-29  8:13   ` Marc-André Lureau
2022-03-28 21:15 ` [PATCH v1 5/9] wctablet: " Maxim Davydov
2022-03-29  8:13   ` Marc-André Lureau
2022-03-28 21:15 ` [PATCH v1 6/9] chardev: add appropriate getting address Maxim Davydov
2022-03-30 11:32   ` Vladimir Sementsov-Ogievskiy
2022-04-04 12:38     ` Maxim Davydov
2022-03-28 21:15 ` [PATCH v1 7/9] colo-compare: safe finalization Maxim Davydov
2022-03-30 14:54   ` Vladimir Sementsov-Ogievskiy
2022-04-04 15:20     ` Maxim Davydov
2022-03-28 21:15 ` [PATCH v1 8/9] qom: add command to print initial properties Maxim Davydov
2022-03-30 15:17   ` Vladimir Sementsov-Ogievskiy
2022-04-04 15:33     ` Maxim Davydov
2022-03-31 11:55   ` Igor Mammedov
2022-04-04 16:08     ` Maxim Davydov
2022-03-28 21:15 ` [PATCH v1 9/9] scripts: printing machine type compat properties Maxim Davydov
2022-03-30 15:55   ` Vladimir Sementsov-Ogievskiy
2022-03-31 15:38     ` John Snow
2022-03-31 11:51 ` [PATCH v1 0/9] Machine type compatible properties Igor Mammedov
2022-04-21  8:44 ` Vladimir Sementsov-Ogievskiy

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=20220331134328.65d15a93@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=chen.zhang@intel.com \
    --cc=crosa@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=jsnow@redhat.com \
    --cc=lizhijian@fujitsu.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=maxim.davydov@openvz.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=v.sementsov-og@mail.ru \
    --cc=wangyanan55@huawei.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).