[libvirt] USB2 controllers & domain XML

Hans de Goede hdegoede at redhat.com
Fri Aug 19 14:31:53 UTC 2011


Hi,

On 08/19/2011 06:13 AM, Marc-André Lureau wrote:
> Hi
>
> On Thu, Aug 18, 2011 at 9:42 PM, Daniel P. Berrange<berrange at redhat.com>  wrote:
>>   5. USB companion controllers use type='usb' too, but with an
>>      extra 'master' attribute to associate them
>>
>>
>>        <controller type='usb' index='0' model='ich9-ehci'>
>>          <address type='pci' domain='0' bus='0' slot='4' function='7'/>
>>        </controller>
>>        <controller type='usb' index='0' model='ich9-ehci1'>
>>          <master startport='0'/>
>>          <address type='pci' domain='0' bus='0' slot='4' function='1'/>
>>        </controller>
>>        <controller type='usb' index='0' model='ich9-uhci2'>
>>          <master startport='2'/>
>>          <address type='pci' domain='0' bus='0' slot='4' function='2'/>
>>        </controller>
>>        <controller type='usb' index='0' model='ich9-uhci3'>
>>          <master startport='4'/>
>>          <address type='pci' domain='0' bus='0' slot='4' function='2'/>
>>        </controller>
>>
>
> Does each companion controller has it's own bus?
>

No, this is why the companion controllers have the masterbus option.
Each port on the ehci has a mux (in the real hardware which we emulate),
it looks something like this:

           physical port
                 |
                mux
                 /\
                /  \
               /    \
             ehci   companion port

And the uhci companion controller plugs into 2 of the companion
ports, starting at the startport number, the ehci has 6 ports
like the above diagram, hence 3 companions, to cover the
6 companion ports. These 6 ports together form a bus, ie
the ehci.0 bus. So adding companion controllers does not add
more physical busses (they will show up as logical busses in
the guest, but that is of little concern to qemu).

The bus sitation does not really change with / without companion
controllers as soon as you've an ehci, you get a bus belonging to
it with 6 ports. The companion controllers just add usb 1
compatiblity to the otherwise usb 2 only ports, so that you can
plug in any usb device without needing to think about the speed
of it (qemu has port_speed / device_speed masks for usb ports
resp devices, and refuses to connect (*) a device if there is no
overlap).

*) This means in practice that if you do things wrong, like create
an ehci without companions and plug in a usb-tablet, the usb-tablet
will be there in qemu's device tree, but it will be in disconnected
state. IOW it is lying next to the computer with its plug not
inserted into the computer.

Regards,

Hans




More information about the libvir-list mailing list