From mboxrd@z Thu Jan 1 00:00:00 1970 From: ehrhardt@linux.vnet.ibm.com Date: Thu, 31 Jan 2008 14:56:33 +0000 Subject: [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr Message-Id: <1201791396718-git-send-email-ehrhardt@linux.vnet.ibm.com> List-Id: References: <1201696318462-git-send-email-ehrhardt@linux.vnet.ibm.com> In-Reply-To: <1201696318462-git-send-email-ehrhardt@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc@vger.kernel.org Changed according to the comments of the first submission. Subject: [PATCH] [1/4] Add per guest pvr From: Christian Ehrhardt This adds a per vcpu call to get/set the the pvr in vcpu->arch. Signed-off-by: Christian Ehrhardt --- 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