From patchwork Wed Aug 6 06:38:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 4683771 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 F3C34C0338 for ; Wed, 6 Aug 2014 06:41:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2136D20117 for ; Wed, 6 Aug 2014 06:41:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5209B20115 for ; Wed, 6 Aug 2014 06:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754818AbaHFGlw (ORCPT ); Wed, 6 Aug 2014 02:41:52 -0400 Received: from mail-bn1blp0187.outbound.protection.outlook.com ([207.46.163.187]:32183 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753262AbaHFGlu (ORCPT ); Wed, 6 Aug 2014 02:41:50 -0400 Received: from BN3PR0301CA0001.namprd03.prod.outlook.com (25.160.180.139) by CY1PR0301MB0747.namprd03.prod.outlook.com (25.160.159.153) with Microsoft SMTP Server (TLS) id 15.0.995.14; Wed, 6 Aug 2014 06:41:46 +0000 Received: from BY2FFO11FD006.protection.gbl (2a01:111:f400:7c0c::175) by BN3PR0301CA0001.outlook.office365.com (2a01:111:e400:4000::11) with Microsoft SMTP Server (TLS) id 15.0.1005.10 via Frontend Transport; Wed, 6 Aug 2014 06:41:45 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD006.mail.protection.outlook.com (10.1.14.127) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Wed, 6 Aug 2014 06:41:45 +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 s766fVYC024194; Tue, 5 Aug 2014 23:41:43 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH 4/7 v3] KVM: PPC: BOOKE: Clear guest dbsr in userspace exit KVM_EXIT_DEBUG Date: Wed, 6 Aug 2014 12:08:54 +0530 Message-ID: <1407307137-5083-5-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1407307137-5083-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1407307137-5083-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)(20776003)(47776003)(83072002)(81342001)(89996001)(64706001)(99396002)(106466001)(81156004)(36756003)(229853001)(85852003)(105606002)(87936001)(62966002)(107046002)(80022001)(88136002)(81542001)(92726001)(84676001)(48376002)(92566001)(50986999)(19580395003)(50466002)(97736001)(44976005)(83322001)(19580405001)(86362001)(6806004)(50226001)(4396001)(76176999)(95666004)(93916002)(69596002)(68736004)(87286001)(104016003)(77156001)(77982001)(79102001)(104166001)(102836001)(31966008)(74662001)(74502001)(76482001)(21056001)(85306004)(46102001)(26826002); DIR:OUT; SFP:; SCL:1; SRVR:CY1PR0301MB0747; 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: 02951C14DC 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-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 --- v2->v3 - Small comment in code, patch description have sufficient detail arch/powerpc/kvm/booke.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 322da7d..b4ab86c 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -735,6 +735,8 @@ 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) */ + vcpu->arch.dbsr = 0; run->debug.arch.status = 0; run->debug.arch.address = vcpu->arch.pc;