From: Haozhong Zhang Date: Fri, 13 Jan 2017 11:56:51 +0000 (+0800) Subject: hw/i386: check if nvdimm is enabled before plugging X-Git-Tag: v2.9.0-rc0~119^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e987c37aee1752177906847630d32477da57e705;p=thirdparty%2Fqemu.git hw/i386: check if nvdimm is enabled before plugging The missing of 'nvdimm' in the machine type option '-M' means NVDIMM is disabled. QEMU should refuse to plug any NVDIMM device in this case and report the misconfiguration. The behavior of NVDIMM on unsupported platform (HW/FW) is vendor specific. For some vendors, it's undefined and the platform may do anything. Thus, I think QEMU is free to choose the implementation. Aborting QEMU (i.e. refusing to boot) is the easiest one. Reported-by: Stefan Hajnoczi Signed-off-by: Haozhong Zhang Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain Message-Id: 20170111093630.2088-1-stefanha@redhat.com Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Xiao Guangrong Reviewed-by: Eduardo Habkost Reviewed-by: Stefan Hajnoczi --- diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 706e2330acd..e3fcd514dd2 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1708,6 +1708,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev, } if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { + if (!pcms->acpi_nvdimm_state.is_enabled) { + error_setg(&local_err, + "nvdimm is not enabled: missing 'nvdimm' in '-M'"); + goto out; + } nvdimm_plug(&pcms->acpi_nvdimm_state); }