diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2021-01-04 17:13:20 +0000 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2021-02-01 17:07:34 -0500 |
commit | dbd730e8598701e11b2fb7aee1704f4ec1787e86 (patch) | |
tree | 0a940c61f53c86ed01a859edcbe6652f28898cf5 /hw/mem/nvdimm.c | |
parent | 86635aa4e9d627d5142b81c57a33dd1f36627d07 (diff) | |
download | qemu-dbd730e8598701e11b2fb7aee1704f4ec1787e86.zip qemu-dbd730e8598701e11b2fb7aee1704f4ec1787e86.tar.gz qemu-dbd730e8598701e11b2fb7aee1704f4ec1787e86.tar.bz2 |
nvdimm: check -object memory-backend-file, readonly=on option
Check that -device nvdimm,unarmed=on is used when -object
memory-backend-file,readonly=on and document that -device
nvdimm,unarmed=on|off controls whether the NVDIMM appears read-only to
the guest.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20210104171320.575838-4-stefanha@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/mem/nvdimm.c')
-rw-r--r-- | hw/mem/nvdimm.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 03c2201..e0a9d60 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -146,6 +146,15 @@ static void nvdimm_prepare_memory_region(NVDIMMDevice *nvdimm, Error **errp) return; } + if (!nvdimm->unarmed && memory_region_is_rom(mr)) { + HostMemoryBackend *hostmem = dimm->hostmem; + + error_setg(errp, "'unarmed' property must be off since memdev %s " + "is read-only", + object_get_canonical_path_component(OBJECT(hostmem))); + return; + } + nvdimm->nvdimm_mr = g_new(MemoryRegion, 1); memory_region_init_alias(nvdimm->nvdimm_mr, OBJECT(dimm), "nvdimm-memory", mr, 0, pmem_size); |