From 76122cda79a4864f632ef1e5ea4bb5364cde4595 Mon Sep 17 00:00:00 2001
Message-Id: <76122cda79a4864f632ef1e5ea4bb5364cde4595@dist-git>
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 11 Jul 2017 10:57:49 +0200
Subject: [PATCH] qemu: Rename SupportsChardev to IsPlatformDevice
This is only used in qemu_command.c, so move it, and clarify that
it's really about identifying if the serial config is a platform
device or not.
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 405c0f07f5c444c52bd6cc95476753c7c8b2ffe2)
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1435681
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_capabilities.c | 27 ---------------------------
src/qemu/qemu_capabilities.h | 4 ----
src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++--
3 files changed, 26 insertions(+), 33 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0e611c343c..60281373f0 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5502,33 +5502,6 @@ virQEMUCapsCacheFree(virQEMUCapsCachePtr cache)
bool
-virQEMUCapsSupportsChardev(const virDomainDef *def,
- virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
- virDomainChrDefPtr chr)
-{
- if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) {
- if (!qemuDomainIsPSeries(def))
- return false;
- /* only pseries need -device spapr-vty with -chardev */
- if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
- chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO)
- return false;
- }
-
- if (def->os.arch == VIR_ARCH_ARMV7L || def->os.arch == VIR_ARCH_AARCH64) {
- /* TARGET_TYPE_ISA here really means 'the default', which we
- treat as whatever the built in platform serial device is on.
- And for platform devices we can't use -chardev */
- if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
- chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA)
- return false;
- }
-
- return true;
-}
-
-
-bool
virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps,
const virDomainDef *def)
{
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 433aa7f90b..5b8e654d10 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -543,10 +543,6 @@ void virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps);
VIR_ENUM_DECL(virQEMUCaps);
-bool virQEMUCapsSupportsChardev(const virDomainDef *def,
- virQEMUCapsPtr qemuCaps,
- virDomainChrDefPtr chr);
-
bool virQEMUCapsSupportsGICVersion(virQEMUCapsPtr qemuCaps,
virDomainVirtType virtType,
virGICVersion version);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 69f4323a3b..7ad3d16ea8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9063,6 +9063,30 @@ qemuBuildChrDeviceCommandLine(virCommandPtr cmd,
}
+static bool
+qemuChrIsPlatformDevice(const virDomainDef *def,
+ virDomainChrDefPtr chr)
+{
+ if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) {
+ if (!qemuDomainIsPSeries(def))
+ return true;
+ /* only pseries need -device spapr-vty with -chardev */
+ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
+ chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO)
+ return true;
+ }
+
+ if (def->os.arch == VIR_ARCH_ARMV7L || def->os.arch == VIR_ARCH_AARCH64) {
+ /* TARGET_TYPE_ISA here really means 'the default platform device' */
+ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
+ chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA)
+ return true;
+ }
+
+ return false;
+}
+
+
static int
qemuBuildSerialCommandLine(virLogManagerPtr logManager,
virCommandPtr cmd,
@@ -9096,8 +9120,8 @@ qemuBuildSerialCommandLine(virLogManagerPtr logManager,
virCommandAddArg(cmd, devstr);
VIR_FREE(devstr);
- /* Use -chardev with -device if they are available */
- if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
+ /* If the device is not a platform device, build the devstr */
+ if (!qemuChrIsPlatformDevice(def, serial)) {
if (qemuBuildChrDeviceCommandLine(cmd, def, serial, qemuCaps) < 0)
return -1;
} else {
--
2.13.3