Re: Auto-assignment of USB devices and auto-creation of USB hubs

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

 



On Mi, 2013-09-18 at 07:33 -0400, Jamie Bainbridge wrote:
> Hello,
> 
> I've been helping a customer out this week with assigning specific devices to specific USB controllers inside his KVM VMs. He's got USB1 devices which need a UHCI controller (because of rubbishy Windows device drivers) and USB2 devices which need a EHCI controller ("speed mismatch" on a UHCI hub).
> 
> I've suggested config similar to this:
> 
>     <controller type='usb' index='0' model='ehci'>
>     </controller>
>     <controller type='usb' index='1' model='piix3-uhci'>
>     </controller>

You can also do this:

    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d'
function='0x7' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d'
function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d'
function='0x1' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d'
function='0x2' multifunction='on'/>
    </controller>

Gives you a ehci controller with uhci companions.  It's a single usb
bus, with 6 ports, supporting both usb1 and usb2.  Makes device
attachment a bit easier as you don't have to worry about the device
speed then.

> 
>     <input type='tablet' bus='usb'/>

You can also do this here:

    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='2.8'/>
    </input>


>     <hub type='usb'>
>       <address type='usb' bus='1' port='2'/>
>     </hub>

The qemu hub supports usb1.1 only, so any usb 2.0 devices must be
plugged into a ehci root port.  The hub has 8 downstream ports btw.

> My observation is that you can either:
> 
>  a) let libvirt plug everything into the UHCI controller, regardless of what other controllers are there and what order they appear in
>  or
>  b) find out how many ports a controller/hub has through trial and error, manually create USB hubs, and map every single device and port out manually
> 
> with no middle ground in between.

Correct.  And if you hotplug usb devices you have to do (b) to make sure
live migration works.

>       <address type='usb' bus='1'/>

> then save the XML, and "virsh edit" again, and all the port/hub stuff would already be there pre-made as required.
> 
> Any thoughts? Is this worth logging an RFE for?

Sure.  It's done for PCI, for good reasons.
IMO libvirt should likewise create usb addresses.

cheers,
  Gerd


--
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]