Page MenuHomeFreeBSD

ahci: Don't fail attach if the MSI-X BARs cannot be allocated
ClosedPublic

Authored by jhb on Oct 3 2025, 4:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 2, 5:18 PM
Unknown Object (File)
Fri, Oct 31, 7:19 AM
Unknown Object (File)
Fri, Oct 31, 4:25 AM
Unknown Object (File)
Sun, Oct 26, 6:35 PM
Unknown Object (File)
Sun, Oct 26, 6:30 PM
Unknown Object (File)
Wed, Oct 22, 5:23 AM
Unknown Object (File)
Oct 13 2025, 12:09 PM
Unknown Object (File)
Oct 13 2025, 12:09 PM
Subscribers

Details

Summary

If the MSI-X table and/or PBA live in separate BAR(s) and those BAR(s)
cannot be allocated, fall back to using MSI or INTx instead of failing
attach.

PR: 289748
Reported by: Vitalij Satanivskij <satan@Ukr.net>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Oct 3 2025, 4:40 PM
This revision is now accepted and ready to land.Oct 3 2025, 4:52 PM
sys/dev/ahci/ahci_pci.c
595

If we got here then we successfully allocated r_msix_table.
Then it probably would be a good idea to release it?

sys/dev/ahci/ahci_pci.c
595

Maybe, but it doesn't hurt to keep it mapped (and the PCI bus won't actually unmap the BAR if we do anyway). That seems like a very rare case that isn't worth the complexity. When the device detaches, ahci_free_mem() will release the resource.

Note though that there is a bug in ahci_pci_detach(), it needs to call pci_release_msi() before it frees the BARs.