Re: [PATCH 2/5] qemu: prefer 00:1D.x and 00:1A.x for USB2 controllers on Q35

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11/19/2015 01:24 PM, Laine Stump wrote:
> The real Q35 machine puts the first USB controller set (EHCI+(UHCIx4))
> on bus 0 slot 0x1D, and the 2nd USB controller set on bus 0 slot 0x1A,
> so let's attempt to make the virtual machine match that for
> controllers with auto-assigned addresses when possible.
> 
> Three test cases were added to assure that the proper addresses are
> assigned - one with a single set of unaddressed USB controllers, one
> with 3 (to grab both preferred slots plus one more), and one with the
> order of the controller definitions reordered, to assure that the
> auto-assignment isn't mixed up by order.
> ---
>  src/qemu/qemu_command.c                            | 52 ++++++++++++++++-
>  .../qemuxml2argv-q35-usb2-multi.args               | 40 +++++++++++++
>  .../qemuxml2argv-q35-usb2-multi.xml                | 47 +++++++++++++++
>  .../qemuxml2argv-q35-usb2-reorder.args             | 40 +++++++++++++
>  .../qemuxml2argv-q35-usb2-reorder.xml              | 47 +++++++++++++++
>  tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.args  | 30 ++++++++++
>  tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.xml   | 39 +++++++++++++
>  tests/qemuxml2argvtest.c                           | 21 +++++++
>  .../qemuxml2xmlout-q35-usb2-multi.xml              | 66 ++++++++++++++++++++++
>  .../qemuxml2xmlout-q35-usb2-reorder.xml            | 66 ++++++++++++++++++++++
>  .../qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml | 46 +++++++++++++++
>  tests/qemuxml2xmltest.c                            |  3 +
>  12 files changed, 494 insertions(+), 3 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.xml
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.xml
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.xml
>  create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml
>  create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml
>  create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 3c867de..06e3073 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2049,6 +2049,47 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
>              }
>              break;
>  
> +        case VIR_DOMAIN_CONTROLLER_TYPE_USB:
> +            if ((def->controllers[i]->model
> +                 == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1) &&
> +                (def->controllers[i]->info.type
> +                 == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)) {
> +                /* Try to assign the first found USB2 controller to
> +                 * 00:1D.0 and 2nd to 00:1A.0 (because that is their
> +                 * standard location on real Q35 hardware) unless they
> +                 * are already taken, but don't insist on it.
> +                 *
> +                 * (NB: all other controllers at the same index will
> +                 * get assigned to the same slot as the UHCI1 when
> +                 * addresses are later assigned to all devices.)
> +                 */
> +                bool assign = false;
> +
> +                memset(&tmp_addr, 0, sizeof(tmp_addr));
> +                tmp_addr.slot = 0x1D;
> +                if (!virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
> +                    assign = true;
> +                } else {
> +                    tmp_addr.slot = 0x1A;
> +                    if (!virDomainPCIAddressSlotInUse(addrs, &tmp_addr))
> +                        assign = true;
> +                }
> +                if (assign) {
> +                    if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr,
> +                                                       flags, false, true) < 0)

Should param5 be 'false' since we're running from qemu_command and not
fromConfig ?

> +                        goto cleanup;

So is this 'cleanup' case a condition where perhaps the bus was full?
IOW: Do we want to fail or just let code that would handle the case
where assign = false would then (I assume) later on assign an address on
some available slot?

So the result would be

   if (virDomainPCIAddressReserveAddr(...) == 0) {
       def->controllers
       ...
   }

?

> +                    def->controllers[i]->info.type
> +                        = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
> +                    def->controllers[i]->info.addr.pci.domain = 0;
> +                    def->controllers[i]->info.addr.pci.bus = 0;
> +                    def->controllers[i]->info.addr.pci.slot = tmp_addr.slot;
> +                    def->controllers[i]->info.addr.pci.function = 0;
> +                    def->controllers[i]->info.addr.pci.multi
> +                       = VIR_TRISTATE_SWITCH_ON;

Not for 'this' patch per se, but there's 3 other places in
qemu_command.c that fill in multi with 0 or 1 that probably should use
the TRISTATE value...  One I noted from patch 1, but how about a patch
1.5 or 0.5 that changes all the existing multi settings to use the
appropriate TRISTATE value. I'm assuming setting to 0 or 1 is correct
where they are, but since you understand the topology better I figured
we could use the opportunity to make sure that assumption is true!

