]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
x86 msi: Enable/disable IDT vectors for MSI groups all at once
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 20 Oct 2023 21:52:38 +0000 (14:52 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 20 Oct 2023 21:52:38 +0000 (14:52 -0700)
commit2d4924892144f653a7a7afba27ed1bf536dd7e51
tree4074db2c6259dadd4ae106fbd94b5d817bd8cca3
parent0e0c4f58370f25cdd824df06f38865b0d455a183
x86 msi: Enable/disable IDT vectors for MSI groups all at once

Unlike MSI-X, when a device uses multiple MSI interrupts, the entire
group of interrupts are enabled/disabled at once in the relevant PCI
config register.  Currently, the interrupt code enables the IDT vector
for each MSI interrupt when a handler is first registered.  If the PCI
device triggers an MSI interrupt which doesn't yet have a handler,
this can trigger a panic when the Xrsvd ISR executes rather than
treating it as a stray device interrupt.

To fix, enable all the IDT vectors for an MSI group when the first
interrupt handler is configured, and don't disable the IDT vectors
until the last interrupt handler for the group is torn down.

When migrating an MSI group between CPUs, enable/disable the entire
group of IDT vectors if at least one interrupt handler is configured
for the group.

Reported by: jhay
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42232
sys/x86/x86/msi.c