git: b75a566d1fa8 - stable/14 - x86: Add struct ioapic_intsrc.io_valid
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Apr 2026 15:12:17 UTC
The branch stable/14 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=b75a566d1fa800d8307a7faa50ec22c2a93145bf
commit b75a566d1fa800d8307a7faa50ec22c2a93145bf
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-03-20 22:02:29 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-04-16 15:11:54 +0000
x86: Add struct ioapic_intsrc.io_valid
As of this commit, io_valid is always set to 1; but a future commit
will set it to 0, at which point IOART_INTMSET will be set to forcibly
disable interrupt sources regardless of whether they are requested to
be "masked".
Reviewed by: kib
MFC after: 3 weeks
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D56006
(cherry picked from commit 1d0ccd61563d48e914dccf3dd5cf0280d8331ec1)
---
sys/x86/x86/io_apic.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sys/x86/x86/io_apic.c b/sys/x86/x86/io_apic.c
index 525547f9482a..5dd1bfc3a068 100644
--- a/sys/x86/x86/io_apic.c
+++ b/sys/x86/x86/io_apic.c
@@ -85,6 +85,7 @@ struct ioapic_intsrc {
u_int io_activehi:1;
u_int io_edgetrigger:1;
u_int io_masked:1;
+ u_int io_valid:1;
int io_bus:4;
uint32_t io_lowreg;
u_int io_remap_cookie;
@@ -193,7 +194,7 @@ _ioapic_eoi_source(struct intsrc *isrc, int locked)
ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(src->io_intpin),
low1);
low1 = src->io_lowreg;
- if (src->io_masked != 0)
+ if (src->io_masked != 0 || src->io_valid == 0)
low1 |= IOART_INTMSET;
ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(src->io_intpin),
low1);
@@ -268,7 +269,9 @@ ioapic_enable_source(struct intsrc *isrc)
mtx_lock_spin(&icu_lock);
if (intpin->io_masked) {
- flags = intpin->io_lowreg & ~IOART_INTMASK;
+ flags = intpin->io_lowreg;
+ if (intpin->io_valid)
+ flags &= ~IOART_INTMASK;
ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin),
flags);
intpin->io_masked = 0;
@@ -375,7 +378,7 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
low |= IOART_INTAHI;
else
low |= IOART_INTALO;
- if (intpin->io_masked)
+ if (intpin->io_masked || !intpin->io_valid)
low |= IOART_INTMSET;
switch (intpin->io_irq) {
case IRQ_EXTINT:
@@ -697,11 +700,13 @@ ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase)
intpin->io_activehi = 1;
intpin->io_edgetrigger = 1;
intpin->io_masked = 1;
+ intpin->io_valid = 1;
} else {
intpin->io_bus = APIC_BUS_PCI;
intpin->io_activehi = 0;
intpin->io_edgetrigger = 0;
intpin->io_masked = 1;
+ intpin->io_valid = 1;
}
/*
@@ -806,6 +811,7 @@ ioapic_set_nmi(void *cookie, u_int pin)
io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN;
io->io_pins[pin].io_irq = IRQ_NMI;
io->io_pins[pin].io_masked = 0;
+ io->io_pins[pin].io_valid = 1;
io->io_pins[pin].io_edgetrigger = 1;
io->io_pins[pin].io_activehi = 1;
if (bootverbose)
@@ -829,6 +835,7 @@ ioapic_set_smi(void *cookie, u_int pin)
io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN;
io->io_pins[pin].io_irq = IRQ_SMI;
io->io_pins[pin].io_masked = 0;
+ io->io_pins[pin].io_valid = 1;
io->io_pins[pin].io_edgetrigger = 1;
io->io_pins[pin].io_activehi = 1;
if (bootverbose)
@@ -855,6 +862,7 @@ ioapic_set_extint(void *cookie, u_int pin)
io->io_pins[pin].io_masked = 0;
else
io->io_pins[pin].io_masked = 1;
+ io->io_pins[pin].io_valid = 1;
io->io_pins[pin].io_edgetrigger = 1;
io->io_pins[pin].io_activehi = 1;
if (bootverbose)