You are not logged in.
I'm trying to passthrough my SATA card (ASMedia Technology Inc. ASM1166 Serial ATA Controller [1b21:1166]) to a vm so that I can use it to share files via NFS.
The thing is that apparently the kernel (6.12.42-1-lts) has the ahci driver built-in instead of loaded as a module.
I believe that it's the reason that doing this didn't work.
I have other devices that I do passthrough to other vms, and in fact the disks itself are eventually passed to the vm (which indicates that my configuration, done adapting this, is correct), but it takes more than 10 minutes and while it's happening everything freezes and I see error msgs related to the disks on dmesg afterwards.
I believe that if ahci was available as a module everything would be working.
Is there any way around this situation?
Edit: The problem was with my motherboard. Things worked when I switched it. As suggested on this thread, the way to passthrough a SATA controller on a distro like Arch, which has the ahci driver built in kernel and not available as a module seems to be adding a pci-stub.ids=xxxx:xxxx to grub so that it becomes available later on during boot, when the vm takes control and assigns it the vfio-pci.
Last edited by xlx (2025-09-10 11:17:08)
Offline
You could try to allocate the devices to
modingo pci_stubwhich is also built-in and have vfio steal it from there.
Offline
is there any benefit by passing the entire HBA to the vm instead of just the drives or some storage on them?
if you want to have some raid array managed by the vm rather than the host - this sounds error prone to me
you could try to exclude the asm1166 from ahci.c itself - but this would require to built a custom kernel along with every non-in-tree module
I'm also not sure if ahci can even be build as an external module rather than in-kernel - but this would require a custom kernel as well
Offline
IIRC adding this to the kernel command line worked, it's supposed to bind the pci_stub driver before others get to the device
pci_stub.ids=1022:7908 # replace with your AHCI's PCI IDsOffline
For clarity :
You have tried adding vfio_pci.ids=1022:7900 #replace with real PCI ID with vfio_pci added to modules= line in mkinitcpio.conf ?
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
"modingo"…
@Lone_Wolf, the problem will be that the ahci module gets to the device before vfio loads, even if one puts the latter into the initramfs.
My suggestions and also expressed by mmy8x would be to have the built-in pci_stub driver grab the device so it's not claimed by ahci and then let the vfio module pick it up from there.
Offline
Hey guys,
I'm so sorry for having opened an issue and have taken that long to post back. I'm not in the habit of using this forum and I was so worried tried to find some answers everywhere that I simply forgot I had posted here!
Anyway, you were right and the pci_stub is the right approach (when using Arch Linux, at least... I noticed that when using Debian, that has ahci as a module, it's apparently not necessary to insert pci_stub in Grub).
I now believe that the issue lies in my motherboard (CW-NAS-ADLN-K, a chinese mobo). When I tried using my current configuration on another motherboard everything worked immediately.
I'm now trying to get some answers in the corresponding forum.
I do appreciated your invaluable help.
Offline
Anyway, you were right and the pci_stub is the right approach
\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline