[Plugin] VFIO-PCI Config


Skitals

Recommended Posts

A plugin to create and modify vfio-pci.cfg from the unRAID webGui. Allows you to bind PCI devices by address to the vfio-pci driver. Also displays IOMMU groupings and which devices support reset. Unbound USB controllers display USB devices connected to them.

 

Bound devices will be available to pass through to your VMs under "Other PCI Devices" in the Edit VM Form View.

 

Please see the release notes for 6.7.0-rc1 for more information on this binding method.

 

 

Search for "VFIO-PCI Config" in Community Applications

 

Github repository: https://github.com/Skitals/unraid-vfio-pci/

URL for manual plugin install:

https://raw.githubusercontent.com/Skitals/unraid-vfio-pci/master/plugins/vfio.pci.plg

 

 

screenshot.png

Edited by Skitals
Now displays USB devices
  • Like 3
  • Thanks 4
Link to comment

Hi,

tried to bind the built-in audio controller:
image.thumb.png.fe25c4156980267d938e77420b6b21af.png
 

But, at reboot, this is what i find as bindable devices:
image.png.10de59ea34b89234bb0d5739eb373a73.png

 

Any hints?
Thanks!

Edit: of course it previously showed up in the avaiable soundcards, but unusable.
Selecting it now (again, under the "Sound Card" section of configuration) the built in audio is now avaiable to the VM!!
THANKS!!!

When i'll have time i'll try to pass through the iGPU too, wich has been impossible with Ryzen APU so far.
I'll let you know.


Thanks again!

Edited by dhstsw
Link to comment
3 hours ago, dhstsw said:

When i'll have time i'll try to pass through the iGPU too, wich has been impossible with Ryzen APU so far.
I'll let you know.

 

Ok, this was a bad idea.

Windows VM started, didn't show anything and in the while parity disk and cache got corrupted.

I guess i forced things a bit too much :)

Link to comment
6 hours ago, dhstsw said:

Hi,

tried to bind the built-in audio controller:
image.thumb.png.fe25c4156980267d938e77420b6b21af.png
 

But, at reboot, this is what i find as bindable devices:
image.png.10de59ea34b89234bb0d5739eb373a73.png

 

Any hints?
Thanks!

Edit: of course it previously showed up in the avaiable soundcards, but unusable.
Selecting it now (again, under the "Sound Card" section of configuration) the built in audio is now avaiable to the VM!!
THANKS!!!

When i'll have time i'll try to pass through the iGPU too, wich has been impossible with Ryzen APU so far.
I'll let you know.


Thanks again!

Thanks for figuring that out, I guess my instructions are inaccurate. The plug-in only creates the vfio-pci.cfg for you, the rest is handled by unraid. Makes sense that "Other PCI Devices" would literally mean other than the device categories listed above 😄

Link to comment
3 hours ago, dhstsw said:

Ok, this was a bad idea.

Windows VM started, didn't show anything and in the while parity disk and cache got corrupted.

I guess i forced things a bit too much :)

Also note that according to the documentation, when you bind to vfio using this method, ALL the devices in the IOMMU group get bound. So in your case, even though you only selected one item, everything in group 3 will be available exclusively to vfio. That means the USB controllers in that group won't work in unraid. That is why those other devices appear under Other PCI Devices. You should be able to pass them to your VM. I would pass them all together since they are all functions of the same PCI device. If you experience problems with onboard audio in your VM, that's probably why. You should pass all 5 devices to the VM.

Edited by Skitals
Link to comment

Thanks for the clarification, i thought so.
Anyway, i just wanted to see if it was working.
I won't pass all those devices mainly because i don't know what they are (beside the USB controller).
Anyway, i'm waiting for a cheap USB audiocard from china, i'll use that.

Thanks again!

Link to comment

I currently have the below setup for my passthrough.

image.thumb.png.8198dc60c1d2af73f30c098384fac980.png

 

So my question is two fold.

If I use this plugin I can only assume I will not need to have them included in this line. Would that be correct?

Second question would be beside it being easier to use this plugin what other advantages does it have?

 

