public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] KVM: arm/arm64: Add vcpu ENABLE_CAP functionality
Date: Fri, 16 Sep 2016 08:26:26 +0200	[thread overview]
Message-ID: <1474007187-18673-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1474007187-18673-1-git-send-email-agraf@suse.de>

In a follow-up patch we will need to enable capabilities on demand for
backwards compatibility. This patch adds the generic framework to handle
vcpu cap enablement to the arm code base.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 Documentation/virtual/kvm/api.txt |  4 +++-
 arch/arm/kvm/arm.c                | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 739db9a..23937e0 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -997,7 +997,9 @@ documentation when it pops into existence).
 
 Capability: KVM_CAP_ENABLE_CAP, KVM_CAP_ENABLE_CAP_VM
 Architectures: x86 (only KVM_CAP_ENABLE_CAP_VM),
-	       mips (only KVM_CAP_ENABLE_CAP), ppc, s390
+	       mips (only KVM_CAP_ENABLE_CAP), ppc, s390,
+	       arm (only KVM_CAP_ENABLE_CAP),
+	       arm64 (only KVM_CAP_ENABLE_CAP)
 Type: vcpu ioctl, vm ioctl (with KVM_CAP_ENABLE_CAP_VM)
 Parameters: struct kvm_enable_cap (in)
 Returns: 0 on success; -1 on error
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 75f130e..c84b6ad 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -878,6 +878,23 @@ static int kvm_arm_vcpu_has_attr(struct kvm_vcpu *vcpu,
 	return ret;
 }
 
+static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
+				     struct kvm_enable_cap *cap)
+{
+	int r;
+
+	if (cap->flags)
+		return -EINVAL;
+
+	switch (cap->cap) {
+	default:
+		r = -EINVAL;
+		break;
+	}
+
+	return r;
+}
+
 long kvm_arch_vcpu_ioctl(struct file *filp,
 			 unsigned int ioctl, unsigned long arg)
 {
@@ -941,6 +958,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 			return -EFAULT;
 		return kvm_arm_vcpu_has_attr(vcpu, &attr);
 	}
+	case KVM_ENABLE_CAP:
+	{
+		struct kvm_enable_cap cap;
+
+		if (copy_from_user(&cap, argp, sizeof(cap)))
+			return -EFAULT;
+		return kvm_vcpu_ioctl_enable_cap(vcpu, &cap);
+	}
 	default:
 		return -EINVAL;
 	}
-- 
2.6.6

  reply	other threads:[~2016-09-16  6:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16  6:26 [PATCH v3 0/2] KVM: ARM: Enable vtimers with user space gic Alexander Graf
2016-09-16  6:26 ` Alexander Graf [this message]
2016-09-16  6:26 ` [PATCH v3 2/2] KVM: arm/arm64: Route vtimer events to user space Alexander Graf
2016-09-16  9:11   ` Peter Maydell
2016-09-16  9:18     ` Alexander Graf
2016-09-16 10:20 ` [PATCH v3 0/2] KVM: ARM: Enable vtimers with user space gic Marc Zyngier
2016-09-16 12:18   ` Paolo Bonzini
2016-09-16 12:30     ` Christoffer Dall
2016-09-16 12:31       ` Paolo Bonzini
2016-09-16 13:30         ` Christoffer Dall
2016-09-16 13:46           ` Andrew Jones
2016-09-16 15:45             ` Paolo Bonzini
2016-09-16 19:36             ` Alexander Graf
2016-09-19  7:52               ` Andrew Jones
2016-09-19 11:45                 ` Alexander Graf
2016-09-16 13:50           ` Gerd Hoffmann
2016-09-19 10:51           ` Alexander Graf
2016-09-19 11:41             ` Christoffer Dall
2016-09-16 12:25   ` Alexander Graf
2016-09-16 12:29     ` Christoffer Dall
2016-09-16 12:40       ` Paolo Bonzini
2016-09-16 12:44         ` Alexander Graf
2016-09-16 12:54           ` Paolo Bonzini
2016-09-17 15:28           ` Ard Biesheuvel
2016-09-17 15:38             ` Peter Maydell
2016-09-17 16:47               ` Ard Biesheuvel
2016-09-16 12:43       ` Alexander Graf

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=1474007187-18673-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.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