> +                }
> +            }
> +            break;
> +
>          case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
>              if (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE &&
>                  def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
> @@ -2522,9 +2563,11 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>              bool foundAddr = false;
>  
>              memset(&tmp_addr, 0, sizeof(tmp_addr));
> -            for (j = 0; j < i; j++) {
> +            for (j = 0; j < def->ncontrollers; j++) {
>                  if (IS_USB2_CONTROLLER(def->controllers[j]) &&
> -                    def->controllers[j]->idx == def->controllers[i]->idx) {
> +                    def->controllers[j]->idx == def->controllers[i]->idx &&
> +                    def->controllers[j]->info.type
> +                    == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
>                      addr = def->controllers[j]->info.addr.pci;
>                      foundAddr = true;
>                      break;
> @@ -2534,6 +2577,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>              switch (def->controllers[i]->model) {
>              case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
>                  addr.function = 7;
> +                addr.multi = VIR_TRISTATE_SWITCH_ABSENT;
>                  break;
>              case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
>                  addr.function = 0;
> @@ -2541,9 +2585,11 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>                  break;
>              case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
>                  addr.function = 1;
> +                addr.multi = VIR_TRISTATE_SWITCH_ABSENT;
>                  break;
>              case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3:
>                  addr.function = 2;
> +                addr.multi = VIR_TRISTATE_SWITCH_ABSENT;
>                  break;
>              }
>  

See and all these use the correct value (which is fine by me).

Conditional ACK based on usage of virDomainPCIAddressReserveAddr param5
and what I believe should be only checking the success scenario and
allowing whatever processing would happen to fill in the address in the
event of failure...

John

> @@ -2562,7 +2608,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>              }
>              /* Finally we can reserve the slot+function */
>              if (virDomainPCIAddressReserveAddr(addrs, &addr, flags,
> -                                               false, false) < 0)
> +                                               false, foundAddr) < 0)
>                  goto error;
>  
>              def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.args b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.args
> new file mode 100644
> index 0000000..0d6ddd8
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.args
> @@ -0,0 +1,40 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/libexec/qemu-kvm \
> +-name q35-test \
> +-S \
> +-M q35 \
> +-m 2048 \
> +-smp 2 \
> +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
> +-nographic \
> +-nodefaults \
> +-monitor unix:/tmp/test-monitor,server,nowait \
> +-no-acpi \
> +-boot c \
> +-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
> +-device pci-bridge,chassis_nr=56,id=pci.2,bus=pci.1,addr=0x1 \
> +-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
> +-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
> +addr=0x1d \
> +-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
> +-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
> +-device ich9-usb-ehci1,id=usb1,bus=pcie.0,addr=0x1a.0x7 \
> +-device ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pcie.0,multifunction=on,\
> +addr=0x1a \
> +-device ich9-usb-uhci2,masterbus=usb1.0,firstport=2,bus=pcie.0,addr=0x1a.0x1 \
> +-device ich9-usb-uhci3,masterbus=usb1.0,firstport=4,bus=pcie.0,addr=0x1a.0x2 \
> +-device ich9-usb-ehci1,id=usb2,bus=pci.2,addr=0x1.0x7 \
> +-device ich9-usb-uhci1,masterbus=usb2.0,firstport=0,bus=pci.2,multifunction=on,\
> +addr=0x1 \
> +-device ich9-usb-uhci2,masterbus=usb2.0,firstport=2,bus=pci.2,addr=0x1.0x1 \
> +-device ich9-usb-uhci3,masterbus=usb2.0,firstport=4,bus=pci.2,addr=0x1.0x2 \
> +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0,format=raw \
> +-device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
> +-vga qxl \
> +-global qxl-vga.ram_size=67108864 \
> +-global qxl-vga.vram_size=33554432
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.xml
> new file mode 100644
> index 0000000..3adb81f
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-multi.xml
> @@ -0,0 +1,47 @@
> +<domain type='qemu'>
> +  <name>q35-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='q35'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <disk type='block' device='disk'>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='sda' bus='sata'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
> +      <model name='i82801b11-bridge'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pci-bridge'>
> +      <model name='pci-bridge'/>
> +      <target chassisNr='56'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-ehci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci2'/>
> +    <controller type='usb' index='0' model='ich9-uhci3'/>
> +    <controller type='usb' index='1' model='ich9-ehci1'/>
> +    <controller type='usb' index='1' model='ich9-uhci1'/>
> +    <controller type='usb' index='1' model='ich9-uhci2'/>
> +    <controller type='usb' index='1' model='ich9-uhci3'/>
> +    <controller type='usb' index='2' model='ich9-ehci1'/>
> +    <controller type='usb' index='2' model='ich9-uhci1'/>
> +    <controller type='usb' index='2' model='ich9-uhci2'/>
> +    <controller type='usb' index='2' model='ich9-uhci3'/>
> +    <video>
> +      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
> +    </video>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.args b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.args
> new file mode 100644
> index 0000000..6ce05f4
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.args
> @@ -0,0 +1,40 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/libexec/qemu-kvm \
> +-name q35-test \
> +-S \
> +-M q35 \
> +-m 2048 \
> +-smp 2 \
> +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
> +-nographic \
> +-nodefaults \
> +-monitor unix:/tmp/test-monitor,server,nowait \
> +-no-acpi \
> +-boot c \
> +-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
> +-device pci-bridge,chassis_nr=56,id=pci.2,bus=pci.1,addr=0x1 \
> +-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
> +-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
> +addr=0x1d \
> +-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
> +-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
> +-device ich9-usb-ehci1,id=usb1,bus=pcie.0,addr=0x1a.0x7 \
> +-device ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pcie.0,multifunction=on,\
> +addr=0x1a \
> +-device ich9-usb-uhci3,masterbus=usb1.0,firstport=4,bus=pcie.0,addr=0x1a.0x2 \
> +-device ich9-usb-uhci2,masterbus=usb1.0,firstport=2,bus=pcie.0,addr=0x1a.0x1 \
> +-device ich9-usb-ehci1,id=usb2,bus=pci.2,addr=0x1.0x7 \
> +-device ich9-usb-uhci3,masterbus=usb2.0,firstport=4,bus=pci.2,addr=0x1.0x2 \
> +-device ich9-usb-uhci2,masterbus=usb2.0,firstport=2,bus=pci.2,addr=0x1.0x1 \
> +-device ich9-usb-uhci1,masterbus=usb2.0,firstport=0,bus=pci.2,multifunction=on,\
> +addr=0x1 \
> +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0,format=raw \
> +-device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
> +-vga qxl \
> +-global qxl-vga.ram_size=67108864 \
> +-global qxl-vga.vram_size=33554432
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.xml
> new file mode 100644
> index 0000000..f7efdc2
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2-reorder.xml
> @@ -0,0 +1,47 @@
> +<domain type='qemu'>
> +  <name>q35-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='q35'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <disk type='block' device='disk'>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='sda' bus='sata'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
> +      <model name='i82801b11-bridge'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pci-bridge'>
> +      <model name='pci-bridge'/>
> +      <target chassisNr='56'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-uhci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci2'/>
> +    <controller type='usb' index='0' model='ich9-uhci3'/>
> +    <controller type='usb' index='1' model='ich9-uhci1'/>
> +    <controller type='usb' index='2' model='ich9-uhci3'/>
> +    <controller type='usb' index='0' model='ich9-ehci1'/>
> +    <controller type='usb' index='2' model='ich9-ehci1'/>
> +    <controller type='usb' index='1' model='ich9-uhci3'/>
> +    <controller type='usb' index='1' model='ich9-uhci2'/>
> +    <controller type='usb' index='1' model='ich9-ehci1'/>
> +    <controller type='usb' index='2' model='ich9-uhci2'/>
> +    <controller type='usb' index='2' model='ich9-uhci1'/>
> +    <video>
> +      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
> +    </video>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.args b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.args
> new file mode 100644
> index 0000000..705c076
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.args
> @@ -0,0 +1,30 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/libexec/qemu-kvm \
> +-name q35-test \
> +-S \
> +-M q35 \
> +-m 2048 \
> +-smp 2 \
> +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
> +-nographic \
> +-nodefaults \
> +-monitor unix:/tmp/test-monitor,server,nowait \
> +-no-acpi \
> +-boot c \
> +-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
> +-device pci-bridge,chassis_nr=56,id=pci.2,bus=pci.1,addr=0x1 \
> +-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
> +-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
> +addr=0x1d \
> +-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
> +-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
> +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0,format=raw \
> +-device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
> +-vga qxl \
> +-global qxl-vga.ram_size=67108864 \
> +-global qxl-vga.vram_size=33554432
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.xml
> new file mode 100644
> index 0000000..001aece
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.xml
> @@ -0,0 +1,39 @@
> +<domain type='qemu'>
> +  <name>q35-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='q35'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <disk type='block' device='disk'>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='sda' bus='sata'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
> +      <model name='i82801b11-bridge'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pci-bridge'>
> +      <model name='pci-bridge'/>
> +      <target chassisNr='56'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-ehci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci2'/>
> +    <controller type='usb' index='0' model='ich9-uhci3'/>
> +    <video>
> +      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
> +    </video>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index b245486..5fe52b0 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1476,6 +1476,27 @@ mymain(void)
>              QEMU_CAPS_ICH9_AHCI,
>              QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
>              QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
> +    DO_TEST("q35-usb2",
> +            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> +            QEMU_CAPS_ICH9_AHCI,
> +            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
> +            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
> +            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
> +    DO_TEST("q35-usb2-multi",
> +            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> +            QEMU_CAPS_ICH9_AHCI,
> +            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
> +            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
> +            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
> +    DO_TEST("q35-usb2-reorder",
> +            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> +            QEMU_CAPS_ICH9_AHCI,
> +            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
> +            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
> +            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
>      DO_TEST("pcie-root-port",
>              QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
>              QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml
> new file mode 100644
> index 0000000..5f62468
> --- /dev/null
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml
> @@ -0,0 +1,66 @@
> +<domain type='qemu'>
> +  <name>q35-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='q35'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <disk type='block' device='disk'>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='sda' bus='sata'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
> +      <model name='i82801b11-bridge'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pci-bridge'>
> +      <model name='pci-bridge'/>
> +      <target chassisNr='56'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-ehci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci1'>
> +      <master startport='0'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-uhci2'>
> +      <master startport='2'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-uhci3'>
> +      <master startport='4'/>
> +    </controller>
> +    <controller type='usb' index='1' model='ich9-ehci1'/>
> +    <controller type='usb' index='1' model='ich9-uhci1'>
> +      <master startport='0'/>
> +    </controller>
> +    <controller type='usb' index='1' model='ich9-uhci2'>
> +      <master startport='2'/>
> +    </controller>
> +    <controller type='usb' index='1' model='ich9-uhci3'>
> +      <master startport='4'/>
> +    </controller>
> +    <controller type='usb' index='2' model='ich9-ehci1'/>
> +    <controller type='usb' index='2' model='ich9-uhci1'>
> +      <master startport='0'/>
> +    </controller>
> +    <controller type='usb' index='2' model='ich9-uhci2'>
> +      <master startport='2'/>
> +    </controller>
> +    <controller type='usb' index='2' model='ich9-uhci3'>
> +      <master startport='4'/>
> +    </controller>
> +    <controller type='sata' index='0'/>
> +    <video>
> +      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
> +    </video>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml
> new file mode 100644
> index 0000000..1791b7a
> --- /dev/null
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml
> @@ -0,0 +1,66 @@
> +<domain type='qemu'>
> +  <name>q35-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='q35'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <disk type='block' device='disk'>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='sda' bus='sata'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
> +      <model name='i82801b11-bridge'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pci-bridge'>
> +      <model name='pci-bridge'/>
> +      <target chassisNr='56'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-ehci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci1'>
> +      <master startport='0'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-uhci2'>
> +      <master startport='2'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-uhci3'>
> +      <master startport='4'/>
> +    </controller>
> +    <controller type='usb' index='1' model='ich9-ehci1'/>
> +    <controller type='usb' index='1' model='ich9-uhci1'>
> +      <master startport='0'/>
> +    </controller>
> +    <controller type='usb' index='1' model='ich9-uhci3'>
> +      <master startport='4'/>
> +    </controller>
> +    <controller type='usb' index='1' model='ich9-uhci2'>
> +      <master startport='2'/>
> +    </controller>
> +    <controller type='usb' index='2' model='ich9-ehci1'/>
> +    <controller type='usb' index='2' model='ich9-uhci3'>
> +      <master startport='4'/>
> +    </controller>
> +    <controller type='usb' index='2' model='ich9-uhci2'>
> +      <master startport='2'/>
> +    </controller>
> +    <controller type='usb' index='2' model='ich9-uhci1'>
> +      <master startport='0'/>
> +    </controller>
> +    <controller type='sata' index='0'/>
> +    <video>
> +      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
> +    </video>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml
> new file mode 100644
> index 0000000..2dfd9d5
> --- /dev/null
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml
> @@ -0,0 +1,46 @@
> +<domain type='qemu'>
> +  <name>q35-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='q35'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <disk type='block' device='disk'>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='sda' bus='sata'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
> +      <model name='i82801b11-bridge'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pci-bridge'>
> +      <model name='pci-bridge'/>
> +      <target chassisNr='56'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-ehci1'/>
> +    <controller type='usb' index='0' model='ich9-uhci1'>
> +      <master startport='0'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-uhci2'>
> +      <master startport='2'/>
> +    </controller>
> +    <controller type='usb' index='0' model='ich9-uhci3'>
> +      <master startport='4'/>
> +    </controller>
> +    <controller type='sata' index='0'/>
> +    <video>
> +      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
> +    </video>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
> index cbd4d0d..5608311 100644
> --- a/tests/qemuxml2xmltest.c
> +++ b/tests/qemuxml2xmltest.c
> @@ -561,6 +561,9 @@ mymain(void)
>      DO_TEST_DIFFERENT("pci-autoadd-idx");
>      DO_TEST_DIFFERENT("pcie-root");
>      DO_TEST_DIFFERENT("q35");
> +    DO_TEST_DIFFERENT("q35-usb2");
> +    DO_TEST_DIFFERENT("q35-usb2-multi");
> +    DO_TEST_DIFFERENT("q35-usb2-reorder");
>      DO_TEST("pcie-root-port");
>      DO_TEST("pcie-root-port-too-many");
>      DO_TEST("pcie-switch-upstream-port");
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]