render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
3e5111
From 09e42278625a78997f11ffe898e82684a6524131 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <09e42278625a78997f11ffe898e82684a6524131@dist-git>
3e5111
From: Pavel Hrdina <phrdina@redhat.com>
3e5111
Date: Fri, 28 Apr 2017 11:59:47 +0200
3e5111
Subject: [PATCH] qemu: change the logic of setting default USB controller
3e5111
3e5111
The new logic will set the piix3-uhci if available regardless of
3e5111
any architecture and it will be updated to better model based on
3e5111
architecture and device existence.
3e5111
3e5111
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3e5111
Acked-by: Andrea Bolognani <abologna@redhat.com>
3e5111
(cherry picked from commit e69001b46448ae7e0f9f727965d4bea169ca2d9e)
3e5111
3e5111
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438682
3e5111
3e5111
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_domain.c | 23 ++++++++++++++---------
3e5111
 1 file changed, 14 insertions(+), 9 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
3e5111
index 53586878b..a1a4003af 100644
3e5111
--- a/src/qemu/qemu_domain.c
3e5111
+++ b/src/qemu/qemu_domain.c
3e5111
@@ -3223,11 +3223,17 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
3e5111
              * when the relevant device is not available.
3e5111
              *
3e5111
              * See qemuBuildControllerDevCommandLine() */
3e5111
-            if (ARCH_IS_S390(def->os.arch) &&
3e5111
-                cont->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
3e5111
-                /* set the default USB model to none for s390 unless an
3e5111
-                 * address is found */
3e5111
-                cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE;
3e5111
+
3e5111
+            /* Default USB controller is piix3-uhci if available. */
3e5111
+            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI))
3e5111
+                cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI;
3e5111
+
3e5111
+            if (ARCH_IS_S390(def->os.arch)) {
3e5111
+                if (cont->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
3e5111
+                    /* set the default USB model to none for s390 unless an
3e5111
+                     * address is found */
3e5111
+                    cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE;
3e5111
+                }
3e5111
             } else if (ARCH_IS_PPC64(def->os.arch)) {
3e5111
                 /* To not break migration we need to set default USB controller
3e5111
                  * for ppc64 to pci-ohci if we cannot change ABI of the VM.
3e5111
@@ -3238,11 +3244,10 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
3e5111
                     cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
3e5111
                 } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) {
3e5111
                     cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
3e5111
+                } else {
3e5111
+                    /* Explicitly fallback to legacy USB controller for PPC64. */
3e5111
+                    cont->model = -1;
3e5111
                 }
3e5111
-            } else {
3e5111
-                /* Default USB controller for anything else is piix3-uhci */
3e5111
-                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI))
3e5111
-                    cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI;
3e5111
             }
3e5111
         }
3e5111
         /* forbid usb model 'qusb1' and 'qusb2' in this kind of hyperviosr */
3e5111
-- 
3e5111
2.12.2
3e5111