]> git.proxmox.com Git - mirror_qemu.git/commit - target/riscv/cpu_helper.c
target/riscv: Add M-mode virtual interrupt and IRQ filtering support.
authorRajnesh Kanwal <rkanwal@rivosinc.com>
Mon, 16 Oct 2023 11:17:35 +0000 (12:17 +0100)
committerAlistair Francis <alistair.francis@wdc.com>
Tue, 7 Nov 2023 01:02:17 +0000 (11:02 +1000)
commit1697837ed98cf56a6f65edd06128151f83b99403
tree19c70275348fb836c8ec1d0d13c9facc8db9231b
parent1ebad505f3d5108513bf150b901344caceb3a7c1
target/riscv: Add M-mode virtual interrupt and IRQ filtering support.

This change adds support for inserting virtual interrupts from M-mode
into S-mode using mvien and mvip csrs. IRQ filtering is a use case of
this change, i-e M-mode can stop delegating an interrupt to S-mode and
instead enable it in MIE and receive those interrupts in M-mode and then
selectively inject the interrupt using mvien and mvip.

Also, the spec doesn't mandate the interrupt to be actually supported
in hardware. Which allows M-mode to assert virtual interrupts to S-mode
that have no connection to any real interrupt events.

This is defined as part of the AIA specification [0], "5.3 Interrupt
filtering and virtual interrupts for supervisor level".

[0]: https://github.com/riscv/riscv-aia/releases/download/1.0/riscv-interrupts-1.0.pdf

Signed-off-by: Rajnesh Kanwal <rkanwal@rivosinc.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <20231016111736.28721-6-rkanwal@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu.c
target/riscv/cpu.h
target/riscv/cpu_bits.h
target/riscv/cpu_helper.c
target/riscv/csr.c
target/riscv/machine.c