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)
Mon, Nov 25, 12:16 AM
Unknown Object (File)
Tue, Nov 12, 8:01 PM
Unknown Object (File)
Sat, Nov 9, 1:53 AM
Unknown Object (File)
Wed, Oct 30, 3:58 PM
Unknown Object (File)
Oct 22 2024, 5:00 PM
Unknown Object (File)
Sep 26 2024, 11:36 AM
Unknown Object (File)
Sep 26 2024, 7:32 AM
Unknown Object (File)
Sep 17 2024, 6:12 PM

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.