From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: jan.kiszka@siemens.com, kvm@vger.kernel.org, gleb@kernel.org,
avi.kivity@gmail.com
Subject: [PATCH 1/5] KVM: x86: support KVM_ENABLE_CAP on vm file descriptors
Date: Tue, 13 May 2014 16:55:37 +0200 [thread overview]
Message-ID: <1399992941-11600-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1399992941-11600-1-git-send-email-pbonzini@redhat.com>
We will use it for CPL save/restore; making it an enabled capability
lets us reuse a padding field in kvm_segment instead of inventing a
new ioctl. This is also simpler because KVM_SET_SREGS already mucks
with the CPL.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/x86.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9e8c74e6a4c1..8e0532fc4d96 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2655,6 +2655,7 @@ int kvm_dev_ioctl_check_extension(long ext)
case KVM_CAP_READONLY_MEM:
case KVM_CAP_HYPERV_TIME:
case KVM_CAP_IOAPIC_POLARITY_IGNORED:
+ case KVM_CAP_ENABLE_CAP_VM:
#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
case KVM_CAP_ASSIGN_DEV_IRQ:
case KVM_CAP_PCI_2_3:
@@ -3673,6 +3674,21 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event,
return 0;
}
+static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
+{
+ int r;
+
+ if (cap->flags)
+ return -EINVAL;
+
+ switch (cap->cap) {
+ default:
+ r = -EINVAL;
+ break;
+ }
+ return r;
+}
+
long kvm_arch_vm_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg)
{
@@ -3709,6 +3725,14 @@ long kvm_arch_vm_ioctl(struct file *filp,
case KVM_GET_NR_MMU_PAGES:
r = kvm_vm_ioctl_get_nr_mmu_pages(kvm);
break;
+ case KVM_ENABLE_CAP: {
+ struct kvm_enable_cap cap;
+ r = -EFAULT;
+ if (copy_from_user(&cap, argp, sizeof(cap)))
+ break;
+ r = kvm_vm_ioctl_enable_cap(kvm, &cap);
+ break;
+ }
case KVM_CREATE_IRQCHIP: {
struct kvm_pic *vpic;
--
1.8.3.1
next prev parent reply other threads:[~2014-05-13 14:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 14:55 [PATCH 0/5] KVM: x86: support setting the CPL independent of CS Paolo Bonzini
2014-05-13 14:55 ` Paolo Bonzini [this message]
2014-05-13 14:55 ` [PATCH 2/5] KVM: x86: retrieve CPL in KVM_GET_SREGS, prepare to be able to set it Paolo Bonzini
2014-05-13 14:55 ` [PATCH 3/5] KVM: vmx: always compute the CPL on KVM_SET_SREGS Paolo Bonzini
2014-05-13 14:55 ` [PATCH 4/5] KVM: vmx: force CPL=0 on real->protected mode transition Paolo Bonzini
2014-05-13 14:55 ` [PATCH 5/5] KVM: x86: add capability to get/set CPL Paolo Bonzini
2014-05-14 7:47 ` [PATCH 0/5] KVM: x86: support setting the CPL independent of CS Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399992941-11600-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=avi.kivity@gmail.com \
--cc=gleb@kernel.org \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®