From 03b804a200e214e3faf264b16f41a640c1344962 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Mon, 14 May 2012 13:22:58 +0100 Subject: [PATCH] Set a sensible default master start port for ehci companion controllers The uhci1, uhci2, uhci3 companion controllers for ehci1 must have a master start port set. Since this value is predictable we should set it automatically if the app does not supply it --- src/conf/domain_conf.c | 22 +++++++++++++++++ .../qemuxml2argv-usb-ich9-ehci-addr.xml | 24 +++++-------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e43d76ddb7..79355e2f78 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4073,6 +4073,28 @@ virDomainControllerDefParseXML(xmlNodePtr node, VIR_FREE(vectors); break; } + case VIR_DOMAIN_CONTROLLER_TYPE_USB: { + /* If the XML has a uhci1, uhci2, uhci3 controller and no + * master port was given, we should set a sensible one */ + int masterPort = -1; + switch (def->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1: + masterPort = 0; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2: + masterPort = 2; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3: + masterPort = 4; + break; + } + if (masterPort != -1 && + def->info.mastertype == VIR_DOMAIN_CONTROLLER_MASTER_NONE) { + def->info.mastertype = VIR_DOMAIN_CONTROLLER_MASTER_USB; + def->info.master.usb.startport = masterPort; + } + break; + } default: break; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml index 8eff1d7e65..ad85d63b39 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml @@ -19,19 +19,13 @@ - - - - - - + + - - - + @@ -39,15 +33,9 @@ - - - - - - - - - + + + -- GitLab