summary refs log tree commit diff stats
path: root/hw/mem/nvdimm.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-02-03 09:54:21 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-02-03 09:54:21 +0000
commit8360ebeb4f4a707984cafd1a22c049ec82ddcb4c (patch)
tree9363af79103b6ffcdc40322efa0963770810d9c4 /hw/mem/nvdimm.c
parent77f3804ab7ed94b471a14acb260e5aeacf26193f (diff)
parentdbd730e8598701e11b2fb7aee1704f4ec1787e86 (diff)
downloadfocaccia-qemu-8360ebeb4f4a707984cafd1a22c049ec82ddcb4c.tar.gz
focaccia-qemu-8360ebeb4f4a707984cafd1a22c049ec82ddcb4c.zip
Merge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-request' into staging
Machine queue, 2021-02-02

Feature:
* nvdimm: read-only file support (Stefan Hajnoczi)

# gpg: Signature made Tue 02 Feb 2021 19:27:21 GMT
# gpg:                using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6
# gpg:                issuer "ehabkost@redhat.com"
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost-gl/tags/machine-next-pull-request:
  nvdimm: check -object memory-backend-file, readonly=on option
  hostmem-file: add readonly=on|off option
  memory: add readonly support to memory_region_init_ram_from_file()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/mem/nvdimm.c')
-rw-r--r--hw/mem/nvdimm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 03c2201b56..e0a9d606e1 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);