Artemis Milestone 2d: xHCI Event Ring servicing, polled not interrupt-driven
Implements Event Ring TRB parsing and ERDP dequeue-pointer update
(xhci_poll_events(), src/starkernel/usb/xhci.c), called from
sk_repl_idle()'s existing ~1s idle cadence rather than a per-arch
interrupt handler.
A first attempt wired real interrupt delivery (PCI->IOAPIC GSI routing,
a dedicated isr_stub34/vector 0x22, GIC/PLIC routing mirroring
virtio_input.c). Checked live via QMP query-pci before trusting it: the
amd64 PIRQ swizzle formula predicted GSI 16 for the xHCI controller at
PCI slot 4; the real QEMU-assigned IRQ was 10, and embedded ICH9
functions contradicted the same formula too. Reverted all of it back to
the exact committed baseline rather than chasing chipset PIRQ routing
further, and reframed around Section U item 6's own design intent
("interrupt-driven, coarse cadence, cheap early-exit... quick check
blocks... done") via sk_repl_idle() instead -- USB insertion is a
human-timescale event, not a hot path.
Added -device qemu-xhci to all three QEMU launch targets (required for
any of this to be testable). Verified end to end via genuine post-boot
hotplug (QMP device_add/device_del usb-storage): all three architectures
detect a live attach within seconds. A false-alarm heartbeat "freeze"
found mid-verification traced to querying the wrong counter
(vm->heartbeat.tick_count, which only advances during word execution,
not the kernel's real ISR-driven heartbeat_ticks()) -- confirmed via a
temporary diagnostic word, captured and reverted.
Full writeup, including the discarded interrupt-routing attempt and the
false-alarm investigation, in FABRIC-2.md's Milestone 2c/2d entries.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HZ8kNoTuP63pbQtro4qvrm
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c2f1d94c97
commit
2b16daba16
@@ -64,6 +64,7 @@ EFI_RUNTIME_SERVICES *g_sk_runtime_services = NULL;
|
||||
#include "starkernel/pci.h"
|
||||
#include "starkernel/virtio_blk.h"
|
||||
#include "starkernel/virtio_input.h"
|
||||
#include "starkernel/xhci_driver.h"
|
||||
#include "block_subsystem.h"
|
||||
#include "vm.h" /* DictEntry, vm_find_word, ACL_MODE_STRICT */
|
||||
#include "log.h" /* must follow vm.h: vm.h's LOG_LINE_MAX has no
|
||||
@@ -615,6 +616,21 @@ static void kernel_main_deep(BootInfo *boot_info) {
|
||||
* sequence parity across all three architectures is unaffected. */
|
||||
(void)virtio_input_find_keyboard();
|
||||
|
||||
/* Artemis Milestone 2b-2c: xHCI controller discovery + bring-up.
|
||||
* Diagnostic-only wiring for now -- nothing yet consumes a connected
|
||||
* device (Milestone 2e/2f/2g); this call site exists so the driver's
|
||||
* two stages actually run and log their own outcome during boot, the
|
||||
* same graceful-noop precedent virtio_input_find_keyboard() above
|
||||
* already establishes. Event Ring servicing is polled from
|
||||
* sk_repl_idle() (Milestone 2d), not driven from here -- see
|
||||
* xhci_poll_events()'s own doc comment for why this driver is polled
|
||||
* rather than interrupt-driven. */
|
||||
{
|
||||
static xhci_dev_t xhci_dev;
|
||||
(void)(xhci_find_and_map(&xhci_dev) == 0 &&
|
||||
xhci_bringup(&xhci_dev) == 0);
|
||||
}
|
||||
|
||||
/* FABRIC.md item 4.4g (decided 2026-08-11): console_fb_init() moved here,
|
||||
* before capsule_birth_mama(), so the fleet-birth/self-test transcript is
|
||||
* framebuffer-visible too, not just the small post-birth tail. Costs
|
||||
|
||||
Reference in New Issue
Block a user