]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: x86: Add KVM_CAP_ENABLE_CAP to x86
authorAaron Lewis <aaronlewis@google.com>
Mon, 14 Feb 2022 21:29:51 +0000 (21:29 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:14:05 +0000 (19:14 +0100)
[ Upstream commit 127770ac0d043435375ab86434f31a93efa88215 ]

Follow the precedent set by other architectures that support the VCPU
ioctl, KVM_ENABLE_CAP, and advertise the VM extension, KVM_CAP_ENABLE_CAP.
This way, userspace can ensure that KVM_ENABLE_CAP is available on a
vcpu before using it.

Fixes: 5c919412fe61 ("kvm/x86: Hyper-V synthetic interrupt controller")
Signed-off-by: Aaron Lewis <aaronlewis@google.com>
Message-Id: <20220214212950.1776943-1-aaronlewis@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Documentation/virt/kvm/api.rst
arch/x86/kvm/x86.c

index aeeb071c7688198cf0f5e29af3b431e8604c742b..9df9eadaeb5c2d6fcdf7b228085ec44cb8a8b40b 100644 (file)
@@ -1391,7 +1391,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
index 0714fa0e7ede05d839c7f979941d9f6a04b1e939..c6eb3e45e3d8045c22f831d99b0c5273148d23d2 100644 (file)
@@ -4163,6 +4163,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_SREGS2:
        case KVM_CAP_EXIT_ON_EMULATION_FAILURE:
        case KVM_CAP_VCPU_ATTRIBUTES:
+       case KVM_CAP_ENABLE_CAP:
                r = 1;
                break;
        case KVM_CAP_EXIT_HYPERCALL: