Skip to contentSkip to conversation

KVM: x86: Add KVM_CAP_ENABLE_CAP to x86

PATCH In review Aaron Lewis 3 participants 3 messages Feb 14, 2022 – Feb 15, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86: Add KVM_CAP_ENABLE_CAP to x86

Add the capability KVM_CAP_ENABLE_CAP to x86 so userspace can ensure KVM_ENABLE_CAP is available on a vcpu before using it.

Fixes 5c919412fe61 ("kvm/x86: Hyper-V synthetic interrupt controller")
---
 Documentation/virt/kvm/api.rst | 2 +-
 arch/x86/kvm/x86.c             | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Documentation/virt/kvm/api.rst +1 -1
index a4267104db50..3b4da6c7b25f 100644
@@ -1394,7 +1394,7 @@ documentation when it pops into existence).
 -------------------
 
 :Capability: KVM_CAP_ENABLE_CAP
-:Architectures: mips, ppc, s390
+:Architectures: mips, ppc, s390, x86
 :Type: vcpu ioctl
 :Parameters: struct kvm_enable_cap (in)
 :Returns: 0 on success; -1 on error
arch/x86/kvm/x86.c +1 -0
index 7131d735b1ef..757da29e98f3 100644
@@ -4233,6 +4233,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_EXIT_ON_EMULATION_FAILURE:
 	case KVM_CAP_VCPU_ATTRIBUTES:
 	case KVM_CAP_SYS_ATTRIBUTES:
+	case KVM_CAP_ENABLE_CAP:
 		r = 1;
 		break;
 	case KVM_CAP_EXIT_HYPERCALL:
Signature · 1 line
2.35.1.265.g69c8d7142f-goog
#1 lore raw
Quoted 3 lines · Aaron Lewis

Add the capability KVM_CAP_ENABLE_CAP to x86 so userspace can ensure KVM_ENABLE_CAP is available on a vcpu before using it.

That's a bit terse.

Maybe something like:

Follow the precedent set by other architectures that support the VCPU ioctl, KVM_ENABLE_CAP, and advertise the VM extension, KVM_CAP_ENABLE_CAP.

maintainer
#2 lore raw
Quoted 5 lines · Jim Mattson
Quoted 3 lines · Aaron Lewis

Add the capability KVM_CAP_ENABLE_CAP to x86 so userspace can ensure KVM_ENABLE_CAP is available on a vcpu before using it.

Quoted 8 lines

That's a bit terse.

Maybe something like:

Follow the precedent set by other architectures that support the VCPU ioctl, KVM_ENABLE_CAP, and advertise the VM extension, KVM_CAP_ENABLE_CAP.

Thanks, queued with updated changelog.

Paolo