]> www.infradead.org Git - users/dwmw2/qemu.git/commit
target/riscv: fix VS interrupts forwarding to HS
authorJose Martins <josemartins90@gmail.com>
Tue, 26 Oct 2021 14:51:25 +0000 (15:51 +0100)
committerAlistair Francis <alistair@alistair23.me>
Fri, 29 Oct 2021 06:54:45 +0000 (16:54 +1000)
commit487a99551ae903fc83a878d4cbc6d853e17ad252
tree953376802ac16489cbbfe787b3c0e65531682920
parent0ee9a4e57e1cee4577cab22f6ced6c0c34fb2d94
target/riscv: fix VS interrupts forwarding to HS

VS interrupts (2, 6, 10) were not correctly forwarded to hs-mode when
not delegated in hideleg (which was not being taken into account). This
was mainly because hs level sie was not always considered enabled when
it should. The spec states that "Interrupts for higher-privilege modes,
y>x, are always globally enabled regardless of the setting of the global
yIE bit for the higher-privilege mode." and also "For purposes of
interrupt global enables, HS-mode is considered more privileged than
VS-mode, and VS-mode is considered more privileged than VU-mode". Also,
vs-level interrupts were not being taken into account unless V=1, but
should be unless delegated.

Finally, there is no need for a special case for to handle vs interrupts
as the current privilege level, the state of the global ie and of the
delegation registers should be enough to route all interrupts to the
appropriate privilege level in riscv_cpu_do_interrupt.

Signed-off-by: Jose Martins <josemartins90@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20211026145126.11025-2-josemartins90@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu_helper.c