How to config vfio?

Some years ago I first successfully passed through a 980ti for gaming purposes. I’ve recently upgraded hardware and while I still have a successful win10 vm I’ve noticed in posts that some folk appear to be doing things differently to me.
When I first set up a win10 vm using kvm/libvirt I read a useful site (cannot find now) that instructed me to write a script which I called:
/usr/sbin/vfio-pci-override.sh and which contained:

#!/bin/sh

##this is for the card in pcie slot3
GROUP="0000:41:00"
DEVS="0 1"

if [ ! -z "$(ls -A /sys/class/iommu)" ]; then
        for DEV in $DEVS; do
                echo "vfio-pci" > /sys/bus/pci/devices/$GROUP.$DEV/driver_override
        done
fi

##this is for the xonar dsx
echo "vfio-pci" > /sys/bus/pci/devices/0000\:84\:00.0/driver_override

##this is for the nvme gen5 controller
echo "vfio-pci" > /sys/bus/pci/devices/0000\:81\:00.0/driver_override

modprobe -i vfio-pci

with a file in /etc/modprobe.d/ called vfio_pci.conf that contained:

install vfio-pci /sbin/vfio-pci-override.sh

but I see today references to using options in kernel parameters to specify pci ids or putting them directly into a file under /etc/modprobe.d/

is there a better way than the method I currently use?

diziet

There is nothing wrong with the method you are using.
The main reason for adding vfio-pci.ids as kernel arguments, is to ensure the vfio-pci driver is used for those devices, instead of the default driver (often amdgpu or nouveau) - as some devices does not handle reload/re-initializaion very well.
In your case, if your xonar dsx and nvme controller handles reload just fine - I see no reason to change it. :slight_smile:

Cwl, thanks for the info. I shall leave things alone then:)

diziet