Blob Blame History Raw
From 33c2ec7685c3b223b73974862ed8d28c7e44dc75 Mon Sep 17 00:00:00 2001
Message-Id: <33c2ec7685c3b223b73974862ed8d28c7e44dc75@dist-git>
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 11 Jul 2017 10:57:39 +0200
Subject: [PATCH] qemu: caps: Tweak arm conditional in SupportsChardev

Rather than try to whitelist all device configs that can't use
-chardev, blacklist the only one that really can't, which is the
default serial/console target type=isa case.

ISA specifically isn't a valid config for arm/aarch64, but we've
always implicitly treated it to mean 'default platform device'.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 948e429f485056e08f9f33bb577ff610a998ce70)

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 | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index eea57e4c9c..d5dd262ff2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5522,15 +5522,16 @@ virQEMUCapsSupportsChardev(const virDomainDef *def,
             return false;
     }
 
-    if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
-        return true;
+    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;
+    }
 
-    /* This may not be true for all ARM machine types, but at least
-     * the only supported non-virtio serial devices of vexpress and versatile
-     * don't have the -chardev property wired up. */
-    return (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO ||
-            (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
-             chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO));
+    return true;
 }
 
 
-- 
2.13.3