USB controller
UHCI/OHCI model: VIR_DOMAIN_USB_SEPC_1_1
EHCI model: VIR_DOMAIN_USB_SPEC_2_0
XHCI model: VIR_DOMAIN_USB_SEPC_1_1| \
VIR_DOMAIN_USB_SPEC_2_0| \
VIR_DOMAIN_USB_SPEC_3_0
VIR_DOMAIN_USB_CONTROLLER_UHCI_PORTN_2 = 2
VIR_DOMAIN_USB_CONTROLLER_OHCI_PORTN_3 = 3
VIR_DOMAIN_USB_CONTROLLER_XHCI_PORTN_4 = 4
VIR_DOMAIN_USB_CONTROLLER_EHCI_PORTN_6 = 6
---
src/conf/domain_conf.c | 69 +++++++++++++++++++++++++++++++++++++++++++------
src/qemu/qemu_command.c | 8 ++++--
2 files changed, 67 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 646baab..a0946cc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4445,11 +4445,67 @@ static int
virDomainControllerModelTypeFromString(const virDomainControllerDefPtr def,
const char *model)
{
- if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
- return virDomainControllerModelSCSITypeFromString(model);
- else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB)
- return virDomainControllerModelUSBTypeFromString(model);
+ if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
+ (def->model = virDomainControllerModelSCSITypeFromString(model)) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown SCSI controller model type '%s'"),
model);
+ goto error;
+ }
+
+ if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) {
+ virDomainUSBControllerDataPtr usbController = &def->data.usb;
+
+ if ((def->model = virDomainControllerModelUSBTypeFromString(model)) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown USB controller model type '%s'"),
model);
+ goto error;
+ }
+
+ switch (def->model) {
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI:
+ usbController->spec = VIR_DOMAIN_USB_SEPC_1_1;
+ usbController->nports = VIR_DOMAIN_USB_CONTROLLER_UHCI_PORTN_2;
+ break;
+
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI:
+ usbController->spec = VIR_DOMAIN_USB_SEPC_1_1;
+ usbController->nports = VIR_DOMAIN_USB_CONTROLLER_OHCI_PORTN_3;
+ break;
+
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
+ usbController->spec = VIR_DOMAIN_USB_SPEC_2_0;
+ usbController->nports = VIR_DOMAIN_USB_CONTROLLER_EHCI_PORTN_6;
+ break;
+
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
+ usbController->spec = VIR_DOMAIN_USB_SEPC_1_1 |
+ VIR_DOMAIN_USB_SPEC_2_0 |
+ VIR_DOMAIN_USB_SPEC_3_0;
+ usbController->nports = VIR_DOMAIN_USB_CONTROLLER_XHCI_PORTN_4;
+ break;
+
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE:
+ usbController->spec = VIR_DOMAIN_USB_SPEC_NONE;
+ usbController->nports = 0;
+ break;
+
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to determine USB Specification "
+ "supported by USB constroller mode %s"),
+ virDomainControllerModelUSBTypeToString(def->model));
+ goto error;
+ };
+ }
+ return 0;
+error:
return -1;
}
@@ -4490,11 +4546,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
model = virXMLPropString(node, "model");
if (model) {
- if ((def->model = virDomainControllerModelTypeFromString(def, model)) < 0)
{
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unknown model type '%s'"), model);
+ if (virDomainControllerModelTypeFromString(def, model) < 0)
goto error;
- }
} else {
def->model = -1;
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 71e69f3..78276b5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3010,10 +3010,14 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
model = def->model;
if (model == -1) {
- if (domainDef->os.arch == VIR_ARCH_PPC64)
+ if (domainDef->os.arch == VIR_ARCH_PPC64) {
model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
- else
+ def->data.usb.nports = VIR_DOMAIN_USB_CONTROLLER_OHCI_PORTN_3;
+ } else {
model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI;
+ def->data.usb.nports = VIR_DOMAIN_USB_CONTROLLER_UHCI_PORTN_2;
+ }
+ def->data.usb.spec = VIR_DOMAIN_USB_SEPC_1_1;
}
smodel = qemuControllerModelUSBTypeToString(model);
--
1.7.11.4