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, Jan 11, 6:41 AM
Unknown Object (File)
Mon, Dec 29, 10:36 AM
Unknown Object (File)
Sat, Dec 27, 11:13 PM
Unknown Object (File)
Dec 12 2025, 3:39 PM
Unknown Object (File)
Dec 11 2025, 6:34 AM
Unknown Object (File)
Dec 10 2025, 3:38 AM
Unknown Object (File)
Dec 6 2025, 4:43 AM
Unknown Object (File)
Nov 19 2025, 7:25 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.