5d360b
From 1d05047c15ca1d8e29dcb0892e449987739682b4 Mon Sep 17 00:00:00 2001
5d360b
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
5d360b
Date: Wed, 13 Dec 2017 13:38:40 +0100
5d360b
Subject: [PATCH 09/41] fw_cfg: unbreak migration compatibility
5d360b
MIME-Version: 1.0
5d360b
Content-Type: text/plain; charset=UTF-8
5d360b
Content-Transfer-Encoding: 8bit
5d360b
5d360b
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
5d360b
Message-id: <20171213133912.26176-10-marcandre.lureau@redhat.com>
5d360b
Patchwork-id: 78359
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH v3 09/41] fw_cfg: unbreak migration compatibility
5d360b
Bugzilla: 1411490
5d360b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
5d360b
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
5d360b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
5d360b
From: Laszlo Ersek <lersek@redhat.com>
5d360b
5d360b
Upstream-status: RHEL only
5d360b
5d360b
fw_cfg DMA shouldn't be enabled by default on x86, or it will break
5d360b
migration from new (DMA) to old (non-DMA) qemu.
5d360b
5d360b
Thus we must maintain DMA disabled by default. Since we don't
5d360b
introduce a new machine, only if requested explicitely with -global
5d360b
fw_cfg.dma_enabled=on, or -device vmcoreinfo (see upcoming RHEL-only
5d360b
patch) should DMA be enabled.
5d360b
5d360b
(this is somewhat similar to upstream commit
5d360b
e6915b5f3a874a467a9a65f7ec1d6ef8d251a51a, except that we can't enable
5d360b
DMA by default on RHEL qemu)
5d360b
5d360b
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 hw/nvram/fw_cfg.c | 9 ++++++---
5d360b
 1 file changed, 6 insertions(+), 3 deletions(-)
5d360b
5d360b
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
5d360b
index 1789487..a7bc98e 100644
5d360b
--- a/hw/nvram/fw_cfg.c
5d360b
+++ b/hw/nvram/fw_cfg.c
5d360b
@@ -677,13 +677,16 @@ fw_cfg_init_dma(uint32_t ctl_port, uint32_t data_port,
5d360b
     SysBusDevice *d;
5d360b
     FWCfgState *s;
5d360b
     uint32_t version = FW_CFG_VERSION;
5d360b
-    bool dma_enabled = dma_port && dma_as;
5d360b
+    bool dma_requested = dma_port && dma_as;
5d360b
 
5d360b
     dev = qdev_create(NULL, "fw_cfg");
5d360b
     qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);
5d360b
     qdev_prop_set_uint32(dev, "data_iobase", data_port);
5d360b
     qdev_prop_set_uint32(dev, "dma_iobase", dma_port);
5d360b
-    qdev_prop_set_bit(dev, "dma_enabled", dma_enabled);
5d360b
+
5d360b
+    if (!dma_requested) {
5d360b
+        qdev_prop_set_bit(dev, "dma_enabled", false);
5d360b
+    }
5d360b
 
5d360b
     d = SYS_BUS_DEVICE(dev);
5d360b
 
5d360b
@@ -702,7 +705,7 @@ fw_cfg_init_dma(uint32_t ctl_port, uint32_t data_port,
5d360b
     if (data_addr) {
5d360b
         sysbus_mmio_map(d, 1, data_addr);
5d360b
     }
5d360b
-    if (dma_enabled) {
5d360b
+    if (s->dma_enabled) {
5d360b
         /* 64 bits for the address field */
5d360b
         s->dma = &dma_context_memory;
5d360b
         s->dma_addr = 0;
5d360b
-- 
5d360b
1.8.3.1
5d360b