From patchwork Mon Aug 4 07:52:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 4667311 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 899E19F38D for ; Mon, 4 Aug 2014 07:56:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F6CE201E4 for ; Mon, 4 Aug 2014 07:55:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A5452021A for ; Mon, 4 Aug 2014 07:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751710AbaHDHzs (ORCPT ); Mon, 4 Aug 2014 03:55:48 -0400 Received: from mail-bl2lp0208.outbound.protection.outlook.com ([207.46.163.208]:57054 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751696AbaHDHzq (ORCPT ); Mon, 4 Aug 2014 03:55:46 -0400 Received: from BY2PR03CA042.namprd03.prod.outlook.com (10.141.249.15) by BLUPR03MB567.namprd03.prod.outlook.com (10.141.78.20) with Microsoft SMTP Server (TLS) id 15.0.995.14; Mon, 4 Aug 2014 07:55:26 +0000 Received: from BL2FFO11FD008.protection.gbl (2a01:111:f400:7c09::130) by BY2PR03CA042.outlook.office365.com (2a01:111:e400:2c5d::15) with Microsoft SMTP Server (TLS) id 15.0.995.14 via Frontend Transport; Mon, 4 Aug 2014 07:55:25 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD008.mail.protection.outlook.com (10.173.161.4) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Mon, 4 Aug 2014 07:55:25 +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 s747tB8n028677; Mon, 4 Aug 2014 00:55:22 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH 4/5] KVM: PPC: BOOKE: Clear guest dbsr in userspace exit KVM_EXIT_DEBUG Date: Mon, 4 Aug 2014 13:22:41 +0530 Message-ID: <1407138762-25531-4-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1407138762-25531-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1407138762-25531-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)(92566001)(81342001)(46102001)(92726001)(77982001)(106466001)(95666004)(6806004)(69596002)(83322001)(81156004)(21056001)(64706001)(36756003)(80022001)(87936001)(19580405001)(47776003)(74662001)(107046002)(74502001)(68736004)(88136002)(102836001)(62966002)(19580395003)(84676001)(81542001)(83072002)(50226001)(31966008)(4396001)(93916002)(104166001)(44976005)(48376002)(99396002)(50986999)(76176999)(26826002)(50466002)(77156001)(76482001)(229853001)(79102001)(104016003)(85306004)(86362001)(89996001)(85852003)(87286001)(97736001)(20776003); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR03MB567; 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: TempError (protection.outlook.com: error in processing during lookup of freescale.com: DNS Timeout) Authentication-Results: spf=temperror (sender IP is 192.88.158.2) 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.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 Dbsr is not visible to userspace and we do not think any need to expose this to userspace because: Userspace cannot inject debug interrupt to guest (as this does not know guest ability to handle debug interrupt), so userspace will always clear DBSR. Now if userspace has to always clear DBSR in KVM_EXIT_DEBUG handling then clearing dbsr in kernel looks simple as this avoid doing SET_SREGS/set_one_reg() to clear DBSR Signed-off-by: Bharat Bhushan --- arch/powerpc/kvm/booke.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 322da7d..5c2e26a 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -735,6 +735,17 @@ static int kvmppc_handle_debug(struct kvm_run *run, struct kvm_vcpu *vcpu) struct debug_reg *dbg_reg = &(vcpu->arch.shadow_dbg_reg); u32 dbsr = vcpu->arch.dbsr; + /* Clear guest dbsr (vcpu->arch.dbsr). + * dbsr is not visible to userspace and we do not think any + * need to expose this to userspace because: + * Userspace cannot inject debug interrupt to guest (as this does + * not know guest ability to handle debug interrupt), so userspace + * will always clear DBSR. + * Now if userspace has to always clear DBSR in KVM_EXIT_DEBUG + * handling then clearing here looks simple as this + * avoid doing SET_SREGS/set_one_reg() to clear DBSR + */ + vcpu->arch.dbsr = 0; run->debug.arch.status = 0; run->debug.arch.address = vcpu->arch.pc;