Skip to content

Commit c61ec3e

Browse files
committed
RISC-V: KVM: Check host Ssaia extension when creating AIA irqchip
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: 89d0130 ("RISC-V: KVM: Implement device interface for AIA irqchip") Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260120080013.2153519-4-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 24433b2 commit c61ec3e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/riscv/kvm/aia_device.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/irqchip/riscv-imsic.h>
1212
#include <linux/kvm_host.h>
1313
#include <linux/uaccess.h>
14+
#include <linux/cpufeature.h>
1415

1516
static int aia_create(struct kvm_device *dev, u32 type)
1617
{
@@ -22,6 +23,9 @@ static int aia_create(struct kvm_device *dev, u32 type)
2223
if (irqchip_in_kernel(kvm))
2324
return -EEXIST;
2425

26+
if (!riscv_isa_extension_available(NULL, SSAIA))
27+
return -ENODEV;
28+
2529
ret = -EBUSY;
2630
if (kvm_trylock_all_vcpus(kvm))
2731
return ret;

0 commit comments

Comments
 (0)