Skip to content

Commit a7484c8

Browse files
author
Marc Zyngier
committed
KVM: arm64: Allow userspace to request KVM_ARM_VCPU_EL2*
Since we're (almost) feature complete, let's allow userspace to request KVM_ARM_VCPU_EL2* by bumping KVM_VCPU_MAX_FEATURES up. We also now advertise the features to userspace with new capabilities. It's going to be great... Reviewed-by: Oliver Upton <oliver.upton@linux.dev> Reviewed-by: Joey Gouly <joey.gouly@arm.com> Reviewed-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com> Link: https://lore.kernel.org/r/20250514103501.2225951-17-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 6ec4c37 commit a7484c8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
#define KVM_MAX_VCPUS VGIC_V3_MAX_CPUS
4141

42-
#define KVM_VCPU_MAX_FEATURES 7
42+
#define KVM_VCPU_MAX_FEATURES 9
4343
#define KVM_VCPU_VALID_FEATURES (BIT(KVM_VCPU_MAX_FEATURES) - 1)
4444

4545
#define KVM_REQ_SLEEP \

arch/arm64/kvm/arm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
368368
case KVM_CAP_ARM_EL1_32BIT:
369369
r = cpus_have_final_cap(ARM64_HAS_32BIT_EL1);
370370
break;
371+
case KVM_CAP_ARM_EL2:
372+
r = cpus_have_final_cap(ARM64_HAS_NESTED_VIRT);
373+
break;
374+
case KVM_CAP_ARM_EL2_E2H0:
375+
r = cpus_have_final_cap(ARM64_HAS_HCR_NV1);
376+
break;
371377
case KVM_CAP_GUEST_DEBUG_HW_BPS:
372378
r = get_num_brps();
373379
break;

include/uapi/linux/kvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,8 @@ struct kvm_enable_cap {
930930
#define KVM_CAP_X86_APIC_BUS_CYCLES_NS 237
931931
#define KVM_CAP_X86_GUEST_MODE 238
932932
#define KVM_CAP_ARM_WRITABLE_IMP_ID_REGS 239
933+
#define KVM_CAP_ARM_EL2 240
934+
#define KVM_CAP_ARM_EL2_E2H0 241
933935

934936
struct kvm_irq_routing_irqchip {
935937
__u32 irqchip;

0 commit comments

Comments
 (0)