|
|
3e5111 |
From 41750fbfbd634a090bbe399e18196d080e89b014 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <41750fbfbd634a090bbe399e18196d080e89b014@dist-git>
|
|
|
3e5111 |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
Date: Fri, 28 Apr 2017 11:59:50 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: add support for qemu-xhci USB controller
|
|
|
3e5111 |
|
|
|
3e5111 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438682
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
Acked-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
3e5111 |
(cherry picked from commit 278e70f8f8bac9e6482099d7f3f1a7a8f2109b5f)
|
|
|
3e5111 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
docs/formatdomain.html.in | 4 ++--
|
|
|
3e5111 |
docs/schemas/domaincommon.rng | 1 +
|
|
|
3e5111 |
src/conf/domain_addr.c | 1 +
|
|
|
3e5111 |
src/conf/domain_conf.c | 1 +
|
|
|
3e5111 |
src/conf/domain_conf.h | 1 +
|
|
|
3e5111 |
src/qemu/qemu_command.c | 8 ++++++--
|
|
|
3e5111 |
src/qemu/qemu_domain.c | 12 +++++++-----
|
|
|
3e5111 |
src/qemu/qemu_domain_address.c | 1 +
|
|
|
3e5111 |
.../qemuxml2argv-usb-controller-qemu-xhci-limit.xml | 14 ++++++++++++++
|
|
|
3e5111 |
...uxml2argv-usb-controller-qemu-xhci-unavailable.xml | 1 +
|
|
|
3e5111 |
.../qemuxml2argv-usb-controller-qemu-xhci.args | 19 +++++++++++++++++++
|
|
|
3e5111 |
.../qemuxml2argv-usb-controller-qemu-xhci.xml | 14 ++++++++++++++
|
|
|
3e5111 |
tests/qemuxml2argvtest.c | 4 ++++
|
|
|
3e5111 |
13 files changed, 72 insertions(+), 9 deletions(-)
|
|
|
3e5111 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-limit.xml
|
|
|
3e5111 |
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-unavailable.xml
|
|
|
3e5111 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci.args
|
|
|
3e5111 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci.xml
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
3e5111 |
index c82cd69a2..2dc5e751a 100644
|
|
|
3e5111 |
--- a/docs/formatdomain.html.in
|
|
|
3e5111 |
+++ b/docs/formatdomain.html.in
|
|
|
3e5111 |
@@ -3495,8 +3495,8 @@
|
|
|
3e5111 |
model , which is one of "piix3-uhci", "piix4-uhci",
|
|
|
3e5111 |
"ehci", "ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3",
|
|
|
3e5111 |
"vt82c686b-uhci", "pci-ohci", "nec-xhci", "qusb1" (xen pvusb
|
|
|
3e5111 |
- with qemu backend, version 1.1) or "qusb2" (xen pvusb with qemu
|
|
|
3e5111 |
- backend, version 2.0). Additionally,
|
|
|
3e5111 |
+ with qemu backend, version 1.1), "qusb2" (xen pvusb with qemu
|
|
|
3e5111 |
+ backend, version 2.0) or "qemu-xhci". Additionally,
|
|
|
3e5111 |
since 0.10.0, if the USB bus needs to
|
|
|
3e5111 |
be explicitly disabled for the guest, model='none'
|
|
|
3e5111 |
may be used. Since 1.0.5, no default
|
|
|
3e5111 |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
3e5111 |
index 7a9b4b702..7271f0113 100644
|
|
|
3e5111 |
--- a/docs/schemas/domaincommon.rng
|
|
|
3e5111 |
+++ b/docs/schemas/domaincommon.rng
|
|
|
3e5111 |
@@ -1877,6 +1877,7 @@
|
|
|
3e5111 |
<value>none</value>
|
|
|
3e5111 |
<value>qusb1</value>
|
|
|
3e5111 |
<value>qusb2</value>
|
|
|
3e5111 |
+ <value>qemu-xhci</value>
|
|
|
3e5111 |
</choice>
|
|
|
3e5111 |
</attribute>
|
|
|
3e5111 |
</optional>
|
|
|
3e5111 |
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
|
|
3e5111 |
index 8b6109199..639168eff 100644
|
|
|
3e5111 |
--- a/src/conf/domain_addr.c
|
|
|
3e5111 |
+++ b/src/conf/domain_addr.c
|
|
|
3e5111 |
@@ -1673,6 +1673,7 @@ virDomainUSBAddressControllerModelToPorts(virDomainControllerDefPtr cont)
|
|
|
3e5111 |
return 3;
|
|
|
3e5111 |
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
|
|
|
3e5111 |
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
|
|
|
3e5111 |
if (cont->opts.usbopts.ports != -1)
|
|
|
3e5111 |
return cont->opts.usbopts.ports;
|
|
|
3e5111 |
return 4;
|
|
|
3e5111 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
3e5111 |
index 2d5d00cf2..7ab5e5051 100644
|
|
|
3e5111 |
--- a/src/conf/domain_conf.c
|
|
|
3e5111 |
+++ b/src/conf/domain_conf.c
|
|
|
3e5111 |
@@ -366,6 +366,7 @@ VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
|
|
|
3e5111 |
"nec-xhci",
|
|
|
3e5111 |
"qusb1",
|
|
|
3e5111 |
"qusb2",
|
|
|
3e5111 |
+ "qemu-xhci",
|
|
|
3e5111 |
"none")
|
|
|
3e5111 |
|
|
|
3e5111 |
VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
|
|
|
3e5111 |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
3e5111 |
index 1dbbcdc51..c91791262 100644
|
|
|
3e5111 |
--- a/src/conf/domain_conf.h
|
|
|
3e5111 |
+++ b/src/conf/domain_conf.h
|
|
|
3e5111 |
@@ -735,6 +735,7 @@ typedef enum {
|
|
|
3e5111 |
VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
|
|
|
3e5111 |
VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1,
|
|
|
3e5111 |
VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2,
|
|
|
3e5111 |
+ VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI,
|
|
|
3e5111 |
VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
|
|
|
3e5111 |
|
|
|
3e5111 |
VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
3e5111 |
index 9ce90c25b..30feef1de 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_command.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_command.c
|
|
|
3e5111 |
@@ -152,6 +152,7 @@ VIR_ENUM_IMPL(qemuControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
|
|
|
3e5111 |
"nec-usb-xhci",
|
|
|
3e5111 |
"qusb1",
|
|
|
3e5111 |
"qusb2",
|
|
|
3e5111 |
+ "qemu-xhci",
|
|
|
3e5111 |
"none");
|
|
|
3e5111 |
|
|
|
3e5111 |
VIR_ENUM_DECL(qemuDomainFSDriver)
|
|
|
3e5111 |
@@ -2558,6 +2559,8 @@ qemuControllerModelUSBToCaps(int model)
|
|
|
3e5111 |
return QEMU_CAPS_PCI_OHCI;
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
|
|
|
3e5111 |
return QEMU_CAPS_NEC_USB_XHCI;
|
|
|
3e5111 |
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
|
|
|
3e5111 |
+ return QEMU_CAPS_DEVICE_QEMU_XHCI;
|
|
|
3e5111 |
default:
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
@@ -2592,8 +2595,9 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def,
|
|
|
3e5111 |
virBufferAsprintf(buf, "%s", smodel);
|
|
|
3e5111 |
|
|
|
3e5111 |
if (def->opts.usbopts.ports != -1) {
|
|
|
3e5111 |
- if (model != VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI ||
|
|
|
3e5111 |
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI_PORTS)) {
|
|
|
3e5111 |
+ if ((model != VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI ||
|
|
|
3e5111 |
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI_PORTS)) &&
|
|
|
3e5111 |
+ model != VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
3e5111 |
_("usb controller type %s doesn't support 'ports' "
|
|
|
3e5111 |
"with this QEMU binary"), smodel);
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
index 25ab1f639..4d7de60cb 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain.c
|
|
|
3e5111 |
@@ -3194,7 +3194,7 @@ qemuDomainShmemDefPostParse(virDomainShmemDefPtr shm)
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
-#define QEMU_USB_NEC_XHCI_MAXPORTS 15
|
|
|
3e5111 |
+#define QEMU_USB_XHCI_MAXPORTS 15
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
@@ -3262,11 +3262,13 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
|
|
|
3e5111 |
virDomainVirtTypeToString(def->virtType));
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
- if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI &&
|
|
|
3e5111 |
- cont->opts.usbopts.ports > QEMU_USB_NEC_XHCI_MAXPORTS) {
|
|
|
3e5111 |
+ if ((cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI ||
|
|
|
3e5111 |
+ cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI) &&
|
|
|
3e5111 |
+ cont->opts.usbopts.ports > QEMU_USB_XHCI_MAXPORTS) {
|
|
|
3e5111 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
3e5111 |
- _("nec-xhci controller only supports up to %u ports"),
|
|
|
3e5111 |
- QEMU_USB_NEC_XHCI_MAXPORTS);
|
|
|
3e5111 |
+ _("'%s' controller only supports up to '%u' ports"),
|
|
|
3e5111 |
+ virDomainControllerModelUSBTypeToString(cont->model),
|
|
|
3e5111 |
+ QEMU_USB_XHCI_MAXPORTS);
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
|
|
|
3e5111 |
index 064d05079..3da6b7369 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_domain_address.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_domain_address.c
|
|
|
3e5111 |
@@ -502,6 +502,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
|
|
|
3e5111 |
switch ((virDomainControllerModelUSB) cont->model) {
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
|
|
|
3e5111 |
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
|
|
|
3e5111 |
return pcieFlags;
|
|
|
3e5111 |
|
|
|
3e5111 |
case VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI:
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-limit.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-limit.xml
|
|
|
3e5111 |
new file mode 100644
|
|
|
3e5111 |
index 000000000..27cc99127
|
|
|
3e5111 |
--- /dev/null
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-limit.xml
|
|
|
3e5111 |
@@ -0,0 +1,14 @@
|
|
|
3e5111 |
+<domain type='qemu'>
|
|
|
3e5111 |
+ <name>QEMUGuest1</name>
|
|
|
3e5111 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
3e5111 |
+ <memory unit='KiB'>219136</memory>
|
|
|
3e5111 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
3e5111 |
+ <os>
|
|
|
3e5111 |
+ <type arch='x86_64' machine='pc'>hvm</type>
|
|
|
3e5111 |
+ </os>
|
|
|
3e5111 |
+ <devices>
|
|
|
3e5111 |
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
|
|
3e5111 |
+ <controller type='usb' index='0' model='qemu-xhci' ports='16'/>
|
|
|
3e5111 |
+ <memballoon model='none'/>
|
|
|
3e5111 |
+ </devices>
|
|
|
3e5111 |
+</domain>
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-unavailable.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-unavailable.xml
|
|
|
3e5111 |
new file mode 120000
|
|
|
3e5111 |
index 000000000..989306fa7
|
|
|
3e5111 |
--- /dev/null
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci-unavailable.xml
|
|
|
3e5111 |
@@ -0,0 +1 @@
|
|
|
3e5111 |
+qemuxml2argv-usb-controller-qemu-xhci.xml
|
|
|
3e5111 |
\ No newline at end of file
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci.args
|
|
|
3e5111 |
new file mode 100644
|
|
|
3e5111 |
index 000000000..8adb3022f
|
|
|
3e5111 |
--- /dev/null
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-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-x86_64 \
|
|
|
3e5111 |
+-name QEMUGuest1 \
|
|
|
3e5111 |
+-S \
|
|
|
3e5111 |
+-M pc-0.11 \
|
|
|
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 qemu-xhci,p2=8,p3=8,id=usb,bus=pci.0,addr=0x3
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci.xml
|
|
|
3e5111 |
new file mode 100644
|
|
|
3e5111 |
index 000000000..b63f9e1c4
|
|
|
3e5111 |
--- /dev/null
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-qemu-xhci.xml
|
|
|
3e5111 |
@@ -0,0 +1,14 @@
|
|
|
3e5111 |
+<domain type='qemu'>
|
|
|
3e5111 |
+ <name>QEMUGuest1</name>
|
|
|
3e5111 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
3e5111 |
+ <memory unit='KiB'>219136</memory>
|
|
|
3e5111 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
3e5111 |
+ <os>
|
|
|
3e5111 |
+ <type arch='x86_64' machine='pc'>hvm</type>
|
|
|
3e5111 |
+ </os>
|
|
|
3e5111 |
+ <devices>
|
|
|
3e5111 |
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
|
|
3e5111 |
+ <controller type='usb' index='0' model='qemu-xhci' ports='8'/>
|
|
|
3e5111 |
+ <memballoon model='none'/>
|
|
|
3e5111 |
+ </devices>
|
|
|
3e5111 |
+</domain>
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
3e5111 |
index ca1d23c10..317f17e74 100644
|
|
|
3e5111 |
--- a/tests/qemuxml2argvtest.c
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
3e5111 |
@@ -1424,6 +1424,10 @@ mymain(void)
|
|
|
3e5111 |
DO_TEST_PARSE_ERROR("usb-controller-xhci-limit",
|
|
|
3e5111 |
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
|
|
|
3e5111 |
QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_NEC_USB_XHCI_PORTS);
|
|
|
3e5111 |
+ DO_TEST("usb-controller-qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI);
|
|
|
3e5111 |
+ DO_TEST_FAILURE("usb-controller-qemu-xhci-unavailable", NONE);
|
|
|
3e5111 |
+ DO_TEST_PARSE_ERROR("usb-controller-qemu-xhci-limit",
|
|
|
3e5111 |
+ QEMU_CAPS_DEVICE_QEMU_XHCI);
|
|
|
3e5111 |
|
|
|
3e5111 |
DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
|
|
|
3e5111 |
DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|