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
F149761822: D52889.id.diff
Thu, Mar 26, 9:17 PM
Unknown Object (File)
Thu, Mar 19, 8:02 PM
Unknown Object (File)
Wed, Mar 18, 11:02 AM
Unknown Object (File)
Feb 19 2026, 10:09 AM
Unknown Object (File)
Feb 17 2026, 7:24 AM
Unknown Object (File)
Jan 17 2026, 11:27 PM
Unknown Object (File)
Jan 11 2026, 6:41 AM
Unknown Object (File)
Dec 29 2025, 10:36 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.