From be146b349f603cdf1d86701418fa111323c40f12 Mon Sep 17 00:00:00 2001 From: Chunyan Liu Date: Wed, 15 Jun 2016 14:00:08 +0800 Subject: [PATCH] extend usb controller model to support xen pvusb According to libxl implementation, it supports pvusb controller of version 1.1 and version 2.0, and it supports two types of backend, 'pvusb' (dom0 backend) and 'qusb' (qemu backend). But currently pvusb backend is not checked in yet. To match libxl support, extend usb controller schema to support two more models: qusb1 (qusb, version 1.1) and 'qusb2' (qusb version 2.0). Signed-off-by: Chunyan Liu --- docs/formatdomain.html.in | 4 +++- docs/schemas/domaincommon.rng | 2 ++ src/conf/domain_addr.c | 6 ++++++ src/conf/domain_conf.c | 2 ++ src/conf/domain_conf.h | 2 ++ src/qemu/qemu_command.c | 2 ++ 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8efd6af01d..c4198360b4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3122,7 +3122,9 @@
A usb controller has an optional attribute model, which is one of "piix3-uhci", "piix4-uhci", "ehci", "ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3", - "vt82c686b-uhci", "pci-ohci" or "nec-xhci". Additionally, + "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, since 0.10.0, if the USB bus needs to be explicitly disabled for the guest, model='none' may be used. Since 1.0.5, no default diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ac9fd21816..727014014e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1782,6 +1782,8 @@ pci-ohci nec-xhci none + qusb1 + qusb2 diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 9148ca65fa..a0c2f88076 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1393,6 +1393,12 @@ virDomainUSBAddressControllerModelToPorts(virDomainControllerDefPtr cont) return cont->opts.usbopts.ports; return 4; + case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1: + case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2: + if (cont->opts.usbopts.ports != -1) + return cont->opts.usbopts.ports; + return 8; + case VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE: case VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST: break; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7f876de878..0d6a154177 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -359,6 +359,8 @@ VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST, "vt82c686b-uhci", "pci-ohci", "nec-xhci", + "qusb1", + "qusb2", "none") VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 3c2f18231f..da61ee09aa 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -681,6 +681,8 @@ typedef enum { VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI, VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI, VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI, + VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1, + VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2, VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5325f48dbb..526b54c00a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -133,6 +133,8 @@ VIR_ENUM_IMPL(qemuControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST, "vt82c686b-usb-uhci", "pci-ohci", "nec-usb-xhci", + "qusb1", + "qusb2", "none"); VIR_ENUM_DECL(qemuDomainFSDriver)