From 22e05c484823a4d9f0fd9ebeb8c9ddd5d70e1039 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 14 Oct 2016 21:51:50 +0000 Subject: [PATCH] Reprogram I/O APIC interrupt pins when registering an I/O APIC. All I/O APIC pins are masked when an I/O APIC is first probed. The APIC enumerator (MP Table or MADT) then parses its associated tables to configure individual pins to set custom delivery modes or alternate routing (e.g. routing IRQ 0 to intpin 2). Pins for regular interrupt pins are left masked until the first interrupt is assigned. However, pins with unusual settings (e.g. NMI or SMI) are never assigned an interrupt and thus never re-programmed. The I/O APIC code used to reprogram all interrupt pins during registration but this was lost in r151979. In theory, this is mostly a no-op as the ACPI APIC table does not include a way to enumerate NMI or SMI pins for the I/O APIC, so only systems using an MP Table would be affected. Reported by: avg MFC after: 1 month --- sys/x86/x86/io_apic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/x86/x86/io_apic.c b/sys/x86/x86/io_apic.c index 26fc9e98e4d9..4f9d6a52be99 100644 --- a/sys/x86/x86/io_apic.c +++ b/sys/x86/x86/io_apic.c @@ -916,11 +916,16 @@ ioapic_register(void *cookie) io->io_id, flags >> 4, flags & 0xf, io->io_intbase, io->io_intbase + io->io_numintr - 1); - /* Register valid pins as interrupt sources. */ + /* + * Reprogram pins to handle special case pins (such as NMI and + * SMI) and register valid pins as interrupt sources. + */ intr_register_pic(&io->io_pic); - for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++) + for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++) { + ioapic_reprogram_intpin(&pin->io_intsrc); if (pin->io_irq < NUM_IO_INTS) intr_register_source(&pin->io_intsrc); + } } /* A simple new-bus driver to consume PCI I/O APIC devices. */