On 25/07/2023 14.26, Andrew Jones wrote:
Since Linux commit 00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA
irqchip support") checking KVM_CAP_IRQCHIP returns non-zero when the
RISC-V platform has AIA. The cap indicates KVM supports at least one
of the following ioctls:
KVM_CREATE_IRQCHIP
KVM_IRQ_LINE
KVM_GET_IRQCHIP
KVM_SET_IRQCHIP
KVM_GET_LAPIC
KVM_SET_LAPIC
but the cap doesn't imply that KVM must support any of those ioctls
in particular. However, QEMU was assuming the KVM_CREATE_IRQCHIP
ioctl was supported. Stop making that assumption by introducing a
KVM parameter that each architecture which supports KVM_CREATE_IRQCHIP
sets. Adding parameters isn't awesome, but given how the
KVM_CAP_IRQCHIP isn't very helpful on its own, we don't have a lot of
options.
Signed-off-by: Andrew Jones <ajo...@ventanamicro.com>
---
While this fixes booting guests on riscv KVM with AIA it's unlikely
to get merged before the QEMU support for KVM AIA[1] lands, which
would also fix the issue. I think this patch is still worth considering
though since QEMU's assumption is wrong.
[1] https://lore.kernel.org/all/20230714084429.22349-1-yongxuan.w...@sifive.com/
v2:
- Move the s390x code to an s390x file. [Thomas]
- Drop the KVM_CAP_IRQCHIP check from the top of kvm_irqchip_create(),
as it's no longer necessary.
Looks good now!
Reviewed-by: Thomas Huth <th...@redhat.com>