]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Rename SupportsChardev to IsPlatformDevice
authorCole Robinson <crobinso@redhat.com>
Mon, 26 Jun 2017 18:01:53 +0000 (14:01 -0400)
committerCole Robinson <crobinso@redhat.com>
Mon, 10 Jul 2017 21:25:26 +0000 (17:25 -0400)
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>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_command.c

index 1d1b4e24571a7cb77391718a00f41c0bd7986891..db9f9b8b13dc7533d77b71010912b7318f5e28d1 100644 (file)
@@ -5549,33 +5549,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)
index 829cbaadb2f47bbd924b97cff3c455eba704aeaa..fb22815e94785f20253fff0f5d2c273c0f41c478 100644 (file)
@@ -525,10 +525,6 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps,
 
 VIR_ENUM_DECL(virQEMUCaps);
 
-bool virQEMUCapsSupportsChardev(const virDomainDef *def,
-                                virQEMUCapsPtr qemuCaps,
-                                virDomainChrDefPtr chr);
-
 bool virQEMUCapsSupportsGICVersion(virQEMUCapsPtr qemuCaps,
                                    virDomainVirtType virtType,
                                    virGICVersion version);
index bb1d012315e798d64583b7b33039cd04efd232aa..e290abff63b4a7e23a6cebe5d4c5177c5c25cadc 100644 (file)
@@ -9101,6 +9101,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,
@@ -9136,8 +9160,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 {