@samitouri / QOSamiQemu / commits / 27f9566dcd

target/riscv: Update the local interrupt mask

The RISC-V spec describes bits 0-15 as standard fixed interrupts. The AIA spec on the other hand describes bits 0-12 as standard fixed interrupts. This conflict causes issues for us as we don't dynamically determine if AIA is enabled when setting the *delegable_ints consts. This means currently we incorrectly treat the LCOFIP bit as delegable, even if AIA is disabled, which is incorrect (see the issues mentioned below). The AIA spec indicates that implementations can determine which bits of 13-63 in mvien are writable, so let's just make it bits 15-63 to match the main spec. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3133 Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3134 Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3135 Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3138 Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3140 Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Message-ID: <20260513051841.1671987-1-alistair.francis@wdc.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Alistair Francis committed May 13, 2026 at 15:18 UTC 27f9566dcd98bdde045ef5ae7b8199456c8a51c1
1 file changed +2 -2
target/riscv/csr.c
+2 -2
@@ -1781,13 +1781,13 @@ static RISCVException write_stimecmph(CPURISCVState *env, int csrno,
1781 #define VSTOPI_NUM_SRCS 5
1782
1783 /*
1784 - * All core local interrupts except the fixed ones 0:12. This macro is for
1784 + * All core local interrupts except the fixed ones 0:15. This macro is for
1785 * virtual interrupts logic so please don't change this to avoid messing up
1786 * the whole support, For reference see AIA spec: `5.3 Interrupt filtering and
1787 * virtual interrupts for supervisor level` and `6.3.2 Virtual interrupts for
1788 * VS level`.
1789 */
1790 -#define LOCAL_INTERRUPTS (~0x1FFFULL)
1790 +#define LOCAL_INTERRUPTS (~0xFFFFULL)
1791
1792 static const uint64_t delegable_ints =
1793 S_MODE_INTERRUPTS | VS_MODE_INTERRUPTS | MIP_LCOFIP;