[libvirt] [PATCH 1/3] PIIX3 USB controller is on function 2

Current code reserves slot 1 function 2 even if there is a user defined PIIX3 USB controller there. --- src/qemu/qemu_command.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6ff1b2c..e4bdb57 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1181,7 +1181,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) * hardcoded slot=1, multifunction device */ for (function = 0; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) { - if (function == 1 && (reservedIDE || reservedUSB)) + if ((function == 1 && reservedIDE) || + (function == 2 && reservedUSB)) /* we have reserved this pci address */ continue; -- 1.7.6

--- src/qemu/qemu_command.c | 3 ++- .../qemuxml2argv-usb-controller.args | 2 +- .../qemuxml2argv-usb-controller.xml | 4 +++- tests/qemuxml2argvdata/qemuxml2argv-usb-hub.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb-ports.args | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e4bdb57..c7c183a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1156,7 +1156,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) } } else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && def->controllers[i]->idx == 0 && - def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI) { + (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI || + def->controllers[i]->model == -1)) { if (def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { if (def->controllers[i]->info.addr.pci.domain != 0 || def->controllers[i]->info.addr.pci.bus != 0 || diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.args index f21efc7..ff7a080 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.args @@ -1 +1 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml index 82b503e..eb8f5ba 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml @@ -10,7 +10,9 @@ </os> <devices> <emulator>/usr/bin/qemu</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <memballoon model='virtio'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.args index 4911dd4..32c4c0e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.args @@ -1 +1 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -device usb-hub,id=hub0,bus=usb.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -device usb-hub,id=hub0,bus=usb.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.args index 556eb4c..9c65890 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.args @@ -1 +1 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -device usb-hub,id=hub0,bus=usb.0,port=1 -device usb-hub,id=hub1,bus=usb.0,port=1.2 -device usb-mouse,id=input0,bus=usb.0,port=1.1 -device usb-mouse,id=input1,bus=usb.0,port=1.2.1 -device usb-mouse,id=input2,bus=usb.0,port=1.2.2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -device usb-hub,id=hub0,bus=usb.0,port=1 -device usb-hub,id=hub1,bus=usb.0,port=1.2 -device usb-mouse,id=input0,bus=usb.0,port=1.1 -device usb-mouse,id=input1,bus=usb.0,port=1.2.1 -device usb-mouse,id=input2,bus=usb.0,port=1.2.2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -- 1.7.6

--- tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args | 15 ++++ tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml | 74 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 4 + 3 files changed, 93 insertions(+), 0 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args new file mode 100644 index 0000000..be4a78e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args @@ -0,0 +1,15 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \ +-device piix3-usb-uhci,id=usb,bus=pci.0,multifunction=on,addr=0x1.0x2 \ +-device ich9-usb-ehci1,id=usb1,bus=pci.0,multifunction=on,addr=0x4.0x7 \ +-device ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4.0x0 \ +-device ich9-usb-uhci2,masterbus=usb1.0,firstport=2,bus=pci.0,multifunction=on,addr=0x4.0x1 \ +-device ich9-usb-uhci3,masterbus=usb1.0,firstport=4,bus=pci.0,multifunction=on,addr=0x4.0x2 \ +-device ich9-usb-ehci1,id=usb2,bus=pci.0,multifunction=on,addr=0x5.0x7 \ +-device ich9-usb-uhci1,masterbus=usb2.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5.0x0 \ +-device ich9-usb-uhci2,masterbus=usb2.0,firstport=2,bus=pci.0,multifunction=on,addr=0x5.0x1 \ +-device ich9-usb-uhci3,masterbus=usb2.0,firstport=4,bus=pci.0,multifunction=on,addr=0x5.0x2 \ +-device usb-hub,id=hub0,bus=usb1.0,port=1 \ +-device usb-tablet,id=input0,bus=usb.0,port=2 \ +-device usb-host,hostbus=14,hostaddr=6,id=hostdev0,bus=usb2.0,port=1 \ +-device usb-host,hostbus=14,hostaddr=7,id=hostdev1,bus=usb2.0,port=2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,multifunction=on,addr=0x3.0x0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml new file mode 100644 index 0000000..e8ada4d --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml @@ -0,0 +1,74 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219136</memory> + <currentMemory>219200</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <devices> + <emulator>/usr/bin/qemu</emulator> + <memballoon model='virtio'/> + + <controller type='usb' index='0' model='piix3-uhci'> + <address type='pci' domain='0' bus='0' slot='1' function='2'/> + </controller> + + <controller type='usb' index='1' model='ich9-ehci1'> + <address type='pci' domain='0' bus='0' slot='4' function='7'/> + </controller> + <controller type='usb' index='1' model='ich9-uhci1'> + <master startport='0'/> + <address type='pci' domain='0' bus='0' slot='4' function='0'/> + </controller> + <controller type='usb' index='1' model='ich9-uhci2'> + <master startport='2'/> + <address type='pci' domain='0' bus='0' slot='4' function='1'/> + </controller> + <controller type='usb' index='1' model='ich9-uhci3'> + <master startport='4'/> + <address type='pci' domain='0' bus='0' slot='4' function='2'/> + </controller> + + <controller type='usb' index='2' model='ich9-ehci1'> + <address type='pci' domain='0' bus='0' slot='5' function='7'/> + </controller> + <controller type='usb' index='2' model='ich9-uhci1'> + <master startport='0'/> + <address type='pci' domain='0' bus='0' slot='5' function='0'/> + </controller> + <controller type='usb' index='2' model='ich9-uhci2'> + <master startport='2'/> + <address type='pci' domain='0' bus='0' slot='5' function='1'/> + </controller> + <controller type='usb' index='2' model='ich9-uhci3'> + <master startport='4'/> + <address type='pci' domain='0' bus='0' slot='5' function='2'/> + </controller> + + <input type='tablet' bus='usb'> + <address type='usb' bus='0' port='2'/> + </input> + + <hub type='usb'> + <address type='usb' bus='1' port='1'/> + </hub> + + <hostdev mode='subsystem' type='usb'> + <source> + <address bus='14' device='6'/> + </source> + <address type='usb' bus='2' port='1'/> + </hostdev> + + <hostdev mode='subsystem' type='usb'> + <source> + <address bus='14' device='7'/> + </source> + <address type='usb' bus='2' port='2'/> + </hostdev> + + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4c2754d..335af4a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -512,6 +512,10 @@ mymain(void) QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR, QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC); + DO_TEST("usb1-usb2", false, + QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_PIIX3_USB_UHCI, + QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1); DO_TEST("smbios", false, QEMU_CAPS_SMBIOS_TYPE); -- 1.7.6

On Fri, Sep 02, 2011 at 07:43:33PM +0200, Marc-André Lureau wrote:
--- tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args | 15 ++++ tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml | 74 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 4 + 3 files changed, 93 insertions(+), 0 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml
Okay that time this one applies and run fine, I commited the 3 patches from the series thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Fri, Sep 02, 2011 at 07:43:31PM +0200, Marc-André Lureau wrote:
Current code reserves slot 1 function 2 even if there is a user defined PIIX3 USB controller there. --- src/qemu/qemu_command.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6ff1b2c..e4bdb57 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1181,7 +1181,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) * hardcoded slot=1, multifunction device */ for (function = 0; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) { - if (function == 1 && (reservedIDE || reservedUSB)) + if ((function == 1 && reservedIDE) || + (function == 2 && reservedUSB)) /* we have reserved this pci address */ continue;
Yeah, I had to manually tweak that part on the rebase and of course got it wrong ! Thanks for the quick fix :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Marc-André Lureau