From patchwork Mon Jun 22 10:41:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Huang X-Patchwork-Id: 50154 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 949A821575 for ; Mon, 22 Jun 2015 10:48:04 +0000 (UTC) Received: by laar3 with SMTP id r3sf31698088laa.1 for ; Mon, 22 Jun 2015 03:48:03 -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=aq2A4KtDaCWYRfz4LVeUCAy6NtvkOEG4UN80rzt7AAqoE0ubaEyEiSizcvb40XIHUs F4AADl8iwT2jwZFPWjdLHBgGDqN7MzLKUYW4TUiy6ijt8ylgOgeQ5jmTPDcMwRqCyQHX Zt+ozmUdcAf6/BRBx5upVxBLtvRgwJyzo9gyD/ArzCMaux+BNkKn+T+dVqEPL4KSwbhP Jv8FuqgmHyP5zbeUhqUurLKPhyYaUu95YfvVrQ3FKL81r2jyezzbv/X5spvZ5ku0ssGy AV/qiFlL3dUl5CuYS2cLWmA8e3thHB4MWMUZSqhT9uLWz9yQIRUJD94dnu64zu9r8ucP jTvQ== X-Gm-Message-State: ALoCoQll2YuingVSwy4nHRZBPL0fhcAb8wmInqfP3/ngASZldgjnpdR5g9QeNuiz9d9QjhqYq6b0 X-Received: by 10.194.236.230 with SMTP id ux6mr24772963wjc.5.1434970083090; Mon, 22 Jun 2015 03:48:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.9 with SMTP id ky9ls742543lab.98.gmail; Mon, 22 Jun 2015 03:48:02 -0700 (PDT) X-Received: by 10.112.78.105 with SMTP id a9mr29402776lbx.70.1434970082923; Mon, 22 Jun 2015 03:48:02 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id dz10si16217789lac.88.2015.06.22.03.48.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2015 03:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbvz5 with SMTP id vz5so57996102lbb.0 for ; Mon, 22 Jun 2015 03:48:02 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr29106880lay.72.1434970082690; Mon, 22 Jun 2015 03:48:02 -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 hn6csp2290221lbb; Mon, 22 Jun 2015 03:48:01 -0700 (PDT) X-Received: by 10.66.182.229 with SMTP id eh5mr58009202pac.18.1434970079967; Mon, 22 Jun 2015 03:47:59 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id nk17si29089621pdb.116.2015.06.22.03.47.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2015 03:47:59 -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 1Z6zFQ-0001W2-7Z; Mon, 22 Jun 2015 10:46:40 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z6zBr-00060E-ER for linux-arm-kernel@lists.infradead.org; Mon, 22 Jun 2015 10:43:00 +0000 Received: by pacyo7 with SMTP id yo7so28390848pac.2 for ; Mon, 22 Jun 2015 03:42:38 -0700 (PDT) X-Received: by 10.68.186.35 with SMTP id fh3mr17875693pbc.62.1434969757924; Mon, 22 Jun 2015 03:42:37 -0700 (PDT) Received: from localhost ([104.207.83.42]) by mx.google.com with ESMTPSA id kk6sm19441295pdb.94.2015.06.22.03.42.36 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Jun 2015 03:42:37 -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 v3 11/11] KVM: arm: enable trapping of all debug registers Date: Mon, 22 Jun 2015 18:41:34 +0800 Message-Id: <1434969694-7432-12-git-send-email-zhichao.huang@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1434969694-7432-1-git-send-email-zhichao.huang@linaro.org> References: <1434969694-7432-1-git-send-email-zhichao.huang@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150622_034259_529673_80BE1CD2 X-CRM114-Status: UNSURE ( 8.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.50 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.50 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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.217.178 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 Reviewed-by: Christoffer Dall --- 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