[libvirt] [PATCH 0/5] auto-add USB2 controller set for Q35

Laine Stump laine at laine.org
Thu Nov 19 18:24:57 UTC 2015

For just about every other machinetype, libvirt automatically adds a
USB controller if there is no controller (including "type='none'")
specified in the config. It doesn't do this for the Q35 machinetype,
because Q35 hardware would have a USB2 controller, USB2 controllers
come in sets of multiple devices, and the code that auto-adds the USB
controller was really setup to just add a single controller. Expanding
that to adding a set of related controllers was beyond the amount of
time I had when putting in the initial Q35 support, so I left it "for
later", and then forgot about it until someone reminded me in the hall
at KVM Forum this summer.

I find the practice of auto-adding devices that aren't required for
operation of the virtual machine to be a bit odd, but this does make
the Q35 machinetype more consistent with all the others, and it is
still possible to force no USB controllers by specifying:

   <controller type='usb' model='none'/>

Since the USB controllers on a real Q35 machine are on bus 0 slot
0x1D, there is also a patch here to attempt to use that address for
the first set of USB controllers (and 0x1A for the 2nd set).

Finally, patch 1 is a bugfix for a problem that hadn't been noticed
before, because nobody had tried to connect a USB controller to a
pcie-root-port (which has a single slot that is numbered 0).

Laine Stump (5):
  qemu: don't assume slot 0 is unused/reserved.
  qemu: prefer 00:1D.x and 00:1A.x for USB2 controllers on Q35
  conf: add virDomainDefAddController()
  qemu: define virDomainDevAddUSBController()
  qemu: auto-add a USB2 controller set for Q35 machines

 src/conf/domain_conf.c                             | 104 +++++++++++++++++----
 src/conf/domain_conf.h                             |   2 +
 src/libvirt_private.syms                           |   1 +
 src/qemu/qemu_command.c                            |  57 ++++++++++-
 src/qemu/qemu_domain.c                             |  14 ++-
 .../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/qemuxml2argvdata/qemuxml2argv-q35.args       |   5 +
 tests/qemuxml2argvtest.c                           |  22 +++++
 .../qemuxml2xmlout-q35-usb2-multi.xml              |  66 +++++++++++++
 .../qemuxml2xmlout-q35-usb2-reorder.xml            |  66 +++++++++++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml |  46 +++++++++
 tests/qemuxml2xmltest.c                            |   3 +
 17 files changed, 606 insertions(+), 23 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


More information about the libvir-list mailing list