All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Add KVM_CAP_ENABLE_CAP to x86
@ 2022-02-14 21:29 Aaron Lewis
  2022-02-14 21:48 ` Jim Mattson
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lewis @ 2022-02-14 21:29 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, jmattson, 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.

Fixes: 5c919412fe61 ("kvm/x86: Hyper-V synthetic interrupt controller")
Signed-off-by: Aaron Lewis <aaronlewis@google.com>
---
 Documentation/virt/kvm/api.rst | 2 +-
 arch/x86/kvm/x86.c             | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index a4267104db50..3b4da6c7b25f 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -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
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7131d735b1ef..757da29e98f3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -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:
-- 
2.35.1.265.g69c8d7142f-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86: Add KVM_CAP_ENABLE_CAP to x86
  2022-02-14 21:29 [PATCH] KVM: x86: Add KVM_CAP_ENABLE_CAP to x86 Aaron Lewis
@ 2022-02-14 21:48 ` Jim Mattson
  2022-02-15 17:32   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Mattson @ 2022-02-14 21:48 UTC (permalink / raw)
  To: Aaron Lewis; +Cc: kvm, pbonzini

On Mon, Feb 14, 2022 at 1:30 PM Aaron Lewis <aaronlewis@google.com> wrote:
>
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86: Add KVM_CAP_ENABLE_CAP to x86
  2022-02-14 21:48 ` Jim Mattson
@ 2022-02-15 17:32   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-02-15 17:32 UTC (permalink / raw)
  To: Jim Mattson, Aaron Lewis; +Cc: kvm

On 2/14/22 22:48, Jim Mattson wrote:
> On Mon, Feb 14, 2022 at 1:30 PM Aaron Lewis <aaronlewis@google.com> wrote:
>>
>> 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.
> 

Thanks, queued with updated changelog.

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-15 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 21:29 [PATCH] KVM: x86: Add KVM_CAP_ENABLE_CAP to x86 Aaron Lewis
2022-02-14 21:48 ` Jim Mattson
2022-02-15 17:32   ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.