Cheers

Link to comment
2 hours ago, JWMutant said:

I currently have the below setup for my passthrough.

image.thumb.png.8198dc60c1d2af73f30c098384fac980.png

 

So my question is two fold.

If I use this plugin I can only assume I will not need to have them included in this line. Would that be correct?

Second question would be beside it being easier to use this plugin what other advantages does it have?

 

Cheers

If you have it working now, there is no reason to change it.

It's different methods and using the new method binds all devices in the group to vfio.

What the new method is good at is to only pass through one device vs all devices with the same vendor:id using the old method.

Link to comment
4 hours ago, dhstsw said:

Thanks for the clarification, i thought so.
Anyway, i just wanted to see if it was working.
I won't pass all those devices mainly because i don't know what they are (beside the USB controller).
Anyway, i'm waiting for a cheap USB audiocard from china, i'll use that.

Thanks again!

Just be aware that not all devices works well with pass through. So buying cheap from China might not be the best thing to do.

Link to comment
15 hours ago, JWMutant said:

I currently have the below setup for my passthrough.

image.thumb.png.8198dc60c1d2af73f30c098384fac980.png

 

So my question is two fold.

If I use this plugin I can only assume I will not need to have them included in this line. Would that be correct?

Second question would be beside it being easier to use this plugin what other advantages does it have?

 

Cheers

Basically what saarg said. Binding by id is perfect if it fits your use case. One downside of binding by address (this method) is it needs to be updated every time you change your pci hardware. A lot of boards these days have multiple devices with the same id, so binding by address is the only option. For example, every x570 board I've seen has 3 usb controllers with the same pci id. If you stub by id it stubs all 3, including the usb controller unraid needs.

 

I would like to think this plugin is still useful if you use vfio-pci.ids since it shows reset functionality and which usb devices are on which usb controllers--info otherwise not available in the webgui.

Link to comment
2 hours ago, Skitals said:

Basically what saarg said. Binding by id is perfect if it fits your use case. One downside of binding by address (this method) is it needs to be updated every time you change your pci hardware. A lot of boards these days have multiple devices with the same id, so binding by address is the only option. For example, every x570 board I've seen has 3 usb controllers with the same pci id. If you stub by id it stubs all 3, including the usb controller unraid needs.

 

I would like to think this plugin is still useful if you use vfio-pci.ids since it shows reset functionality and which usb devices are on which usb controllers--info otherwise not available in the webgui.

Showing reset and info about the usb devices/controllers is very good.

  • Like 1
Link to comment
  • 2 weeks later...

This plugin screwed up my raid  0 cache disks due plugin binding only by hardware address.

Problem  with this plugin is do binding only by hardware address , everything could be fine and  it works. But..

if you for example like me use cache disks as nvme drives, so drives uses pciexpress slots, so it uses hardware addresses.

And if you for example  remove some pci express devices then often motherboard change hardware addreses for all other pci devices.

In my case i removed gpu from one slot and then my cache drive hardware address changed to another one binded by this plugin from another device. Obviously after restart cache drive was corupted because being binded by plugin.

I sugest could you upgrade plugin and do binding by hardware address with device ids as well so it will eliminate wrong device rebinding if you add/remove some pci express device.

Justr sugestion, but it might affect functionality

P.S. Read comments before, so i just explained real situation and problem after

Edited by ingux16
Link to comment
29 minutes ago, ingux16 said:

This plugin screwed up my raid  0 cache disks due plugin binding only by hardware address.

Problem  with this plugin is do binding only by hardware address , everything could be fine and  it works. But..

if you for example like me use cache disks as nvme drives, so drives uses pciexpress slots, so it uses hardware addresses.

And if you for example  remove some pci express devices then often motherboard change hardware addreses for all other pci devices.

In my case i removed gpu from one slot and then my cache drive hardware address changed to another one binded by this plugin from another device. Obviously after restart cache drive was corupted because being binded by plugin.

I sugest could you upgrade plugin and do binding by hardware address with device ids as well so it will eliminate wrong device rebinding if you add/remove some pci express device.

