***GUIDE*** Passthrough Entire PCI USB Controller


archedraft

Recommended Posts

 

Win10 x64, I am just copying over a win 7 iso to try but would rather stick with 10 as I upgraded my install key!

 

Hmm yeah either should work just fine... So it boots up just fine without error but doesn't find the USB controller, correct? Does the device manager show an unknown device? Maybe check your mobo website for drivers? Other than that I don't have a clue

 

Link to comment

nothing extra appears in device manager needing drivers. I am stumped really, am I missing something with the XML passthrough?

 

what is the difference between bus=pcie.0 and bus=root.1 ?? why would the usb be root and not a pcie number? or am I just making things up now as I have tried everything else??

Link to comment

I think you need to add this first

    <qemu:arg value='-device'/>

    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=00:14.0,bus=root.1,addr=00.0'/>

 

Hi again. No that didn't work. I didn't add this before because I thought it was for a card. Anyways it throws an error for the following:

<qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>[/b]

 

It it possibly the address as I highlighted above?

 

Thanks

 

Depends on what the error message says? Can you post a screen shot?

 

See the scree capture:

Capture.JPG.8902845017fc0c4baf431ec8fc55d22f.JPG

Link to comment

 

nothing extra appears in device manager needing drivers. I am stumped really, am I missing something with the XML passthrough?

 

what is the difference between bus=pcie.0 and bus=root.1 ?? why would the usb be root and not a pcie number? or am I just making things up now as I have tried everything else??

 

I would try making a fresh XML of Windows with unraids VM creator and then only modify the lines necessary for USB passthrough. You will have to view your VM though VNC for the moment but try getting just that working first.

Link to comment

 

I think you need to add this first

    <qemu:arg value='-device'/>

    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=00:14.0,bus=root.1,addr=00.0'/>

 

Hi again. No that didn't work. I didn't add this before because I thought it was for a card. Anyways it throws an error for the following:

<qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>[/b]

 

It it possibly the address as I highlighted above?

 

Thanks

 

Depends on what the error message says? Can you post a screen shot?

 

See the scree capture:

 

Please post your entire XML as well.

Link to comment

Its on page 6 at the bottom.

 

 

 

I think you need to add this first

    <qemu:arg value='-device'/>

    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=00:14.0,bus=root.1,addr=00.0'/>

 

Hi again. No that didn't work. I didn't add this before because I thought it was for a card. Anyways it throws an error for the following:

<qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>[/b]

 

It it possibly the address as I highlighted above?

 

Thanks

 

Depends on what the error message says? Can you post a screen shot?

 

See the scree capture:

 

Please post your entire XML as well.

Link to comment

 

I think you need to add this first

    <qemu:arg value='-device'/>

    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=00:14.0,bus=root.1,addr=00.0'/>

 

Hi again. No that didn't work. I didn't add this before because I thought it was for a card. Anyways it throws an error for the following:

<qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>[/b]

 

It it possibly the address as I highlighted above?

 

Thanks

 

I am wanting to see the XML with the above code entered so I can see if I can spot the issue. Your post on line 6 doesn't have the added code.

Link to comment

ok done that, fresh build.

 

The only thing now in my xml is + using vnc

<qemu:commandline>

    <qemu:arg value='-device'/>

    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=09:00.0,bus=root.1,addr=00.1'/>

  </qemu:commandline>

 

