From patchwork Sun May 31 04:27:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Huang X-Patchwork-Id: 49267 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AAF8124588 for ; Sun, 31 May 2015 04:37:06 +0000 (UTC) Received: by laboh3 with SMTP id oh3sf21891171lab.0 for ; Sat, 30 May 2015 21:37:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=OEC4mnz3BbB4rJPi/B4hHDupvntlYx2BqUZWuSQdmnQ=; b=nEHumE/XFMplC4Pg0iWSO0MuXXG/A7l6J4/mrp80hjCB64b3mn/JiRRQrSzGTjPpCE Ri7OEQuRejRh1vilGcMBMmn0y+sVWj9sr5rmSmG2nVMHVyfkzxeF8+kQ6vtjKE0aUE6s hltSFIZX1+nwFMYsZtMwtpQI7PxEsd/zEX879wci1YgJP1wpBUEYhtOd2ja22+hGcgmS zG9JfDPRy7BSJhwuDTdXwnnwl+ak/4knS+/r+T7IRq1olcu5pFnxnSPyUWc628gmrX1k vWD/8U+gfUqZVWOPJK/Tl0ja/yqDlTJ42kaW0WftK/P9aIrW9p//YeQ1ioL3LfWj/Kk9 dsHg== X-Gm-Message-State: ALoCoQlX7+sE+izOZc/hDYQkUiKmEDnndL1wsYyvk8W0f4pa8cMlDPjXrL+kX1XoKvFkRiBl5YQ5 X-Received: by 10.194.175.36 with SMTP id bx4mr14658244wjc.1.1433047025694; Sat, 30 May 2015 21:37:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.229 with SMTP id w5ls482320lag.44.gmail; Sat, 30 May 2015 21:37:05 -0700 (PDT) X-Received: by 10.152.238.1 with SMTP id vg1mr12725234lac.13.1433047025382; Sat, 30 May 2015 21:37:05 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ll10si253445lac.26.2015.05.30.21.37.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2015 21:37:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labpy14 with SMTP id py14so68887517lab.0 for ; Sat, 30 May 2015 21:37:05 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr15205345lae.19.1433047024947; Sat, 30 May 2015 21:37:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1398731lbb; Sat, 30 May 2015 21:37:03 -0700 (PDT) X-Received: by 10.67.8.71 with SMTP id di7mr29199624pad.46.1433047023203; Sat, 30 May 2015 21:37:03 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id lj8si15559354pbc.11.2015.05.30.21.37.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2015 21:37:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yyuxh-0002YP-7t; Sun, 31 May 2015 04:35:01 +0000 Received: from mail-pd0-f176.google.com ([209.85.192.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yyutc-0007G7-2B for linux-arm-kernel@lists.infradead.org; Sun, 31 May 2015 04:30:48 +0000 Received: by pdbki1 with SMTP id ki1so83118247pdb.1 for ; Sat, 30 May 2015 21:30:26 -0700 (PDT) X-Received: by 10.68.57.136 with SMTP id i8mr29140381pbq.74.1433046626830; Sat, 30 May 2015 21:30:26 -0700 (PDT) Received: from localhost ([167.160.116.87]) by mx.google.com with ESMTPSA id zb14sm10221530pab.20.2015.05.30.21.30.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 30 May 2015 21:30:25 -0700 (PDT) From: Zhichao Huang To: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com, alex.bennee@linaro.org, will.deacon@arm.com Subject: [PATCH v2 11/11] KVM: arm: enable trapping of all debug registers Date: Sun, 31 May 2015 12:27:12 +0800 Message-Id: <1433046432-1824-12-git-send-email-zhichao.huang@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1433046432-1824-1-git-send-email-zhichao.huang@linaro.org> References: <1433046432-1824-1-git-send-email-zhichao.huang@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150530_213048_187950_E51270F2 X-CRM114-Status: UNSURE ( 8.40 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.192.176 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.1 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.176 listed in wl.mailspike.net] Cc: huangzhichao@huawei.com, Zhichao Huang X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhichao.huang@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Enable trapping of the debug registers, allowing guests to use the debug infrastructure. Signed-off-by: Zhichao Huang --- arch/arm/kvm/interrupts_head.S | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S index ed406be..107bda4 100644 --- a/arch/arm/kvm/interrupts_head.S +++ b/arch/arm/kvm/interrupts_head.S @@ -886,10 +886,21 @@ ARM_BE8(rev r6, r6 ) .endm /* Configures the HDCR (Hyp Debug Configuration Register) on entry/return - * (hardware reset value is 0) */ + * (hardware reset value is 0) + * + * Clobbers r2-r4 + */ .macro set_hdcr operation mrc p15, 4, r2, c1, c1, 1 - ldr r3, =(HDCR_TPM|HDCR_TPMCR) + ldr r3, =(HDCR_TPM|HDCR_TPMCR|HDCR_TDRA|HDCR_TDOSA) + + // Check for KVM_ARM_DEBUG_DIRTY, and set debug to trap + // if not dirty. + ldr r4, [vcpu, #VCPU_DEBUG_FLAGS] + cmp r4, #KVM_ARM_DEBUG_DIRTY + beq 1f + orr r3, r3, #HDCR_TDA +1: .if \operation == vmentry orr r2, r2, r3 @ Trap some perfmon accesses .else