mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
nvdimm: add 'unarmed' option
Currently the only vNVDIMM backend can guarantee the guest write persistence is device DAX on Linux, because no host-side kernel cache is involved in the guest access to it. The approach to detect whether the backend is device DAX needs to access sysfs, which may not work with SELinux. Instead, we add the 'unarmed' option to device 'nvdimm', so that users or management utils, which have enough knowledge about the backend, can control the unarmed flag in guest ACPI NFIT via this option. The guest Linux NVDIMM driver, for example, will mark the corresponding vNVDIMM device read-only if the unarmed flag in guest NFIT is set. The default value of 'unarmed' option is 'off' in order to keep the backwards compatibility. Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> Message-Id: <20171211072806.2812-4-haozhong.zhang@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
da6789c27c
commit
cb836434cd
4 changed files with 57 additions and 0 deletions
|
@ -138,6 +138,8 @@ struct NvdimmNfitMemDev {
|
|||
} QEMU_PACKED;
|
||||
typedef struct NvdimmNfitMemDev NvdimmNfitMemDev;
|
||||
|
||||
#define ACPI_NFIT_MEM_NOT_ARMED (1 << 3)
|
||||
|
||||
/*
|
||||
* NVDIMM Control Region Structure
|
||||
*
|
||||
|
@ -284,6 +286,7 @@ static void
|
|||
nvdimm_build_structure_memdev(GArray *structures, DeviceState *dev)
|
||||
{
|
||||
NvdimmNfitMemDev *nfit_memdev;
|
||||
NVDIMMDevice *nvdimm = NVDIMM(OBJECT(dev));
|
||||
uint64_t size = object_property_get_uint(OBJECT(dev), PC_DIMM_SIZE_PROP,
|
||||
NULL);
|
||||
int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP,
|
||||
|
@ -312,6 +315,10 @@ nvdimm_build_structure_memdev(GArray *structures, DeviceState *dev)
|
|||
|
||||
/* Only one interleave for PMEM. */
|
||||
nfit_memdev->interleave_ways = cpu_to_le16(1);
|
||||
|
||||
if (nvdimm->unarmed) {
|
||||
nfit_memdev->flags |= cpu_to_le16(ACPI_NFIT_MEM_NOT_ARMED);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue