Blame SOURCES/libvirt-qemu-use-nec-usb-xhci-as-a-default-controller-for-aarch64-if-available.patch

6d3351
From 86987ff859c7c85f649c5845d2673a1ba5fc4fcc Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <86987ff859c7c85f649c5845d2673a1ba5fc4fcc@dist-git>
6d3351
From: Pavel Hrdina <phrdina@redhat.com>
6d3351
Date: Fri, 28 Apr 2017 11:59:48 +0200
6d3351
Subject: [PATCH] qemu: use nec-usb-xhci as a default controller for aarch64 if
6d3351
 available
6d3351
6d3351
This is a USB3 controller and it's a better choice than piix3-uhci.
6d3351
6d3351
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6d3351
Acked-by: Andrea Bolognani <abologna@redhat.com>
6d3351
(cherry picked from commit 233f8d0bd413c5bda91ed678b705e0a9f7a9e922)
6d3351
6d3351
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438682
6d3351
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                                |  3 +++
6d3351
 .../qemuxml2argv-aarch64-usb-controller-nec-xhci.args | 19 +++++++++++++++++++
6d3351
 .../qemuxml2argv-aarch64-usb-controller-nec-xhci.xml  | 16 ++++++++++++++++
6d3351
 tests/qemuxml2argvtest.c                              |  4 ++++
6d3351
 4 files changed, 42 insertions(+)
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.args
6d3351
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.xml
6d3351
6d3351
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
6d3351
index a1a4003af..25ab1f639 100644
6d3351
--- a/src/qemu/qemu_domain.c
6d3351
+++ b/src/qemu/qemu_domain.c
6d3351
@@ -3248,6 +3248,9 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
6d3351
                     /* Explicitly fallback to legacy USB controller for PPC64. */
6d3351
                     cont->model = -1;
6d3351
                 }
6d3351
+            } else if (def->os.arch == VIR_ARCH_AARCH64) {
6d3351
+                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI))
6d3351
+                    cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
6d3351
             }
6d3351
         }
6d3351
         /* forbid usb model 'qusb1' and 'qusb2' in this kind of hyperviosr */
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.args
6d3351
new file mode 100644
6d3351
index 000000000..e97431f8b
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-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 nec-usb-xhci,id=usb,bus=pcie.0,addr=0x1
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.xml
6d3351
new file mode 100644
6d3351
index 000000000..1b7320f43
6d3351
--- /dev/null
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
6d3351
index 81cd2a6ec..ca1d23c10 100644
6d3351
--- a/tests/qemuxml2argvtest.c
6d3351
+++ b/tests/qemuxml2argvtest.c
6d3351
@@ -2477,6 +2477,10 @@ mymain(void)
6d3351
     DO_TEST("ppc64-usb-controller-legacy",
6d3351
             QEMU_CAPS_PIIX3_USB_UHCI);
6d3351
 
6d3351
+    DO_TEST("aarch64-usb-controller-nec-xhci",
6d3351
+            QEMU_CAPS_OBJECT_GPEX,
6d3351
+            QEMU_CAPS_NEC_USB_XHCI);
6d3351
+
6d3351
     DO_TEST_PARSE_FLAGS_ERROR("missing-machine",
6d3351
                               VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS,
6d3351
                               NONE);
6d3351
-- 
6d3351
2.12.2
6d3351