How to load vfio driver before ahci driver with mkinitcpio?

357 Views Asked by At

Good morning all,

I'd want to attach to vfio driver at boot my secondary sata controller in a manjaro os (kernel 5.16.7). Usually, I add the devices in /etc/modprobe.d/vfio.conf, for example:

options vfio-pci ids=10de:100c,10de:0e1a,1b4b:9230,15b3:6274,1106:3403

In this example, there is gpu audio and video (10de), the sata controller (1b4b), an infiniband card (15b3) and firewire (1106).

Then, I add the modules in /etc/mkinitcpio.conf:

MODULES=(vfio_pci vfio vfio_iommu_type1 vfio_virqfd)

making sure that modconf is in the HOOKS:

HOOKS=(modconf base udev autodetect block filesystems keyboard)

Finally I generate initramfs:

mkinitcpio -P

All quite good, devices are attached to vfio, except for the sata controller, which is attached to the ahci driver (if not in use by some vm). If I start the kvm vm with the sata controller set to be passed through, vfio driver attaches to it, but that's not what I'd want: the goal is to attach that sata controller to vfio at boot (not attaching it to vfio "on the fly").

I found some instructions for other oses, for example here: https://gist.github.com/kiler129/4f765e8fdc41e1709f1f34f7f8f41706

The op explains that ahci driver loads before vfio, but manjaro uses mkinitcpio and my issue is that I don't understand how to adapt/translate those instructions for my os.

0

There are 0 best solutions below