To close this out. Definitely PEBCAK.
- Identify IOMMU groups and see whether there’s a slot that’s in its own group
for g in /sys/kernel/iommu_groups/*; do
echo "Group ${g##*/}:"
for d in "$g"/devices/*; do
echo -e "\t$(lspci -nn -s ${d##*/})"
done
done
- As needed, move the NVMe physically so it’s in its own IOMMU group. If your motherboard manual has a system block diagram, look for PCIe slots and M.2 that are connected to the PCH, not to the CPU.
- If the BIOS has ACS in addition to Vt-d, that’s a way to get it into its own group, as well, without needing to move it physically.
- Verify it’s in its own group, run that command above again. The hard part is done.
lspci -Dand get the slot of the drive including PCI domain, in my case0000:0b:00.0- Create a script
nvme-passthrough.shsomewhere on one of your pools in/mntor if you like in/root/scripts, make it executable withchmod +x nvme-passthrough.sh
#!/bin/sh
slot=0000:0b:00.0 # Adjust this to be your slot
modprobe vfio-pci
echo $slot > /sys/bus/pci/devices/$slot/driver/unbind 2>/dev/null
echo vfio-pci > /sys/bus/pci/devices/$slot/driver_override
echo $slot > /sys/bus/pci/drivers/vfio-pci/bind
- Run the script once to see that it works, verify with
lspci -vthat the drive is bound to thevfio-pcidriver - In System->Advanced, call this script as a
POSTINITscript - Reboot, verify with
lspci -vthat the drive is bound to thevfio-pcidriver after reboot
And pass through to a VM