Still getting the same, no usb devices work :-(

 

Link to comment

 

I think you need to add this first

    <qemu:arg value='-device'/>

    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=00:14.0,bus=root.1,addr=00.0'/>

 

Hi again. No that didn't work. I didn't add this before because I thought it was for a card. Anyways it throws an error for the following:

<qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>[/b]

 

It it possibly the address as I highlighted above?

 

Thanks

 

I am wanting to see the XML with the above code entered so I can see if I can spot the issue. Your post on line 6 doesn't have the added code.

 

 

Sorry, I was hoping the one on page 6 was current enough because I was installing Ubuntu.

 

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Test 8</name>
  <uuid>738883d4-0137-3e4e-7bc9-8da467c306eb</uuid>
  <description>test 8</description>
  <metadata>
    <vmtemplate name="Custom" icon="windows.png" os="windows"/>
  </metadata>
  <memory unit='KiB'>10485760</memory>
  <currentMemory unit='KiB'>10485760</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>6</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='2'/>
    <vcpupin vcpu='1' cpuset='3'/>
    <vcpupin vcpu='2' cpuset='4'/>
    <vcpupin vcpu='3' cpuset='5'/>
    <vcpupin vcpu='4' cpuset='6'/>
    <vcpupin vcpu='5' cpuset='7'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='6' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <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='raw' cache='writeback'/>
      <source file='/mnt/cache/appdata/ISO share/Test 3/Secondary.img'/>
      <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/cache/appdata/ISO share/Windows 10 Pro/Win10.PRO.img'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/cache/appdata/ISO share/virtio-win-0.1.102.iso'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </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:1a:34:b4'/>
      <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/Test 3.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='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=00:14.0,bus=root.1,addr=00.0'/>
  </qemu:commandline>
</domain>

Link to comment

For me it's much easier to use the hostdev tag instead of the qemu:arg. It's just too much trouble with it when you don't know what you are doing.

So for passing through a PCI(e) device with the hostdev tag this is the starting code:

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
      </source>
    </hostdev>

 

You then have to modify some parts of it to get it to work. The good thing is that you do not have to care about which bus and address it's supposed to have in the VM. You only need to find out the host PCI address.

The part you change is bus, slot and function. In your case it's 00:14.0.

Let's brake it down.

00 is the bus. You simply exchange the two numbers after the 0x.

14 is the slot. Same method as above.

0 is the function. Her it's also the same method as above.

So in your case the full device tag would be like this:

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
      </source>
    </hostdev>

 

After you start the VM you will see that there are some lines added to the tag, but those you don't have to care about. They get created automatically. If you copy a host device tag to pass through a new device, be sure to remove the two lines created after the

</source>

tag, as they are specific to that VM.

 

      <alias name='hostdev2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>

Link to comment

For me it's much easier to use the hostdev tag instead of the qemu:arg. It's just too much trouble with it when you don't know what you are doing.

So for passing through a PCI(e) device with the hostdev tag this is the starting code:

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
      </source>
    </hostdev>

 

You then have to modify some parts of it to get it to work. The good thing is that you do not have to care about which bus and address it's supposed to have in the VM. You only need to find out the host PCI address.

The part you change is bus, slot and function. In your case it's 00:14.0.

Let's brake it down.

00 is the bus. You simply exchange the two numbers after the 0x.

14 is the slot. Same method as above.

0 is the function. Her it's also the same method as above.

So in your case the full device tag would be like this:

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
      </source>
    </hostdev>

 

After you start the VM you will see that there are some lines added to the tag, but those you don't have to care about. They get created automatically. If you copy a host device tag to pass through a new device, be sure to remove the two lines created after the

</source>

tag, as they are specific to that VM.

 

      <alias name='hostdev2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>

 

Thanks saarg I'll set up another VM and give it a go while pursuing closure on Test VM 8.

Link to comment

ahh cool that's what I tried and annoyingly no usb devices found on the VM when I boot it up. I think I am destined to fail at this :-(

 

edit!

I can confirm that this works on my usb2 controller but not on the USB 3 one!

 

If I run unRAID from the USB 3 controller the pen drive gets so hot that it crashes/corrupts the system!!

 

Any ideas/ ways round this? I have 3 sets of USB ports, one set on the front of my case (usb2) , one set on the back that's USB3, and another set of USB2 on the back.

 

I really want the unRaid on the front so that I don't have dangling cables everywhere

Link to comment

For me it's much easier to use the hostdev tag instead of the qemu:arg. It's just too much trouble with it when you don't know what you are doing.

So for passing through a PCI(e) device with the hostdev tag this is the starting code:

 

I added this to the end of the guide, I know it is else where but I think it should be handy anyways. Thanks.

Link to comment

For me it's much easier to use the hostdev tag instead of the qemu:arg. It's just too much trouble with it when you don't know what you are doing.

So for passing through a PCI(e) device with the hostdev tag this is the starting code:

 

I added this to the end of the guide, I know it is else where but I think it should be handy anyways. Thanks.

Good choice :)

I just read what you added and it says

Forget passing through an entire controller and just use Hostdev

That's not true :) You are still passing through an entire controller, but only the way to do it is different.

Link to comment

Can someone explain what the difference is between qemu passthrough and hostdev please?  I'm not entirely clear on the use cases for each...

I just edited my post :)

It's the same. The hostdev way is used in the XML and qemu:arg is not a part of the XML. Did that confuse you more maybe?  ::)

Link to comment

Can someone explain what the difference is between qemu passthrough and hostdev please?  I'm not entirely clear on the use cases for each...

I just edited my post :)

It's the same. The hostdev way is used in the XML and qemu:arg is not a part of the XML. Did that confuse you more maybe?  ::)

 

No, I've wondered why there are two separate ways to do things, but never given it too much thought.  So basically they're like two routes to the same destination...

 

No advantages or disadvantages either way?  No reason to choose one over the other?

Link to comment

For me it's much easier to use the hostdev tag instead of the qemu:arg. It's just too much trouble with it when you don't know what you are doing.

So for passing through a PCI(e) device with the hostdev tag this is the starting code:

 

I added this to the end of the guide, I know it is else where but I think it should be handy anyways. Thanks.

Good choice :)

I just read what you added and it says

Forget passing through an entire controller and just use Hostdev

That's not true :) You are still passing through an entire controller, but only the way to do it is different.

 

Oops good catch, I was editing the whole first page at a million miles a minute and sort of word vomitted that.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.