From patchwork Fri Jul 11 08:38:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 4531781 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 2FA679F4F5 for ; Fri, 11 Jul 2014 08:41:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61996201F2 for ; Fri, 11 Jul 2014 08:41:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F03B201D5 for ; Fri, 11 Jul 2014 08:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbaGKIlU (ORCPT ); Fri, 11 Jul 2014 04:41:20 -0400 Received: from mail-bl2lp0212.outbound.protection.outlook.com ([207.46.163.212]:48704 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752561AbaGKIlO (ORCPT ); Fri, 11 Jul 2014 04:41:14 -0400 Received: from BN3PR0301CA0065.namprd03.prod.outlook.com (25.160.152.161) by BY2PR03MB347.namprd03.prod.outlook.com (10.141.139.16) with Microsoft SMTP Server (TLS) id 15.0.980.8; Fri, 11 Jul 2014 08:40:53 +0000 Received: from BN1AFFO11FD023.protection.gbl (2a01:111:f400:7c10::155) by BN3PR0301CA0065.outlook.office365.com (2a01:111:e400:401e::33) with Microsoft SMTP Server (TLS) id 15.0.985.8 via Frontend Transport; Fri, 11 Jul 2014 08:40:53 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD023.mail.protection.outlook.com (10.58.52.83) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Fri, 11 Jul 2014 08:40:52 +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 s6B8ec3P030811; Fri, 11 Jul 2014 01:40:50 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH 4/6] KVM: PPC: BOOKE : Emulate rfdi instruction Date: Fri, 11 Jul 2014 14:08:59 +0530 Message-ID: <1405067941-27134-5-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1405067941-27134-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1405067941-27134-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)(83322001)(74662001)(87936001)(62966002)(83072002)(87286001)(4396001)(93916002)(44976005)(229853001)(102836001)(85852003)(76482001)(50226001)(95666004)(81542001)(50986999)(26826002)(106466001)(104016003)(21056001)(104166001)(47776003)(50466002)(92726001)(99396002)(36756003)(68736004)(48376002)(97736001)(64706001)(88136002)(80022001)(77982001)(92566001)(89996001)(79102001)(105606002)(85306003)(86362001)(77156001)(6806004)(74502001)(84676001)(19580395003)(81342001)(31966008)(76176999)(107046002)(19580405001)(46102001)(20776003); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB347; 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: 02698DF457 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=-7.5 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 This patch adds "rfdi" instruction emulation which is required for guest debug hander on BOOKE-HV Signed-off-by: Bharat Bhushan --- arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/kvm/booke_emulate.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 855ba4d..372b977 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -149,6 +149,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 80c51a2..2a20194 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,16 @@ 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; + /* Force MSR_DE when guest does not own debug facilities */ + if (vcpu->guest_debug) + kvmppc_set_msr(vcpu, vcpu->arch.dsrr1 | MSR_DE); + else + kvmppc_set_msr(vcpu, vcpu->arch.dsrr1); +} + static void kvmppc_emul_rfci(struct kvm_vcpu *vcpu) { vcpu->arch.pc = vcpu->arch.csrr0; @@ -69,6 +80,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;