From patchwork Thu Jul 17 11:31:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 4574771 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D486DC0514 for ; Thu, 17 Jul 2014 11:49:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F36BF200CF for ; Thu, 17 Jul 2014 11:49:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 232312018A for ; Thu, 17 Jul 2014 11:49:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757390AbaGQLt0 (ORCPT ); Thu, 17 Jul 2014 07:49:26 -0400 Received: from mail-by2lp0235.outbound.protection.outlook.com ([207.46.163.235]:15811 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755035AbaGQLtW (ORCPT ); Thu, 17 Jul 2014 07:49:22 -0400 Received: from BLUPR03MB567.namprd03.prod.outlook.com (10.141.78.20) by BLUPR03MB003.namprd03.prod.outlook.com (10.255.208.37) with Microsoft SMTP Server (TLS) id 15.0.990.7; Thu, 17 Jul 2014 11:33:56 +0000 Received: from BY2PR03CA055.namprd03.prod.outlook.com (10.141.249.28) by BLUPR03MB567.namprd03.prod.outlook.com (10.141.78.20) with Microsoft SMTP Server (TLS) id 15.0.990.7; Thu, 17 Jul 2014 11:33:55 +0000 Received: from BN1AFFO11FD033.protection.gbl (2a01:111:f400:7c10::199) by BY2PR03CA055.outlook.office365.com (2a01:111:e400:2c5d::28) with Microsoft SMTP Server (TLS) id 15.0.990.7 via Frontend Transport; Thu, 17 Jul 2014 11:33:54 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD033.mail.protection.outlook.com (10.58.52.246) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Thu, 17 Jul 2014 11:33:54 +0000 Received: from kvm.ap.freescale.net (kvm.ap.freescale.net [10.232.14.24]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s6HBXU7H023436; Thu, 17 Jul 2014 04:33:51 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH 6/6 v2] kvm: ppc: Add SPRN_EPR get helper function Date: Thu, 17 Jul 2014 17:01:40 +0530 Message-ID: <1405596700-2699-7-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1405596700-2699-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1405596700-2699-1-git-send-email-Bharat.Bhushan@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(87936001)(77156001)(87286001)(106466001)(36756003)(105606002)(95666004)(85306003)(229853001)(84676001)(76176999)(26826002)(50466002)(62966002)(99396002)(48376002)(89996001)(50986999)(6806004)(44976005)(46102001)(19580405001)(19580395003)(81542001)(83322001)(21056001)(79102001)(76482001)(77982001)(83072002)(104166001)(97736001)(50226001)(74662001)(4396001)(74502001)(107046002)(68736004)(20776003)(47776003)(81342001)(88136002)(104016003)(92566001)(92726001)(102836001)(31966008)(80022001)(64706001)(85852003)(86362001)(93916002); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR03MB567; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 027578BB13 Received-SPF: Fail (: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=Bharat.Bhushan@freescale.com; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kvmppc_set_epr() is already defined in asm/kvm_ppc.h, So rename and move get_epr helper function to same file. Signed-off-by: Bharat Bhushan --- v1->v2 - vcpu->arch.epr under CONFIG_BOOKE arch/powerpc/include/asm/kvm_ppc.h | 10 ++++++++++ arch/powerpc/kvm/booke.c | 11 +---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index 58a5202..14e2d87 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -395,6 +395,16 @@ static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd) { return 0; } #endif +static inline unsigned long kvmppc_get_epr(struct kvm_vcpu *vcpu) +{ +#ifdef CONFIG_KVM_BOOKE_HV + return mfspr(SPRN_GEPR); +#elif defined(CONFIG_BOOKE) + return vcpu->arch.epr; +#endif + return 0; +} + static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr) { #ifdef CONFIG_KVM_BOOKE_HV diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 9606139..5e9a380 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -302,15 +302,6 @@ static void set_guest_mcsrr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1) vcpu->arch.mcsrr1 = srr1; } -static unsigned long get_guest_epr(struct kvm_vcpu *vcpu) -{ -#ifdef CONFIG_KVM_BOOKE_HV - return mfspr(SPRN_GEPR); -#else - return vcpu->arch.epr; -#endif -} - /* Deliver the interrupt of the corresponding priority, if possible. */ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority) @@ -1483,7 +1474,7 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac2); break; case KVM_REG_PPC_EPR: { - u32 epr = get_guest_epr(vcpu); + u32 epr = kvmppc_get_epr(vcpu); val = get_reg_val(reg->id, epr); break; }