hw/riscv/virt.c, riscv_aplic.c: add 'emulated_aplic' helpers
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Tue, 19 Nov 2024 19:17:03 +0000 (16:17 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 20 Dec 2024 01:22:47 +0000 (11:22 +1000)
commitb319ef15b899c31cad985e50640393483479a3db
tree5a930029e982136792348bb5c076d717d1d24926
parent3fd619db239fb37557dcd51a4b900417b893d706
hw/riscv/virt.c, riscv_aplic.c: add 'emulated_aplic' helpers

The current logic to determine if we don't need an emulated APLIC
controller, i.e. KVM will provide for us, is to determine if we're
running KVM, with in-kernel irqchip support, and running
aia=aplic-imsic. This is modelled by riscv_is_kvm_aia_aplic_imsic() and
virt_use_kvm_aia_aplic_imsic().

This won't suffice to support irqchip_split() mode: it will match
exactly the same conditions as the one above, but setting the irqchip to
'split' mode will now require us to emulate an APLIC s-mode controller,
like we're doing with 'aia=aplic'.

Create a new riscv_use_emulated_aplic() helper that will encapsulate
this logic. Replace the uses of "riscv_is_kvm_aia_aplic_imsic()" with
this helper every time we're taking a decision on emulate an APLIC
controller or not. Do the same in virt.c with virt_use_emulated_aplic().

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20241119191706.718860-6-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
hw/intc/riscv_aplic.c
hw/riscv/virt.c
include/hw/intc/riscv_aplic.h