Justr sugestion, but it might affect functionality

P.S. Read comments before, so i just explained real situation and problem after

I'm sorry, but this is not the fault of the plugin. The plugin is just a frontend to the new bind method added to unraid. If you would have edited the config file yourself, the same would happen.

This method uses the PCI number and will most likely change if you rearrange hardware. You can't use both the PCI number and the device ID with this method.

 

I don't see how binding the cache drive to vfio corrupted your cache drive either. It's simply just binding the device to a dummy driver so it's not used by anything else.

 

Link to comment

I think this plugin can be really dangerous for some users which don't know what they are doing. As explained above it's easy to bind a controller for your storage and after next server restart you have a big problem. It's easy to tick a couple check boxes and hit apply, maybe it's to easy for some people to screw up their setups. Maybe as an idea change the plugin so it shows on default only let's say VGA, SOUND and USB controllers, even if the last one if the Unraid usb stick is connected to, can be a problem if the controller is bound to vfio and hide all other devices in an advanced section with some big warnings.

 

The [RESET] feature of a device is also really important for users to understand. If a let's say USB controller isn't able to be reset, after a restart of the VM using the controller, it will stop working until you restart the whole server.

Link to comment
  • 2 months later...

image.thumb.png.47cbee73367d6d21cd97a8587d771b84.png

I was using this plugin for passing through one of my graphics cards and it has been rebooting for significantly longer than normal, is there a reason for this. Its over 1100s now.

Edit: I did get a backup of the USB just before I did this, just in case.

Edited by Matt Dumbrill
Add for edit
Link to comment
47 minutes ago, Matt Dumbrill said:

image.thumb.png.47cbee73367d6d21cd97a8587d771b84.png

I was using this plugin for passing through one of my graphics cards and it has been rebooting for significantly longer than normal, is there a reason for this. Its over 1100s now.

Edit: I did get a backup of the USB just before I did this, just in case.

I got it up and running again by removing the GPU which I changed the config for. Going to look for an alternative method for passthrough due to the previous as I'm not exactly sure what I'm doing and don't want to completely break my NAS.

Link to comment
On 4/3/2020 at 12:10 PM, Matt Dumbrill said:

I was using this plugin for passing through one of my graphics cards and it has been rebooting for significantly longer than normal, is there a reason for this. Its over 1100s now.

If the system won't boot you need to plug in a monitor and look at the errors on screen. But it sounds like the device you are trying to bind is needed by Unraid and won't be available for passthru.

Link to comment
17 hours ago, ljm42 said:

If the system won't boot you need to plug in a monitor and look at the errors on screen. But it sounds like the device you are trying to bind is needed by Unraid and won't be available for passthru.

Still trying to get some sort of passthough to work, but there is no error screen as there is no output from either gpu. Is there a way of deleting this config, so I can I can try another way as it doent allow me to even look at the UI with both GPUs in.

Link to comment
55 minutes ago, Matt Dumbrill said:

Still trying to get some sort of passthough to work, but there is no error screen as there is no output from either gpu. Is there a way of deleting this config, so I can I can try another way as it doent allow me to even look at the UI with both GPUs in.

Sure, on the flash drive delete the file /config/vfio-pci.cfg

 

Note that this plugin is just a front-end that writes the config file for you. More details about the config file here:

 

 

Link to comment

I have this right now in my syslinux file

 

Quote

kernel /bzimage
append isolcpus=0-1,4-5 amd_iommu=pt kvm_amd.avic=1 kvm_amd.npt=1 kvm_amd.nested=0 pcie_acs_override=downstream,multifunction vfio-pci.ids=8086:1521 pcie_aspm=off initrd=/bzroot

 

If I want to use this new method what do I need to remove from here? just this (vfio-pci.ids=8086:1521) or something else?

 

I'm doing passthrough of a pcie network card with 2 nics.

 

If I do the passthrough using this method (vfio-pci.cfg) all the other options of my syslinux config file still applies?

 

Thanks in advance.

Edited by L0rdRaiden
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.