From patchwork Mon Aug 4 08:02: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: 376150 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 0FED614010F for ; Mon, 4 Aug 2014 18:05:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbaHDIF2 (ORCPT ); Mon, 4 Aug 2014 04:05:28 -0400 Received: from mail-by2lp0239.outbound.protection.outlook.com ([207.46.163.239]:42802 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751633AbaHDIFZ (ORCPT ); Mon, 4 Aug 2014 04:05:25 -0400 Received: from BY2PR03CA050.namprd03.prod.outlook.com (10.141.249.23) by BLUPR03MB565.namprd03.prod.outlook.com (10.141.77.15) with Microsoft SMTP Server (TLS) id 15.0.995.14; Mon, 4 Aug 2014 08:05:23 +0000 Received: from BN1BFFO11FD037.protection.gbl (2a01:111:f400:7c10::1:177) by BY2PR03CA050.outlook.office365.com (2a01:111:e400:2c5d::23) with Microsoft SMTP Server (TLS) id 15.0.995.14 via Frontend Transport; Mon, 4 Aug 2014 08:05:22 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD037.mail.protection.outlook.com (10.58.144.100) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Mon, 4 Aug 2014 08:05:22 +0000 Received: from kvm.ap.freescale.net (kvm.ap.freescale.net [10.232.14.24]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s7485CI9002141; Mon, 4 Aug 2014 01:05:19 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH 2/5 v2] KVM: PPC: BOOKE : Emulate rfdi instruction Date: Mon, 4 Aug 2014 13:32:40 +0530 Message-ID: <1407139363-25598-3-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1407139363-25598-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1407139363-25598-1-git-send-email-Bharat.Bhushan@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)(189002)(199002)(83072002)(36756003)(21056001)(80022001)(69596002)(93916002)(64706001)(86362001)(50986999)(47776003)(77156001)(6806004)(87936001)(87286001)(76176999)(50466002)(19580395003)(48376002)(4396001)(84676001)(92726001)(104016003)(77982001)(85852003)(85306004)(81156004)(106466001)(97736001)(44976005)(92566001)(104166001)(81342001)(83322001)(50226001)(76482001)(74502001)(19580405001)(46102001)(74662001)(229853001)(26826002)(107046002)(88136002)(105606002)(68736004)(81542001)(99396002)(62966002)(31966008)(102836001)(95666004)(89996001)(20776003)(79102001); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR03MB565; H:az84smr01.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: 0293D40691 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=Bharat.Bhushan@freescale.com; X-OriginatorOrg: freescale.com Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org This patch adds "rfdi" instruction emulation which is required for guest debug hander on BOOKE-HV Signed-off-by: Bharat Bhushan --- v1->v2 -msr update based on guest_debug done under _set_msr(); so removed same check here arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/kvm/booke_emulate.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 98d9dd5..636b230 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -144,6 +144,7 @@ enum kvm_exit_types { EMULATED_TLBWE_EXITS, EMULATED_RFI_EXITS, EMULATED_RFCI_EXITS, + EMULATED_RFDI_EXITS, DEC_EXITS, EXT_INTR_EXITS, HALT_WAKEUP, diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c index 28c1588..4b9a079 100644 --- a/arch/powerpc/kvm/booke_emulate.c +++ b/arch/powerpc/kvm/booke_emulate.c @@ -25,6 +25,7 @@ #define OP_19_XOP_RFI 50 #define OP_19_XOP_RFCI 51 +#define OP_19_XOP_RFDI 39 #define OP_31_XOP_MFMSR 83 #define OP_31_XOP_WRTEE 131 @@ -37,6 +38,12 @@ static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu) kvmppc_set_msr(vcpu, vcpu->arch.shared->srr1); } +static void kvmppc_emul_rfdi(struct kvm_vcpu *vcpu) +{ + vcpu->arch.pc = vcpu->arch.dsrr0; + kvmppc_set_msr(vcpu, vcpu->arch.dsrr1); +} + static void kvmppc_emul_rfci(struct kvm_vcpu *vcpu) { vcpu->arch.pc = vcpu->arch.csrr0; @@ -65,6 +72,12 @@ int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, *advance = 0; break; + case OP_19_XOP_RFDI: + kvmppc_emul_rfdi(vcpu); + kvmppc_set_exit_type(vcpu, EMULATED_RFDI_EXITS); + *advance = 0; + break; + default: emulated = EMULATE_FAIL; break;