Skip to content

Commit a1daae7

Browse files
filippofontanajosecm
authored andcommitted
fix(riscv/interrupts): add missing initialization for irqc_timer_int_id
irqc_timer_int_id is the variable representing the ID of the timer interrupt. It is declared in the interrupts.c but is never defined, causing a bug while handling timer interrupts inside the handler for the AIA controller ("no interrupt handler for ID 0"). The irqc_timer_int_id variable is initialized following the same strategy used for interrupts_ipi_id. Signed-off-by: Filippo Fontana <[email protected]>
1 parent 85bc288 commit a1daae7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/arch/riscv/sbi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <bit.h>
1111
#include <fences.h>
1212
#include <hypercall.h>
13+
#include <interrupts.h>
1314

1415
#define SBI_EXTID_BASE (0x10)
1516
#define SBI_GET_SBI_SPEC_VERSION_FID (0)
@@ -499,7 +500,8 @@ void sbi_init()
499500
}
500501
}
501502

502-
if (!interrupts_reserve(TIMR_INT_ID, (irq_handler_t)sbi_timer_irq_handler)) {
503+
irqc_timer_int_id = interrupts_reserve(TIMR_INT_ID, (irq_handler_t)sbi_timer_irq_handler);
504+
if (irqc_timer_int_id == INVALID_IRQID) {
503505
ERROR("Failed to reserve SBI TIMR_INT_ID interrupt");
504506
}
505507
}

0 commit comments

Comments
 (0)