From patchwork Wed Aug 20 13:36:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Caraman X-Patchwork-Id: 4751861 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E9B159F3B4 for ; Wed, 20 Aug 2014 13:51:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 065602015E for ; Wed, 20 Aug 2014 13:51:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F2852014A for ; Wed, 20 Aug 2014 13:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbaHTNvl (ORCPT ); Wed, 20 Aug 2014 09:51:41 -0400 Received: from mail-bl2lp0209.outbound.protection.outlook.com ([207.46.163.209]:8988 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751848AbaHTNvk (ORCPT ); Wed, 20 Aug 2014 09:51:40 -0400 Received: from CH1PR03CA009.namprd03.prod.outlook.com (10.255.156.154) by BLUPR03MB502.namprd03.prod.outlook.com (10.141.80.19) with Microsoft SMTP Server (TLS) id 15.0.1015.17; Wed, 20 Aug 2014 13:36:42 +0000 Received: from BN1BFFO11FD034.protection.gbl (10.255.156.132) by CH1PR03CA009.outlook.office365.com (10.255.156.154) with Microsoft SMTP Server (TLS) id 15.0.1010.18 via Frontend Transport; Wed, 20 Aug 2014 13:36:41 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD034.mail.protection.outlook.com (10.58.144.97) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Wed, 20 Aug 2014 13:36:41 +0000 Received: from fsr-fed1764-012.ea.freescale.net (fsr-fed1764-012-010171073213.ea.freescale.net [10.171.73.213]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s7KDaUQq024600; Wed, 20 Aug 2014 06:36:39 -0700 From: Mihai Caraman To: CC: , , Mihai Caraman Subject: [PATCH v4 5/6] KVM: PPC: Booke: Add setter functions for IVPR, IVOR2 and IVOR8 emulation Date: Wed, 20 Aug 2014 16:36:26 +0300 Message-ID: <1408541787-24625-6-git-send-email-mihai.caraman@freescale.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1408541787-24625-1-git-send-email-mihai.caraman@freescale.com> References: <1408541787-24625-1-git-send-email-mihai.caraman@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199003)(189002)(92726001)(36756003)(84676001)(83072002)(21056001)(85852003)(92566001)(85306004)(93916002)(50226001)(64706001)(86362001)(95666004)(62966002)(81342001)(104016003)(99396002)(44976005)(105606002)(19580395003)(6806004)(106466001)(81156004)(50466002)(83322001)(19580405001)(68736004)(69596002)(80022001)(33646002)(20776003)(48376002)(47776003)(97736001)(4396001)(50986999)(87936001)(229853001)(87286001)(88136002)(31966008)(74662001)(74502001)(2351001)(107046002)(89996001)(102836001)(110136001)(76482001)(77982001)(79102001)(46102001)(76176999)(81542001)(77156001)(104166001)(26826002); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR03MB502; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 03094A4065 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=mihai.caraman@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=-7.6 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 setter functions for IVPR, IVOR2 and IVOR8 emulation in preparation for ONE_REG support. Signed-off-by: Mihai Caraman --- v4: - new patch - add api documentation for ONE_REG IVPR and IVORs arch/powerpc/kvm/booke.c | 24 ++++++++++++++++++++++++ arch/powerpc/kvm/booke.h | 3 +++ arch/powerpc/kvm/booke_emulate.c | 15 +++------------ 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 831c1b4..d4df648 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -1782,6 +1782,30 @@ void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits) update_timer_ints(vcpu); } +void kvmppc_set_ivpr(struct kvm_vcpu *vcpu, ulong new_ivpr) +{ + vcpu->arch.ivpr = new_ivpr; +#ifdef CONFIG_KVM_BOOKE_HV + mtspr(SPRN_GIVPR, new_ivpr); +#endif +} + +void kvmppc_set_ivor2(struct kvm_vcpu *vcpu, u32 new_ivor) +{ + vcpu->arch.ivor[BOOKE_IRQPRIO_DATA_STORAGE] = new_ivor; +#ifdef CONFIG_KVM_BOOKE_HV + mtspr(SPRN_GIVOR2, new_ivor); +#endif +} + +void kvmppc_set_ivor8(struct kvm_vcpu *vcpu, u32 new_ivor) +{ + vcpu->arch.ivor[BOOKE_IRQPRIO_SYSCALL] = new_ivor; +#ifdef CONFIG_KVM_BOOKE_HV + mtspr(SPRN_GIVOR8, new_ivor); +#endif +} + void kvmppc_decrementer_func(unsigned long data) { struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h index 22ba08e..0242530 100644 --- a/arch/powerpc/kvm/booke.h +++ b/arch/powerpc/kvm/booke.h @@ -80,6 +80,9 @@ void kvmppc_set_epcr(struct kvm_vcpu *vcpu, u32 new_epcr); void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr); void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits); void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits); +void kvmppc_set_ivpr(struct kvm_vcpu *vcpu, ulong new_ivpr); +void kvmppc_set_ivor2(struct kvm_vcpu *vcpu, u32 new_ivor); +void kvmppc_set_ivor8(struct kvm_vcpu *vcpu, u32 new_ivor); int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, unsigned int inst, int *advance); diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c index 92bc668..94c64e3 100644 --- a/arch/powerpc/kvm/booke_emulate.c +++ b/arch/powerpc/kvm/booke_emulate.c @@ -191,10 +191,7 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) break; case SPRN_IVPR: - vcpu->arch.ivpr = spr_val; -#ifdef CONFIG_KVM_BOOKE_HV - mtspr(SPRN_GIVPR, spr_val); -#endif + kvmppc_set_ivpr(vcpu, spr_val); break; case SPRN_IVOR0: vcpu->arch.ivor[BOOKE_IRQPRIO_CRITICAL] = spr_val; @@ -203,10 +200,7 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) vcpu->arch.ivor[BOOKE_IRQPRIO_MACHINE_CHECK] = spr_val; break; case SPRN_IVOR2: - vcpu->arch.ivor[BOOKE_IRQPRIO_DATA_STORAGE] = spr_val; -#ifdef CONFIG_KVM_BOOKE_HV - mtspr(SPRN_GIVOR2, spr_val); -#endif + kvmppc_set_ivor2(vcpu, spr_val); break; case SPRN_IVOR3: vcpu->arch.ivor[BOOKE_IRQPRIO_INST_STORAGE] = spr_val; @@ -224,10 +218,7 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) vcpu->arch.ivor[BOOKE_IRQPRIO_FP_UNAVAIL] = spr_val; break; case SPRN_IVOR8: - vcpu->arch.ivor[BOOKE_IRQPRIO_SYSCALL] = spr_val; -#ifdef CONFIG_KVM_BOOKE_HV - mtspr(SPRN_GIVOR8, spr_val); -#endif + kvmppc_set_ivor8(vcpu, spr_val); break; case SPRN_IVOR9: vcpu->arch.ivor[BOOKE_IRQPRIO_AP_UNAVAIL] = spr_val;