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