diff mbox

[RFC,QEMU,3/8] nvdimm acpi: do not use fw_cfg on Xen

Message ID 20161010003423.4333-4-haozhong.zhang@intel.com
State New
Headers show

Commit Message

Haozhong Zhang Oct. 10, 2016, 12:34 a.m. UTC
No fw_cfg is created when QEMU is used as the device model of Xen.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/nvdimm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index e486128..c9c2a84 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -770,8 +770,11 @@  void nvdimm_init_acpi_state(AcpiNVDIMMState *state, MemoryRegion *io,
 
     state->dsm_mem = g_array_new(false, true /* clear */, 1);
     acpi_data_push(state->dsm_mem, sizeof(NvdimmDsmIn));
-    fw_cfg_add_file(fw_cfg, NVDIMM_DSM_MEM_FILE, state->dsm_mem->data,
-                    state->dsm_mem->len);
+    /* No fw_cfg is used when running on Xen */
+    if (fw_cfg) {
+        fw_cfg_add_file(fw_cfg, NVDIMM_DSM_MEM_FILE, state->dsm_mem->data,
+                        state->dsm_mem->len);
+    }
 }
 
 #define NVDIMM_COMMON_DSM      "NCAL"