Page MenuHomeFreeBSD

LinuxKPI: fix pci_alloc_irq_vectors() for MSI
ClosedPublic

Authored by bz on Nov 28 2022, 6:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 15 2024, 3:23 PM
Unknown Object (File)
Dec 20 2023, 6:55 AM
Unknown Object (File)
Dec 11 2023, 11:39 PM
Unknown Object (File)
Nov 12 2023, 11:02 AM
Unknown Object (File)
Oct 27 2023, 8:11 PM
Unknown Object (File)
Aug 21 2023, 3:26 AM
Unknown Object (File)
Aug 15 2023, 10:47 PM
Unknown Object (File)
Apr 10 2023, 6:40 AM

Details

Summary

pci_alloc_irq_vectors() is given a min and max vector value.
pci_enable_msi() will always succeed independent on these as it does
not know about them. Further it will only ever allocate 1 "vector"
not supporting any other amount.
So upfront check that (a) the available pci_msi_count() can satisfy the
requested minv and (b) given the pci_enable_msi() hard coded limit check
that minv is not larger than 1.
If we cannot satisfy either requirement return an error.

This fixes problems with drivers which check that the returned value
of allocated "vectors" will match their requests and only otherwise try
to fall back to ask for 1 or deal otherwise.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

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

Event Timeline

bz requested review of this revision.Nov 28 2022, 6:13 PM
hselasky added a subscriber: hselasky.

Looks good.

sys/compat/linuxkpi/common/src/linux_pci.c
937

if (minv != 1) ??

This revision is now accepted and ready to land.Nov 28 2022, 7:22 PM
bz marked an inline comment as done.

Check minv != 1.

This revision now requires review to proceed.Nov 28 2022, 8:22 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 13 2023, 12:40 AM
This revision was automatically updated to reflect the committed changes.