From patchwork Thu Oct 11 16:13:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Caraman X-Patchwork-Id: 190945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5952C2C0449 for ; Fri, 12 Oct 2012 03:14:59 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754916Ab2JKQOl (ORCPT ); Thu, 11 Oct 2012 12:14:41 -0400 Received: from ch1ehsobe005.messaging.microsoft.com ([216.32.181.185]:56751 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756163Ab2JKQOZ (ORCPT ); Thu, 11 Oct 2012 12:14:25 -0400 Received: from mail18-ch1-R.bigfish.com (10.43.68.245) by CH1EHSOBE009.bigfish.com (10.43.70.59) with Microsoft SMTP Server id 14.1.225.23; Thu, 11 Oct 2012 16:14:24 +0000 Received: from mail18-ch1 (localhost [127.0.0.1]) by mail18-ch1-R.bigfish.com (Postfix) with ESMTP id 6175A10006F; Thu, 11 Oct 2012 16:14:24 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1155h) Received: from mail18-ch1 (localhost.localdomain [127.0.0.1]) by mail18-ch1 (MessageSwitch) id 1349972062550818_27856; Thu, 11 Oct 2012 16:14:22 +0000 (UTC) Received: from CH1EHSMHS022.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.235]) by mail18-ch1.bigfish.com (Postfix) with ESMTP id 8334AC01B8; Thu, 11 Oct 2012 16:14:22 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS022.bigfish.com (10.43.70.22) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 11 Oct 2012 16:14:21 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.2.309.3; Thu, 11 Oct 2012 16:14:19 +0000 Received: from mcaraman-VirtualBox.ea.freescale.net ([10.213.130.145]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q9BGEILh028191; Thu, 11 Oct 2012 09:14:19 -0700 Received: from mcaraman-VirtualBox.ea.freescale.net (localhost [127.0.0.1]) by mcaraman-VirtualBox.ea.freescale.net (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id q9BGE9IN023123; Thu, 11 Oct 2012 19:14:09 +0300 Received: (from mcaraman@localhost) by mcaraman-VirtualBox.ea.freescale.net (8.14.4/8.14.4/Submit) id q9BGE9pJ023122; Thu, 11 Oct 2012 19:14:09 +0300 From: Mihai Caraman To: CC: , , Mihai Caraman Subject: [PATCH 12/12] KVM: PPC: booke: Get/set guest EPCR register using ONE_REG interface Date: Thu, 11 Oct 2012 19:13:29 +0300 Message-ID: <1349972009-23027-13-git-send-email-mihai.caraman@freescale.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1349972009-23027-1-git-send-email-mihai.caraman@freescale.com> References: <1349972009-23027-1-git-send-email-mihai.caraman@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.net Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Implement ONE_REG interface for EPCR register adding KVM_REG_PPC_EPCR to the list of ONE_REG PPC supported registers. Signed-off-by: Mihai Caraman --- Documentation/virtual/kvm/api.txt | 1 + arch/powerpc/include/asm/kvm.h | 2 ++ arch/powerpc/kvm/booke.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index e726d76..c78dff4 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -1773,6 +1773,7 @@ registers, find a list below: PPC | KVM_REG_PPC_VPA_ADDR | 64 PPC | KVM_REG_PPC_VPA_SLB | 128 PPC | KVM_REG_PPC_VPA_DTL | 128 + PPC | KVM_REG_PPC_EPCR | 32 4.69 KVM_GET_ONE_REG diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h index b89ae4d..beb6b20 100644 --- a/arch/powerpc/include/asm/kvm.h +++ b/arch/powerpc/include/asm/kvm.h @@ -386,4 +386,6 @@ struct kvm_book3e_206_tlb_params { #define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83) #define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84) +#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) + #endif /* __LINUX_KVM_POWERPC_H */ diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index d396374..60b8237 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -1395,6 +1395,12 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) &vcpu->arch.dbg_reg.dac[dac], sizeof(u64)); break; } +#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_BOOKE_HV) + case KVM_REG_PPC_EPCR: + r = copy_to_user((u32 __user *)(long)reg->addr, + &vcpu->arch.epcr, sizeof(u32)); + break; +#endif default: break; } @@ -1422,6 +1428,16 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) (u64 __user *)(long)reg->addr, sizeof(u64)); break; } +#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_BOOKE_HV) + case KVM_REG_PPC_EPCR: { + u32 new_epcr; + r = copy_from_user(&new_epcr, + (u32 __user *)(long)reg->addr, sizeof(u32)); + if (r == 0) + kvmppc_set_epcr(vcpu, new_epcr); + break; + } +#endif default: break; }