提交 278e70f8 编写于 作者: P Pavel Hrdina

qemu: add support for qemu-xhci USB controller

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438682Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
Acked-by: NAndrea Bolognani <abologna@redhat.com>
上级 5237a74d
......@@ -3498,8 +3498,8 @@
<code>model</code>, which is one of "piix3-uhci", "piix4-uhci",
"ehci", "ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3",
"vt82c686b-uhci", "pci-ohci", "nec-xhci", "qusb1" (xen pvusb
with qemu backend, version 1.1) or "qusb2" (xen pvusb with qemu
backend, version 2.0). Additionally,
with qemu backend, version 1.1), "qusb2" (xen pvusb with qemu
backend, version 2.0) or "qemu-xhci". Additionally,
<span class="since">since 0.10.0</span>, if the USB bus needs to
be explicitly disabled for the guest, <code>model='none'</code>
may be used. <span class="since">Since 1.0.5</span>, no default
......
......@@ -1931,6 +1931,7 @@
<value>none</value>
<value>qusb1</value>
<value>qusb2</value>
<value>qemu-xhci</value>
</choice>
</attribute>
</optional>
......
......@@ -1673,6 +1673,7 @@ virDomainUSBAddressControllerModelToPorts(virDomainControllerDefPtr cont)
return 3;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
if (cont->opts.usbopts.ports != -1)
return cont->opts.usbopts.ports;
return 4;
......
......@@ -366,6 +366,7 @@ VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
"nec-xhci",
"qusb1",
"qusb2",
"qemu-xhci",
"none")
VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
......
......@@ -735,6 +735,7 @@ typedef enum {
VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1,
VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2,
VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
......
......@@ -152,6 +152,7 @@ VIR_ENUM_IMPL(qemuControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
"nec-usb-xhci",
"qusb1",
"qusb2",
"qemu-xhci",
"none");
VIR_ENUM_DECL(qemuDomainFSDriver)
......@@ -2558,6 +2559,8 @@ qemuControllerModelUSBToCaps(int model)
return QEMU_CAPS_PCI_OHCI;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
return QEMU_CAPS_NEC_USB_XHCI;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
return QEMU_CAPS_DEVICE_QEMU_XHCI;
default:
return -1;
}
......@@ -2592,8 +2595,9 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def,
virBufferAsprintf(buf, "%s", smodel);
if (def->opts.usbopts.ports != -1) {
if (model != VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI ||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI_PORTS)) {
if ((model != VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI ||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI_PORTS)) &&
model != VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("usb controller type %s doesn't support 'ports' "
"with this QEMU binary"), smodel);
......
......@@ -3225,7 +3225,7 @@ qemuDomainShmemDefPostParse(virDomainShmemDefPtr shm)
}
#define QEMU_USB_NEC_XHCI_MAXPORTS 15
#define QEMU_USB_XHCI_MAXPORTS 15
static int
......@@ -3293,11 +3293,13 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
virDomainVirtTypeToString(def->virtType));
return -1;
}
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI &&
cont->opts.usbopts.ports > QEMU_USB_NEC_XHCI_MAXPORTS) {
if ((cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI ||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI) &&
cont->opts.usbopts.ports > QEMU_USB_XHCI_MAXPORTS) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("nec-xhci controller only supports up to %u ports"),
QEMU_USB_NEC_XHCI_MAXPORTS);
_("'%s' controller only supports up to '%u' ports"),
virDomainControllerModelUSBTypeToString(cont->model),
QEMU_USB_XHCI_MAXPORTS);
return -1;
}
break;
......
......@@ -502,6 +502,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
switch ((virDomainControllerModelUSB) cont->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
return pcieFlags;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI:
......
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
</os>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='qemu-xhci' ports='16'/>
<memballoon model='none'/>
</devices>
</domain>
qemuxml2argv-usb-controller-qemu-xhci.xml
\ No newline at end of file
LC_ALL=C \
PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-x86_64 \
-name QEMUGuest1 \
-S \
-M pc \
-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 qemu-xhci,p2=8,p3=8,id=usb,bus=pci.0,addr=0x3
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
</os>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='qemu-xhci' ports='8'/>
<memballoon model='none'/>
</devices>
</domain>
......@@ -1416,6 +1416,10 @@ mymain(void)
DO_TEST_PARSE_ERROR("usb-controller-xhci-limit",
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_NEC_USB_XHCI_PORTS);
DO_TEST("usb-controller-qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI);
DO_TEST_FAILURE("usb-controller-qemu-xhci-unavailable", NONE);
DO_TEST_PARSE_ERROR("usb-controller-qemu-xhci-limit",
QEMU_CAPS_DEVICE_QEMU_XHCI);
DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册