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
F167780441: D52889.id163651.diff
Mon, Aug 24, 12:02 PM
Unknown Object (File)
Sun, Aug 23, 9:14 PM
Unknown Object (File)
Sat, Aug 22, 10:52 AM
Unknown Object (File)
Thu, Aug 20, 11:18 AM
Unknown Object (File)
Wed, Aug 19, 2:21 AM
Unknown Object (File)
Tue, Aug 18, 6:15 PM
Unknown Object (File)
Sun, Aug 16, 5:12 PM
Unknown Object (File)
Sat, Aug 15, 6:51 AM
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.