render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
3e5111
From 86987ff859c7c85f649c5845d2673a1ba5fc4fcc Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <86987ff859c7c85f649c5845d2673a1ba5fc4fcc@dist-git>
3e5111
From: Pavel Hrdina <phrdina@redhat.com>
3e5111
Date: Fri, 28 Apr 2017 11:59:48 +0200
3e5111
Subject: [PATCH] qemu: use nec-usb-xhci as a default controller for aarch64 if
3e5111
 available
3e5111
3e5111
This is a USB3 controller and it's a better choice than piix3-uhci.
3e5111
3e5111
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3e5111
Acked-by: Andrea Bolognani <abologna@redhat.com>
3e5111
(cherry picked from commit 233f8d0bd413c5bda91ed678b705e0a9f7a9e922)
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                                |  3 +++
3e5111
 .../qemuxml2argv-aarch64-usb-controller-nec-xhci.args | 19 +++++++++++++++++++
3e5111
 .../qemuxml2argv-aarch64-usb-controller-nec-xhci.xml  | 16 ++++++++++++++++
3e5111
 tests/qemuxml2argvtest.c                              |  4 ++++
3e5111
 4 files changed, 42 insertions(+)
3e5111
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.args
3e5111
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.xml
3e5111
3e5111
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
3e5111
index a1a4003af..25ab1f639 100644
3e5111
--- a/src/qemu/qemu_domain.c
3e5111
+++ b/src/qemu/qemu_domain.c
3e5111
@@ -3248,6 +3248,9 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
3e5111
                     /* Explicitly fallback to legacy USB controller for PPC64. */
3e5111
                     cont->model = -1;
3e5111
                 }
3e5111
+            } else if (def->os.arch == VIR_ARCH_AARCH64) {
3e5111
+                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI))
3e5111
+                    cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI;
3e5111
             }
3e5111
         }
3e5111
         /* forbid usb model 'qusb1' and 'qusb2' in this kind of hyperviosr */
3e5111
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.args
3e5111
new file mode 100644
3e5111
index 000000000..e97431f8b
3e5111
--- /dev/null
3e5111
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.args
3e5111
@@ -0,0 +1,19 @@
3e5111
+LC_ALL=C \
3e5111
+PATH=/bin \
3e5111
+HOME=/home/test \
3e5111
+USER=test \
3e5111
+LOGNAME=test \
3e5111
+QEMU_AUDIO_DRV=none \
3e5111
+/usr/bin/qemu-system-aarch64 \
3e5111
+-name QEMUGuest1 \
3e5111
+-S \
3e5111
+-M virt \
3e5111
+-m 214 \
3e5111
+-smp 1,sockets=1,cores=1,threads=1 \
3e5111
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
3e5111
+-nographic \
3e5111
+-nodefaults \
3e5111
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
3e5111
+-no-acpi \
3e5111
+-boot c \
3e5111
+-device nec-usb-xhci,id=usb,bus=pcie.0,addr=0x1
3e5111
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.xml
3e5111
new file mode 100644
3e5111
index 000000000..1b7320f43
3e5111
--- /dev/null
3e5111
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-usb-controller-nec-xhci.xml
3e5111
@@ -0,0 +1,16 @@
3e5111
+<domain type='qemu'>
3e5111
+  <name>QEMUGuest1</name>
3e5111
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
3e5111
+  <memory unit='KiB'>219100</memory>
3e5111
+  <vcpu placement='static'>1</vcpu>
3e5111
+  <os>
3e5111
+    <type arch='aarch64' machine='virt'>hvm</type>
3e5111
+  </os>
3e5111
+  <devices>
3e5111
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
3e5111
+    <controller type='usb' index='0'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
3e5111
+    </controller>
3e5111
+    <memballoon model='none'/>
3e5111
+  </devices>
3e5111
+</domain>
3e5111
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
3e5111
index 81cd2a6ec..ca1d23c10 100644
3e5111
--- a/tests/qemuxml2argvtest.c
3e5111
+++ b/tests/qemuxml2argvtest.c
3e5111
@@ -2477,6 +2477,10 @@ mymain(void)
3e5111
     DO_TEST("ppc64-usb-controller-legacy",
3e5111
             QEMU_CAPS_PIIX3_USB_UHCI);
3e5111
 
3e5111
+    DO_TEST("aarch64-usb-controller-nec-xhci",
3e5111
+            QEMU_CAPS_OBJECT_GPEX,
3e5111
+            QEMU_CAPS_NEC_USB_XHCI);
3e5111
+
3e5111
     DO_TEST_PARSE_FLAGS_ERROR("missing-machine",
3e5111
                               VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS,
3e5111
                               NONE);
3e5111
-- 
3e5111
2.12.2
3e5111