Blame SOURCES/libvirt-qemu-use-qemu-xhci-USB-controller-by-default-for-ppc64-and-aarch64.patch

6d3351
From 5af922119074c1a74db6bebb272b6b9758c89c63 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <5af922119074c1a74db6bebb272b6b9758c89c63@dist-git>
6d3351
From: Pavel Hrdina <phrdina@redhat.com>
6d3351
Date: Fri, 28 Apr 2017 11:59:51 +0200
6d3351
Subject: [PATCH] qemu: use qemu-xhci USB controller by default for ppc64 and
6d3351
 aarch64
6d3351
6d3351
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438682
6d3351
6d3351
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6d3351
Acked-by: Andrea Bolognani <abologna@redhat.com>
6d3351
(cherry picked from commit 568887a32f9985b95d998dd0d675255ea985013f)
6d3351
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_domain.c                                | 11 ++++++++---
6d3351
 ...qemuxml2argv-aarch64-usb-controller-qemu-xhci.args | 19 +++++++++++++++++++
6d3351
 .../qemuxml2argv-aarch64-usb-controller-qemu-xhci.xml | 16 ++++++++++++++++
6d3351
 .../qemuxml2argv-ppc64-usb-controller-qemu-xhci.args  | 19 +++++++++++++++++++
6d3351
 .../qemuxml2argv-ppc64-usb-controller-qemu-xhci.xml   |  1 +
6d3351
 tests/qemuxml2argvtest.c                              |  9 +++++++++
6d3351
 6 files changed, 72 insertions(+), 3 deletions(-)
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.args
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.xml
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.args
6d3351
 create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.xml
6d3351
6d3351
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
6d3351
index 4d7de60cb..2790d7e74 100644
6d3351
--- a/src/qemu/qemu_domain.c
6d3351
+++ b/src/qemu/qemu_domain.c
6d3351
@@ -3237,9 +3237,12 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
6d3351
             } else if (ARCH_IS_PPC64(def->os.arch)) {
6d3351
                 /* To not break migration we need to set default USB controller
6d3351
                  * for ppc64 to pci-ohci if we cannot change ABI of the VM.
6d3351
-                 * The nec-usb-xhci controller is used as default only for
6d3351
-                 * newly defined domains or devices. */
6d3351
+                 * The nec-usb-xhci or qemu-xhci controller is used as default
6d3351
+                 * only for newly defined domains or devices. */
6d3351
                 if ((parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) &&
6d3351
+                    virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) {
6d3351
+                    cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI;
6d3351
+                } else if ((parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) &&
6d3351
                     virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) {
6d3351
                     cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
6d3351
                 } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) {
6d3351
@@ -3249,7 +3252,9 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
6d3351
                     cont->model = -1;
6d3351
                 }
6d3351
             } else if (def->os.arch == VIR_ARCH_AARCH64) {
6d3351
-                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI))
6d3351
+                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI))
6d3351
+                    cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI;
6d3351
+                else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI))
6d3351
                     cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
6d3351
             }
6d3351
         }
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.args
6d3351
new file mode 100644
6d3351
index 000000000..0aa27f7ab
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.args
6d3351
@@ -0,0 +1,19 @@
6d3351
+LC_ALL=C \
6d3351
+PATH=/bin \
6d3351
+HOME=/home/test \
6d3351
+USER=test \
6d3351
+LOGNAME=test \
6d3351
+QEMU_AUDIO_DRV=none \
6d3351
+/usr/bin/qemu-system-aarch64 \
6d3351
+-name QEMUGuest1 \
6d3351
+-S \
6d3351
+-M virt \
6d3351
+-m 214 \
6d3351
+-smp 1,sockets=1,cores=1,threads=1 \
6d3351
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
6d3351
+-nographic \
6d3351
+-nodefaults \
6d3351
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
6d3351
+-no-acpi \
6d3351
+-boot c \
6d3351
+-device qemu-xhci,id=usb,bus=pcie.0,addr=0x1
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.xml
6d3351
new file mode 100644
6d3351
index 000000000..1b7320f43
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-qemu-xhci.xml
6d3351
@@ -0,0 +1,16 @@
6d3351
+<domain type='qemu'>
6d3351
+  <name>QEMUGuest1</name>
6d3351
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
6d3351
+  <memory unit='KiB'>219100</memory>
6d3351
+  <vcpu placement='static'>1</vcpu>
6d3351
+  <os>
6d3351
+    <type arch='aarch64' machine='virt'>hvm</type>
6d3351
+  </os>
6d3351
+  <devices>
6d3351
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
6d3351
+    <controller type='usb' index='0'>
6d3351
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
6d3351
+    </controller>
6d3351
+    <memballoon model='none'/>
6d3351
+  </devices>
6d3351
+</domain>
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.args b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.args
6d3351
new file mode 100644
6d3351
index 000000000..b34e480dd
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.args
6d3351
@@ -0,0 +1,19 @@
6d3351
+LC_ALL=C \
6d3351
+PATH=/bin \
6d3351
+HOME=/home/test \
6d3351
+USER=test \
6d3351
+LOGNAME=test \
6d3351
+QEMU_AUDIO_DRV=none \
6d3351
+/usr/libexec/qemu-system-ppc64 \
6d3351
+-name QEMUGuest1 \
6d3351
+-S \
6d3351
+-M pseries \
6d3351
+-m 256 \
6d3351
+-smp 1,sockets=1,cores=1,threads=1 \
6d3351
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
6d3351
+-nographic \
6d3351
+-nodefaults \
6d3351
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
6d3351
+-boot c \
6d3351
+-device qemu-xhci,id=usb,bus=pci.0,addr=0x1 \
6d3351
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.xml b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.xml
6d3351
new file mode 120000
6d3351
index 000000000..831d9d4f1
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-qemu-xhci.xml
6d3351
@@ -0,0 +1 @@
6d3351
+qemuxml2argv-ppc64-usb-controller.xml
6d3351
\ No newline at end of file
6d3351
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
6d3351
index 317f17e74..406fbfea4 100644
6d3351
--- a/tests/qemuxml2argvtest.c
6d3351
+++ b/tests/qemuxml2argvtest.c
6d3351
@@ -2480,6 +2480,15 @@ mymain(void)
6d3351
             QEMU_CAPS_PCI_OHCI);
6d3351
     DO_TEST("ppc64-usb-controller-legacy",
6d3351
             QEMU_CAPS_PIIX3_USB_UHCI);
6d3351
+    DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", NULL, -1, 0,
6d3351
+                 VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, GIC_NONE,
6d3351
+                 QEMU_CAPS_NEC_USB_XHCI,
6d3351
+                 QEMU_CAPS_DEVICE_QEMU_XHCI);
6d3351
+
6d3351
+    DO_TEST("aarch64-usb-controller-qemu-xhci",
6d3351
+            QEMU_CAPS_OBJECT_GPEX,
6d3351
+            QEMU_CAPS_NEC_USB_XHCI,
6d3351
+            QEMU_CAPS_DEVICE_QEMU_XHCI);
6d3351
 
6d3351
     DO_TEST("aarch64-usb-controller-nec-xhci",
6d3351
             QEMU_CAPS_OBJECT_GPEX,
6d3351
-- 
6d3351
2.12.2
6d3351