mirror of
https://github.com/RhapsodiOS/RhapsodiOS.git
synced 2026-11-03 22:01:40 -07:00
[GH-ISSUE #39] drvAHCI: IRQ interrupt storm hangs the kernel after the port scan #33
Labels
No labels
bug
documentation
enhancement
enhancement
good first issue
help wanted
help wanted
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/RhapsodiOS#33
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @raynorpat on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/RhapsodiOS/RhapsodiOS/issues/39
Found while booting the phase 6 installer ISO from an AHCI CD-ROM (QEMU
-device ahci+ide-cd, i440FX and q35).Background. Until
d231848fb(branchinstall-media-p6, "kernel: keep the page offset when mapping device memory") the AHCI driver never reached the controller: i386 pages are 8 KB and_KernBusMemoryCreateMappingdropped the offset within the page, so QEMU's ABAR at0xfebf1000mapped to0xfebf0000(the cirrus BAR) and the driver printedAHCI: HBA reset and initialisation failed.With that fixed, the driver reads the real registers (CAP0xc0141f05, PI0x3f) and logsAHCI: port 0 ATAPI device detected, ports 1–5 empty.Symptom. Right after the port scan the kernel hangs (no root mount; the screen doesn't change from 60 s to 180 s).
Evidence (QEMU monitor and
-trace ahci_*):GHC.IEwhile the global IS still has port 0's bit set; QEMU raises INTx once (ahci_irq_raise).irr=08 isr=08 imr=b7 elcr=0c: IRQ 11 is level-triggered, in service and unmasked._intr_handler(+0x9d, +0x10d, +0x187, +0x196) or_int_0xFF.So the kernel keeps re-taking a level IRQ 11 that is never masked or cleared, and the driver's
-interruptOccurred(which runs in the I/O thread and clears IS) never runs. NE2K on the same IRQ 11 works, which points at drvAHCI's interrupt setup rather than DriverKit's level-IRQ handling.Likely causes to check.
GHC.IEenabled before the pending port status (PxIS / IS) is cleared during init.Impact. Machines whose disk or CD is on AHCI hang at boot. AHCI CD boot is out of phase 6's gates (IDE CD-ROM only) until this is fixed. Installed disks on IDE are unaffected.
Code:
src/drivers-i386/ide/drvAHCI(AHCIATAPI.mand the controller init),src/kernel-7/driverkitinterrupt dispatch.@raynorpat commented on GitHub (Oct 7, 2026):
Fixed on branch install-media-p6 in commit
55e8df871(not pushed yet, so the commit isn't visible on the remote until that branch is).Root cause: drvAHCI's tables had lost
"Share IRQ Levels" = "YES"(dropped in95af26861). Without it the kernel uses the plain dispatch in KernBusInterrupt.m, which leaves the PIC line unmasked after the handler returns. Level-triggered IRQ 10/11 with a pending AHCI status then re-fires before the I/O thread can run -interruptOccurred. With the key, the shared dispatch masks the line until -enableAllInterrupts resumes it. The fix restores the key in Default.table, Instance0.table and Instance1.table. No kernel or driver code change.Verified on QEMU q35 with the page-offset mapping fix, root on AHCI:
95af26861that sharing breaks both controllers did not hold.Not covered: drivers that use the C IOEnableInterrupt(identity) API with this key (VMXNet, IntelAC97, SB128) were not tested.