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(+) diff --git a/target/riscv/kvm_riscv.h b/target/riscv/kvm_riscv.h index 7d4b7c60e2..01be45cc69 100644 --- a/target/riscv/kvm_riscv.h +++ b/target/riscv/kvm_riscv.h @@ -22,9 +22,19 @@ void kvm_riscv_init_user_properties(Object *cpu_obj); void kvm_riscv_reset_vcpu(RISCVCPU *cpu); void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level); + +#ifdef CONFIG_KVM void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, uint64_t aia_irq_num, uint64_t aia_msi_num, uint64_t aplic_base, uint64_t imsic_base, uint64_t guest_num); +#else +static inline void kvm_riscv_aia_create(MachineState *machine, + uint64_t group_shift, uint64_t aia_irq_num, + uint64_t aia_msi_num, uint64_t aplic_base, + uint64_t imsic_base, uint64_t guest_num) { + g_assert_not_reached(); +} +#endif #endif -- 2.41.0