Jump to content

Help with USB Device Passthrough


reggierat

Recommended Posts

Have just upgraded my CPU to  i5-3470 CPU @ 3.20 for VT-d support, can confirm HVM and IOMMU are both enabled now.

 

I have created a windows 7 VM and am attempting to passthrough an external hard drive as a test before attempting to passthrough one of my USB controllers to the VM.

 

Using the template i have chosen the device in the list to be passed through and checked the box next to it.

 

Copy of XML

 

<domain type='kvm'>
  <name>rTorrent</name>
  <uuid>a8d7f9a9-59a3-91a3-1ee0-19de892dd49f</uuid>
  <description>Torrent + VPN</description>
  <metadata>
    <vmtemplate name="Custom" icon="windows7.png" os="windows7"/>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='1' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/mnt/cache/appdata/virtual-machines/ruTorrent/vdisk1.qcow2'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/Software/unRaid/virtio-win-0.1-100.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:56:90:1b'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/rTorrent.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x0bc2'/>
        <product id='0x5021'/>
      </source>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

Looking at device manager in the VM i can see that one of the USB Controllers cannot start, see attached picture.

 

Any help would be appreciated

usb.png.aa03a91ae157366d002962ab547cf817.png

Link to comment

Yes, there are still certain USB devices that do not work well with the emulated USB controller.  Even some mice / keyboards won't work with that.  There is a newer qemu emulated USB controller we tested a while back that was really flaky, but I will test it again with newer builds to see if this is any better.

 

In addition, QEMU 2.4 is close to release, which may also have some more fixes for USB support.  Stay tuned...

Link to comment

thats a little disappointing, just to clarify do you think it is the device being passed through? in this case a Seagate External HDD, or the USB controller it is connected to and being emulated? in this case one of the USB 3.0 ports in the front of my NAS

Link to comment

I would try to pass through the USB controller if you have the chance. It removes all the problems with devices not properly working and hotplugging.

If you haven't seen it yet, archdraft has a very good guide on passing through the USB controller. Google "USB controller passthrough unraid" and it should be the first in the list.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...