mirror of
https://github.com/opnsense/src.git
synced 2026-03-18 16:52:21 -04:00
pci: Add hw.pci.intx_reroute sysctl/tunable
INTRng can leak resources when INTx interrupts are re-routed, which is typically harmless but can be fatal when devices are (repeatedly) hot plugged into PCI buses on INTRng systems. Re-routing INTx interrupts is nonetheless still necessary on some systems, and identifying whether the re-routing should be enabled or disabled seems to be nontrivial. Add a hw.pci.intx_reroute sysctl/tunable so systems which don't want legacy PCI interrupt re-routing can turn it off. This is probably not the best fix but it's something which can be safely included in FreeBSD 14.3. Co-Authored-by: jhb Reviewed by: bz, jhb MFC after: 3 days Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D49849 (cherry picked from commit 2187ec93ada1c7399f2f3537920f6277bec4a0ef)
This commit is contained in:
parent
a4d583fbee
commit
b0bbefc465
1 changed files with 6 additions and 1 deletions
|
|
@ -431,6 +431,10 @@ SYSCTL_BOOL(_hw_pci, OID_AUTO, enable_mps_tune, CTLFLAG_RWTUN,
|
|||
&pci_enable_mps_tune, 1,
|
||||
"Enable tuning of MPS(maximum payload size)." );
|
||||
|
||||
static bool pci_intx_reroute = true;
|
||||
SYSCTL_BOOL(_hw_pci, OID_AUTO, intx_reroute, CTLFLAG_RWTUN,
|
||||
&pci_intx_reroute, 0, "Re-route INTx interrupts when scanning devices");
|
||||
|
||||
static int
|
||||
pci_has_quirk(uint32_t devid, int quirk)
|
||||
{
|
||||
|
|
@ -4097,7 +4101,8 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask)
|
|||
if (q->devid == devid && q->type == PCI_QUIRK_MAP_REG)
|
||||
pci_add_map(bus, dev, q->arg1, rl, force, 0);
|
||||
|
||||
if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) {
|
||||
if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline) &&
|
||||
pci_intx_reroute) {
|
||||
#ifdef __PCI_REROUTE_INTERRUPT
|
||||
/*
|
||||
* Try to re-route interrupts. Sometimes the BIOS or
|
||||
|
|
|
|||
Loading…
Reference in a new issue