Jump to content
archedraft

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

476 posts in this topic Last Reply

Recommended Posts

Posted (edited)
On 1/2/2016 at 10:57 PM, saarg said:

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'/>
 

 

I've got my external USB hub on the controller at 43:00.0, the bus is 07 and the port is 0.

My XML looks like this: 

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

 

When starting the VM, I get this error: 

Device 0000:07:00.0 not found: could not access /sys/bus/pci/devices/0000:07:00.0/config: No such file or directory

Also noted is the fact that it doesn't show up in /sys/bus/pci/devices in an ls (see attached)

 

I've also attached proof of the bus (the second screenshot).

 

Update: that device is a dummy: 

ot:   00:07.0
Class:  Host bridge
Vendor: Advanced Micro Devices, Inc. [AMD]
Device: Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge
NUMANode:       0

 

And the real device is 43:00.3, but unRAID doesn't let me type over 1F (43=2B)

 

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

 

Note: upon changing the second slot (the automatically generated one after </source> to 0x00 errors out with an XML error saying it needs to be >=1.

Screen Shot 2019-08-05 at 12.56.30.png

Screen Shot 2019-08-05 at 12.57.55.png

Edited by dxfydd

Share this post


Link to post

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.