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, Jul 5, 2:03 AM
Unknown Object (File)
Tue, Jun 30, 5:30 PM
Unknown Object (File)
Mon, Jun 22, 3:57 PM
Unknown Object (File)
Sat, Jun 20, 1:49 PM
Unknown Object (File)
Wed, Jun 17, 1:57 AM
Unknown Object (File)
Mon, Jun 15, 6:04 AM
Unknown Object (File)
Jun 10 2026, 8:39 AM
Unknown Object (File)
Jun 9 2026, 9:29 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.