mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
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>
This commit is contained in:
parent
86635aa4e9
commit
dbd730e859
2 changed files with 26 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue