There are actually two methods for this, starting with the preferred method, for the tools that your distribution uses.
Method one, module order (preferred):
mkinitcpio:
In your base configuration (/etc/mkinitcpio.conf), make sure that the vfio modules precede the GPU driver module, as well as ensuring that modconf is present in your hooks, for example:
MODULES=(… vfio vfio_iommu_type1 vfio_pci vfio_virqfd amdgpu …) … HOOKS=(… modconf …) |
initramfs-tools:
In the configuration file (/etc/initramfs-tools/modules), set the vfio modules as dependencies for the GPU driver module, for example:
softdep amdgpu pre: vfio vfio_pci |
In some cases, the GPU driver module still binds before vfio, if that is the case, put the same line in the modprobe rule for binding your gpu with vfio (usually /etc/modprobe.d/vfio), for example:
softdep amdgpu pre: vfio vfio_pci options vfio-pci ids=8086:1c02 |
Method two, blacklisting:
mkinitcpio:
Create a modprobe rule blacklisting the GPU driver module, for example (using /etc/modprobe.d/blacklist.conf):
blacklist amdgpu |
Now, add the file to your mkinitcpio configuration (Usually /etc/mkinitcpio.conf) example:
… FILES=”… /etc/modprobe.d/blacklist.conf” … |
initramfs-tools:
Create a modprobe rule blacklisting the GPU driver module, for example (using /etc/modprobe.d/blacklist.conf):initramfs-tools:
blacklist amdgpu |
dracut:
Add the GPU driver module to the dracut.conf.d file for adding vfio to your initramfs (usually /etc/dracut.conf.d/vfio.conf), for example:
add_drivers+=”vfio vfio_iommu_type1 vfio_pci vfio_virqfd” omit_drivers+=”amdgpu” |