I'm working on my own x86_64 UEFI kernel and I'm stuck on PS/2 keyboard interrupts.
I've switched over to the LAPIC/IOAPIC and timer interrupts work fine through the IOAPIC, but IRQ1 never fires on my Lenovo Legion or my old Windows tablet. Polling port 0x60 works perfectly and I can read scancodes, but the keyboard interrupt handler is never entered.
I've checked quite a few things already. The LAPIC is enabled, sti is definitely executed, the IOAPIC is found through the MADT, and IRQ1 maps to GSI1 according to the MADT on both QEMU and my tablet. Neither machine has an ACPI interrupt source override for IRQ1. Both also only have a single IOAPIC with GSI base 0.
The PS/2 controller also seems fine. The config byte ends up as 0x65, scanning is enabled (F4 gets an FA ACK), and polling always reads scancodes.
I'm routing it with:
Code: Select all
ioapic_route_irq(acpi_irq_to_gsi(1), 0x21, 0);Code: Select all
high = 0x0, low = 0x21At this point I'm wondering if I'm missing some APIC/firmware transition on real hardware (_PIC, IMCR, chipset routing, etc.), or if there's another common mistake in IOAPIC keyboard setup that I've overlooked. Does anything above jump out as obviously wrong?

