Skip to content

Commit 899ee68

Browse files
raffi-gcarlescufi
authored andcommitted
riscv: irq: Adjust initialization of mtvec in non-legacy CLIC
If CONFIG_LEGACY_CLIC is disabled, i.e. we adhere to the current CLIC spec, the mode bits of mtvec have to be 0x3. Everything else is reserved. Therefore if CONFIG_RISCV_VECTORED_MODE is enabled, the current implementation is correct. If CONFIG_RISCV_VECTORED_MODE is disabled, the mode bits have to be set, too. Signed-off-by: Greter Raffael <[email protected]>
1 parent ef5c28c commit 899ee68

File tree

1 file changed

+10
-0
lines changed
  • soc/riscv/common/riscv-privileged

1 file changed

+10
-0
lines changed

soc/riscv/common/riscv-privileged/vector.S

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ SECTION_FUNC(vectors, __start)
7676

7777
#else /* !CONFIG_RISCV_VECTORED_MODE */
7878

79+
#if defined(CONFIG_RISCV_HAS_CLIC) && !defined(CONFIG_LEGACY_CLIC)
80+
81+
la t0, _isr_wrapper
82+
addi t0, t0, 0x03 /* Set mode bits to 3, signifying CLIC. Everything else is reserved. */
83+
csrw mtvec, t0
84+
85+
#else /* !CONFIG_RISCV_HAS_CLIC || CONFIG_LEGACY_CLIC */
86+
7987
/*
8088
* CLINT direct mode
8189
*
@@ -85,6 +93,8 @@ SECTION_FUNC(vectors, __start)
8593
la t0, _isr_wrapper
8694
csrw mtvec, t0
8795

96+
#endif /* CONFIG_RISCV_HAS_CLIC&& !CONFIG_LEGACY_CLIC */
97+
8898
#endif /* CONFIG_RISCV_VECTORED_MODE */
8999

90100
/* Jump to __reset */

0 commit comments

Comments
 (0)