All of lore.kernel.org
 help / color / mirror / Atom feed
From: ehrhardt@linux.vnet.ibm.com
To: kvm-ppc@vger.kernel.org
Subject: [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr
Date: Thu, 31 Jan 2008 14:56:33 +0000	[thread overview]
Message-ID: <1201791396718-git-send-email-ehrhardt@linux.vnet.ibm.com> (raw)
In-Reply-To: <1201696318462-git-send-email-ehrhardt@linux.vnet.ibm.com>

Changed according to the comments of the first submission.

Subject: [PATCH] [1/4] Add per guest pvr
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

This adds a per vcpu call to get/set the the pvr in vcpu->arch.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---

 arch/powerpc/kvm/powerpc.c |   13 +++++++++++++
 include/asm-powerpc/kvm.h  |    9 +++++++++
 include/linux/kvm.h        |    3 +++
 3 files changed, 25 insertions(+)

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -779,6 +779,19 @@ long kvm_arch_vcpu_ioctl(struct file *fi
 		r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
 		break;
 	}
+	case KVM_SET_GUEST_PVR: {
+		struct kvm_pvr __user *upvr = (struct kvm_pvr __user *)arg;
+		r = copy_from_user(&(vcpu->arch.pvr), &(upvr->pvr),
+					sizeof(__u32));
+		break;
+	}
+	case KVM_GET_GUEST_PVR: {
+		struct kvm_pvr __user *upvr = (struct kvm_pvr __user *)arg;
+		struct kvm_pvr kpvr;
+		kpvr.pvr = vcpu->arch.pvr;
+		r = copy_to_user(upvr, &kpvr, sizeof(struct kvm_pvr));
+		break;
+	}
 	default:
 		r = -EINVAL;
 	}
diff --git a/include/asm-powerpc/kvm.h b/include/asm-powerpc/kvm.h
--- a/include/asm-powerpc/kvm.h
+++ b/include/asm-powerpc/kvm.h
@@ -53,4 +53,13 @@ struct kvm_fpu {
 struct kvm_fpu {
 };
 
+/*
+ * guest ident based on virtual pvr's to differ between cpu types
+ *  this may later on be extended to appear and behave as real pvr's
+*/
+#define KVM_PPC_PVR_PPC440EP 0x422218D3
+
+struct kvm_pvr {
+	__u32 pvr;
+};
 #endif /* __POWERPC_KVM_H__ */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -249,6 +249,7 @@ struct kvm_vapic_addr {
 #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
 					struct kvm_userspace_memory_region)
 #define KVM_SET_TSS_ADDR          _IO(KVMIO, 0x47)
+
 /*
  * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
  * a vcpu fd.
@@ -288,5 +289,7 @@ struct kvm_vapic_addr {
 #define KVM_TPR_ACCESS_REPORTING  _IOWR(KVMIO,  0x92, struct kvm_tpr_access_ctl)
 /* Available with KVM_CAP_VAPIC */
 #define KVM_SET_VAPIC_ADDR        _IOW(KVMIO,  0x93, struct kvm_vapic_addr)
+#define KVM_SET_GUEST_PVR         _IOW(KVMIO,  0x94, struct kvm_pvr)
+#define KVM_GET_GUEST_PVR         _IOR(KVMIO,  0x95, struct kvm_pvr)
 
 #endif

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

  parent reply	other threads:[~2008-01-31 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30 12:31 [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr ehrhardt
2008-01-30 21:18 ` Hollis Blanchard
2008-01-30 21:40 ` Hollis Blanchard
2008-01-31  8:37 ` Christian Ehrhardt
2008-01-31 14:56 ` ehrhardt [this message]
2008-02-01 13:31 ` Zhang Wei

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=1201791396718-git-send-email-ehrhardt@linux.vnet.ibm.com \
    --to=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm-ppc@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 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.