|
|
9ae3a8 |
From 9d150071a8170807a0e5f638e3eddbbc29219ddc Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 13 Dec 2017 13:38:45 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 14/41] fw_cfg: enable DMA if -device vmcoreinfo
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20171213133912.26176-15-marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 78364
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v3 14/41] fw_cfg: enable DMA if -device vmcoreinfo
|
|
|
9ae3a8 |
Bugzilla: 1411490
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Upstream status: RHEL-only
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
vmcoreinfo needs fw_cfg with DMA enabled. However, for compatibility
|
|
|
9ae3a8 |
reasons, DMA can't be enabled by default. In order to avoid having a
|
|
|
9ae3a8 |
RHEL-specific libvirt patch to enable DMA when vmcoreinfo device is
|
|
|
9ae3a8 |
requested, it can be done in qemu directly.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/nvram/fw_cfg.c | 17 +++++++++++++++++
|
|
|
9ae3a8 |
1 file changed, 17 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
index 616c782..7caf43c 100644
|
|
|
9ae3a8 |
--- a/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
+++ b/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
@@ -30,6 +30,7 @@
|
|
|
9ae3a8 |
#include "trace.h"
|
|
|
9ae3a8 |
#include "qemu/error-report.h"
|
|
|
9ae3a8 |
#include "qemu/config-file.h"
|
|
|
9ae3a8 |
+#include "qemu/option.h"
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
#define FW_CFG_CTL_SIZE 2
|
|
|
9ae3a8 |
#define FW_CFG_DATA_SIZE 1
|
|
|
9ae3a8 |
@@ -675,6 +676,17 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
|
|
|
9ae3a8 |
fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static int driver_is_vmcoreinfo(QemuOpts *opts, void *opaque)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ return g_strcmp0(qemu_opt_get(opts, "driver"), "vmcoreinfo") == 0;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static bool opts_has_vmcoreinfo(void)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ return qemu_opts_foreach(qemu_find_opts("device"),
|
|
|
9ae3a8 |
+ driver_is_vmcoreinfo, NULL, 1) != 0;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static FWCfgState *
|
|
|
9ae3a8 |
fw_cfg_init_dma(uint32_t ctl_port, uint32_t data_port,
|
|
|
9ae3a8 |
uint32_t dma_port,
|
|
|
9ae3a8 |
@@ -692,6 +704,11 @@ fw_cfg_init_dma(uint32_t ctl_port, uint32_t data_port,
|
|
|
9ae3a8 |
qdev_prop_set_uint32(dev, "data_iobase", data_port);
|
|
|
9ae3a8 |
qdev_prop_set_uint32(dev, "dma_iobase", dma_port);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ if (opts_has_vmcoreinfo()) {
|
|
|
9ae3a8 |
+ /* RHEL-only: enable DMA operations for vmcoreinfo device */
|
|
|
9ae3a8 |
+ qdev_prop_set_bit(dev, "dma_enabled", true);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
if (!dma_requested) {
|
|
|
9ae3a8 |
qdev_prop_set_bit(dev, "dma_enabled", false);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|