HomeFreeBSD

x86: Properly align interrupt vectors for MSI

Description

x86: Properly align interrupt vectors for MSI

MSI (not MSI-X) interrupt vectors must be allocated in groups that are
powers of 2, and the block of IDT vectors must be aligned to the size
of the request.

The code in native_apic_alloc_vectors() does an alignment check in the loop:

if ((vector & (align - 1)) != 0)
    continue;
first = vector;

But it adds APIC_IO_INTS to the value it returns:

return (first + APIC_IO_INTS);

The problem is that APIC_IO_INTS is not a multiple of 32. It is 48:

As a result, a request for 32 vectors (the max supported by MSI), was
not always aligned. To fix, check the alignment of
'vector + APIC_IO_INTS' in the loop.

PR: 274074
Reviewed by: jhb

(cherry picked from commit d33a4ae8ba5343f555842e6e32321f9cd64dfd09)
(cherry picked from commit d73b4f06403af6c1a384c8c59ba9eb138c861ee1)

Approved by: re (karels)

Details

Provenance
John Hay <jhay@FreeBSD.org>Authored on Sep 28 2023, 9:08 PM
jhbCommitted on Oct 16 2023, 11:04 PM
Parents
rG5c855665a04e: cxgbe t4_tls: Call t4_rcvd_locked from do_rx_tls_cmp
Branches
Unknown
Tags
Unknown