git: 1d0ccd61563d - main - x86: Add struct ioapic_intsrc.io_valid
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Mar 2026 05:56:26 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=1d0ccd61563d48e914dccf3dd5cf0280d8331ec1
commit 1d0ccd61563d48e914dccf3dd5cf0280d8331ec1
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-03-20 22:02:29 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-03-28 05:53:17 +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
---
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 d0f47f82011a..03d85acabb1a 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;
}
/*
@@ -796,6 +801,7 @@ ioapic_set_nmi(ioapic_drv_t io, 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)
@@ -817,6 +823,7 @@ ioapic_set_smi(ioapic_drv_t io, 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)
@@ -841,6 +848,7 @@ ioapic_set_extint(ioapic_drv_t io, 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)