From patchwork Tue Jul 15 07:01:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 4551561 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 74405C0515 for ; Tue, 15 Jul 2014 07:03:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F6EB2012F for ; Tue, 15 Jul 2014 07:03:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A29020172 for ; Tue, 15 Jul 2014 07:03:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758122AbaGOHDk (ORCPT ); Tue, 15 Jul 2014 03:03:40 -0400 Received: from mail-bn1lp0140.outbound.protection.outlook.com ([207.46.163.140]:7394 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757819AbaGOHDj (ORCPT ); Tue, 15 Jul 2014 03:03:39 -0400 Received: from BN3PR0301CA0062.namprd03.prod.outlook.com (25.160.152.158) by BLUPR03MB342.namprd03.prod.outlook.com (10.141.48.13) with Microsoft SMTP Server (TLS) id 15.0.990.7; Tue, 15 Jul 2014 07:03:36 +0000 Received: from BN1BFFO11FD036.protection.gbl (2a01:111:f400:7c10::1:100) by BN3PR0301CA0062.outlook.office365.com (2a01:111:e400:401e::30) with Microsoft SMTP Server (TLS) id 15.0.990.7 via Frontend Transport; Tue, 15 Jul 2014 07:03:35 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD036.mail.protection.outlook.com (10.58.144.99) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Tue, 15 Jul 2014 07:03:35 +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 s6F73IPs011522; Tue, 15 Jul 2014 00:03:31 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH 4/6] kvm: ppc: booke: Add shared struct helpers of SPRN_ESR Date: Tue, 15 Jul 2014 12:31:30 +0530 Message-ID: <1405407692-32075-5-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1405407692-32075-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1405407692-32075-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)(189002)(199002)(74502001)(46102001)(68736004)(48376002)(31966008)(74662001)(50466002)(102836001)(229853001)(50986999)(88136002)(83322001)(86362001)(76176999)(50226001)(76482001)(19580395003)(99396002)(44976005)(87936001)(93916002)(104016003)(79102001)(19580405001)(104166001)(107046002)(4396001)(36756003)(97736001)(47776003)(77982001)(6806004)(89996001)(87286001)(95666004)(85852003)(83072002)(84676001)(26826002)(106466001)(92566001)(62966002)(21056001)(105606002)(77156001)(20776003)(64706001)(80022001)(85306003)(81342001)(92726001)(81542001); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR03MB342; 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: 027367F73D 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 627d61e..04280f5 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -520,6 +520,7 @@ SHARED_WRAPPER(sprg3, 64, SPRN_GSPRG3) SHARED_WRAPPER(srr0, 64, SPRN_GSRR0) SHARED_WRAPPER(srr1, 64, SPRN_GSRR1) SHARED_WRAPPER(dar, 64, SPRN_GDEAR) +SHARED_WRAPPER(esr, 64, SPRN_GESR) SHARED_WRAPPER_GET(msr, 64, 0) 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);