aarch64: virtio-keyboard-pci, interrupt-driven keyboard input (item 4.3.5e)

Punch list §25 item 4.3.5e complete.

Extended virtio_input.c with a GIC-routed interrupt path alongside 4.3.5c's
PLIC one -- same capability walk, feature negotiation, eventq handling
(confirming §27.5.1's prediction that these items would share most of the
driver). aarch64_irq_handler() dispatches to virtio_input_isr() before its
EOIR write, same claim-dispatch-complete ordering riscv64 uses. Verified
with a real QEMU sendkey keypress: exact KEY_A/press match, two real
interrupts serviced, identical result to riscv64. Found (not fixed) an
unrelated pre-existing bug: BYE's cold-reset path faults on aarch64,
discovered incidentally since nobody had exercised it from a monitored
session before. Three-arch acceptance boot clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-08-08 12:29:27 -04:00
co-authored by Claude Sonnet 5
parent 2a2d7c5e5e
commit a373c9124a
18 changed files with 72523 additions and 78 deletions
+4 -3
View File
@@ -34,9 +34,10 @@
* LAPIC spurious-vector interrupts, both since boot.
*
* @par VKBD-EVENT ( -- code value -1 | 0 )
* Item 4.3.5c. Pop one decoded EV_KEY event (Linux input-event code/value
* pair) off the virtio-input interrupt-fed ring buffer. Kernel-only,
* riscv64-only today (virtio-keyboard-pci); no-op elsewhere.
* Items 4.3.5c (riscv64) / 4.3.5e (aarch64). Pop one decoded EV_KEY event
* (Linux input-event code/value pair) off the virtio-input interrupt-fed
* ring buffer. Kernel-only, riscv64/aarch64 (virtio-keyboard-pci); no-op
* on amd64 (i8042 hardware instead, see KBD-SCAN).
*
* @par VKBD-DEBUG ( -- isr_count )
* Standing diagnostic: count of virtio-input ISR invocations since boot.
+11 -10
View File
@@ -17,7 +17,7 @@
#include "starkernel/i8042.h"
#endif
#if defined(__STARKERNEL__) && defined(ARCH_RISCV64)
#if defined(__STARKERNEL__) && (defined(ARCH_RISCV64) || defined(ARCH_AARCH64))
#include "starkernel/virtio_input.h"
#endif
@@ -54,16 +54,17 @@ static void kbw_debug(VM *vm)
#endif
}
/* VKBD-EVENT ( -- code value -1 | 0 ): item 4.3.5c, riscv64 virtio-input.
* Pop one decoded EV_KEY event off the interrupt-fed ring buffer. Pushes
* code and value and -1 (true) if one was available, or just 0 (false) if
* the buffer was empty. Distinct word from KBD-SCAN rather than a shared
* one: different device, different event shape (Linux-style code/value
* pair vs. a raw XT scancode byte) -- convergence onto one interface is
* item 4.3.5f's explicit job, not this one's. */
/* VKBD-EVENT ( -- code value -1 | 0 ): item 4.3.5c (riscv64) / 4.3.5e
* (aarch64) virtio-input. Pop one decoded EV_KEY event off the
* interrupt-fed ring buffer. Pushes code and value and -1 (true) if one
* was available, or just 0 (false) if the buffer was empty. Distinct word
* from KBD-SCAN rather than a shared one: different device, different
* event shape (Linux-style code/value pair vs. a raw XT scancode byte) --
* convergence onto one interface is item 4.3.5f's explicit job, not this
* one's. */
static void kbw_vevent(VM *vm)
{
#if defined(__STARKERNEL__) && defined(ARCH_RISCV64)
#if defined(__STARKERNEL__) && (defined(ARCH_RISCV64) || defined(ARCH_AARCH64))
uint16_t code;
uint32_t value;
if (virtio_input_pop_event(&code, &value)) {
@@ -83,7 +84,7 @@ static void kbw_vevent(VM *vm)
extern volatile uint32_t g_virtio_input_isr_count;
static void kbw_vdebug(VM *vm)
{
#if defined(__STARKERNEL__) && defined(ARCH_RISCV64)
#if defined(__STARKERNEL__) && (defined(ARCH_RISCV64) || defined(ARCH_AARCH64))
vm_push(vm, (cell_t)g_virtio_input_isr_count);
#else
vm_push(vm, 0);