From patchwork Thu Jul 17 11:31:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 4574711 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 D4AD5C0514 for ; Thu, 17 Jul 2014 11:33:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E02252017D for ; Thu, 17 Jul 2014 11:33:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F153520160 for ; Thu, 17 Jul 2014 11:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756966AbaGQLdy (ORCPT ); Thu, 17 Jul 2014 07:33:54 -0400 Received: from mail-bn1lp0144.outbound.protection.outlook.com ([207.46.163.144]:25329 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756921AbaGQLdx (ORCPT ); Thu, 17 Jul 2014 07:33:53 -0400 Received: from BN3PR0301CA0022.namprd03.prod.outlook.com (25.160.180.160) by DM2PR03MB576.namprd03.prod.outlook.com (10.141.84.19) with Microsoft SMTP Server (TLS) id 15.0.985.8; Thu, 17 Jul 2014 11:33:49 +0000 Received: from BN1BFFO11FD058.protection.gbl (2a01:111:f400:7c10::1:160) by BN3PR0301CA0022.outlook.office365.com (2a01:111:e400:4000::32) with Microsoft SMTP Server (TLS) id 15.0.985.8 via Frontend Transport; Thu, 17 Jul 2014 11:33:49 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD058.mail.protection.outlook.com (10.58.145.13) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Thu, 17 Jul 2014 11:33:49 +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 s6HBXU7F023436; Thu, 17 Jul 2014 04:33:45 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH 4/6 v2] kvm: ppc: booke: Add shared struct helpers of SPRN_ESR Date: Thu, 17 Jul 2014 17:01:38 +0530 Message-ID: <1405596700-2699-5-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)(104166001)(50986999)(99396002)(62966002)(89996001)(76482001)(19580395003)(229853001)(19580405001)(107046002)(6806004)(20776003)(44976005)(95666004)(68736004)(83322001)(83072002)(26826002)(84676001)(74502001)(48376002)(102836001)(87286001)(88136002)(50226001)(81542001)(4396001)(21056001)(87936001)(80022001)(85306003)(46102001)(50466002)(93916002)(81342001)(64706001)(77982001)(105606002)(92566001)(76176999)(85852003)(31966008)(74662001)(92726001)(104016003)(77156001)(86362001)(36756003)(47776003)(79102001)(97736001)(106466001); DIR:OUT; SFP:; SCL:1; SRVR:DM2PR03MB576; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; LANG:; 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-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 Add and use kvmppc_set_esr() and kvmppc_get_esr() helper functions Signed-off-by: Bharat Bhushan --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/booke.c | 24 +++--------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index 7646994..58a5202 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -533,6 +533,7 @@ SHARED_SPRNG_WRAPPER(sprg3, 64, SPRN_GSPRG3) SHARED_SPRNG_WRAPPER(srr0, 64, SPRN_GSRR0) SHARED_SPRNG_WRAPPER(srr1, 64, SPRN_GSRR1) SHARED_SPRNG_WRAPPER(dar, 64, SPRN_GDEAR) +SHARED_SPRNG_WRAPPER(esr, 64, SPRN_GESR) SHARED_WRAPPER_GET(msr, 64) static inline void kvmppc_set_msr_fast(struct kvm_vcpu *vcpu, u64 val) { diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 20296c8..81484d9 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -302,24 +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_esr(struct kvm_vcpu *vcpu) -{ -#ifdef CONFIG_KVM_BOOKE_HV - return mfspr(SPRN_GESR); -#else - return vcpu->arch.shared->esr; -#endif -} - -static void set_guest_esr(struct kvm_vcpu *vcpu, u32 esr) -{ -#ifdef CONFIG_KVM_BOOKE_HV - mtspr(SPRN_GESR, esr); -#else - vcpu->arch.shared->esr = esr; -#endif -} - static unsigned long get_guest_epr(struct kvm_vcpu *vcpu) { #ifdef CONFIG_KVM_BOOKE_HV @@ -441,7 +423,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu, vcpu->arch.pc = vcpu->arch.ivpr | vcpu->arch.ivor[priority]; if (update_esr == true) - set_guest_esr(vcpu, vcpu->arch.queued_esr); + kvmppc_set_esr(vcpu, vcpu->arch.queued_esr); if (update_dear == true) kvmppc_set_dar(vcpu, vcpu->arch.queued_dear); if (update_epr == true) { @@ -1329,7 +1311,7 @@ static void get_sregs_base(struct kvm_vcpu *vcpu, sregs->u.e.csrr0 = vcpu->arch.csrr0; sregs->u.e.csrr1 = vcpu->arch.csrr1; sregs->u.e.mcsr = vcpu->arch.mcsr; - sregs->u.e.esr = get_guest_esr(vcpu); + sregs->u.e.esr = kvmppc_get_esr(vcpu); sregs->u.e.dear = kvmppc_get_dar(vcpu); sregs->u.e.tsr = vcpu->arch.tsr; sregs->u.e.tcr = vcpu->arch.tcr; @@ -1347,7 +1329,7 @@ static int set_sregs_base(struct kvm_vcpu *vcpu, vcpu->arch.csrr0 = sregs->u.e.csrr0; vcpu->arch.csrr1 = sregs->u.e.csrr1; vcpu->arch.mcsr = sregs->u.e.mcsr; - set_guest_esr(vcpu, sregs->u.e.esr); + kvmppc_set_esr(vcpu, sregs->u.e.esr); kvmppc_set_dar(vcpu, sregs->u.e.dear); vcpu->arch.vrsave = sregs->u.e.vrsave; kvmppc_set_tcr(vcpu, sregs->u.e.tcr);