On 29/8/23 14:21, Daniel Henrique Barboza wrote:
A build with --enable-debug and without KVM will fail as follows:
/usr/bin/ld: libqemu-riscv64-softmmu.fa.p/hw_riscv_virt.c.o: in function
`virt_machine_init':
./qemu/build/../hw/riscv/virt.c:1465: undefined reference to
`kvm_riscv_aia_create'
This happens because the code block with "if virt_use_kvm_aia(s)" isn't
being ignored by the debug build, resulting in an undefined reference to
a KVM only function.
Add a stub for kvm_riscv_aia_create() in kvm_riscv.h when CONFIG_KVM is
false. Adding it as an inline instead of using kvm-stubs.c will make it
easier in the future to remember to add stubs for kvm functions that are
used in multiple accelerator code.
Fixes: dbdb99948e ("target/riscv: select KVM AIA in riscv virt machine")
Signed-off-by: Daniel Henrique Barboza <dbarb...@ventanamicro.com>
---
target/riscv/kvm_riscv.h | 10 ++++++++++
1 file changed, 10 insertions(+)
Similarly:
-- >8 --
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
@@ -79,7 +79,9 @@
/* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by
QEMU. */
static bool virt_use_kvm_aia(RISCVVirtState *s)
{
- return kvm_irqchip_in_kernel() && s->aia_type ==
VIRT_AIA_TYPE_APLIC_IMSIC;
+ return kvm_enabled()
+ && kvm_irqchip_in_kernel()
+ && s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
}
---
?