Handle and acknowledge an interrupt
Receive a real level-triggered PLIC interrupt and clear the device source before returning.
Jump to code and terminal ↓The source stays asserted
Writing SAMPLE generates a hardware event. The emulator asserts PLIC source 16, Linux claims it, and the supplied IRQ wrapper invokes student_interrupt. pending bit 0 means a sample; bit 1 means a completed DMA request. Acknowledgment is a write-one-to-clear register, not a read.
Complete the handler
For a sample, update last_temperature and increment state->count. Write the pending mask to LAB_IRQ_ACK before returning. The wrapper completes the PLIC claim, but only the device acknowledgment clears the source. /proc/interrupts shows real Linux IRQ accounting.
Diagnose a storm
A missing acknowledgment repeatedly invokes the handler. After 128 unacknowledged calls, the harness disables this peripheral's IRQ-enable bit so the disposable browser machine remains recoverable. The storm sysfs attribute records that condition, and the test fails. This guard is part of the scaffold, not a substitute for correct device acknowledgment.
Your goal
Count each sample interrupt once and acknowledge every pending bit so the device deasserts its IRQ.
What the tests observe
- Three sample requests yield three handled interrupts
- IRQ_STATUS becomes zero after acknowledgment
- No storm guard is triggered
- The driver is present in /proc/interrupts
Need a nudge?
Hint 1
Read LAB_TEMPERATURE only when pending & 1 is true, and count that event once.
Hint 2
Writing zero to IRQ_ACK clears no bits. Write the mask you handled.
Hint 3
Set state->last_temperature from read32, increment state->count, then call write32 with LAB_IRQ_ACK and pending.
What happens inside Linux
A device raises a supervisor external interrupt through the PLIC. Linux dispatches the registered IRQ action, your callback handles the cause, and a W1C MMIO write deasserts the device line. The PLIC completion and peripheral acknowledgment are separate operations.
Optional account sync. Exercises work without an account.