On Tue, Jan 20, 2026 at 1:30 PM Anup Patel <[email protected]> wrote:
>
> The KVM user-space may create KVM AIA irqchip before checking
> VCPU Ssaia extension availability so KVM AIA irqchip must fail
> when host does not have Ssaia extension.
>
> Fixes: 89d01306e34d ("RISC-V: KVM: Implement device interface for AIA
> irqchip")
> Signed-off-by: Anup Patel <[email protected]>
Queued this as fix for Linux-7.0-rcX
Regards,
Anup
> ---
> arch/riscv/kvm/aia_device.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/riscv/kvm/aia_device.c b/arch/riscv/kvm/aia_device.c
> index b195a93add1c..bed4d2c8c44c 100644
> --- a/arch/riscv/kvm/aia_device.c
> +++ b/arch/riscv/kvm/aia_device.c
> @@ -11,6 +11,7 @@
> #include <linux/irqchip/riscv-imsic.h>
> #include <linux/kvm_host.h>
> #include <linux/uaccess.h>
> +#include <linux/cpufeature.h>
>
> static int aia_create(struct kvm_device *dev, u32 type)
> {
> @@ -22,6 +23,9 @@ static int aia_create(struct kvm_device *dev, u32 type)
> if (irqchip_in_kernel(kvm))
> return -EEXIST;
>
> + if (!riscv_isa_extension_available(NULL, SSAIA))
> + return -ENODEV;
> +
> ret = -EBUSY;
> if (kvm_trylock_all_vcpus(kvm))
> return ret;
> --
> 2.43.0
>