From patchwork Sat May 16 04:45:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Huang X-Patchwork-Id: 48588 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 818982121F for ; Sat, 16 May 2015 04:55:20 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf36255013wgt.1 for ; Fri, 15 May 2015 21:55:19 -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=jiBvdLV6fbcOQSSRgqWSw7P9w7gJ2VUl3SXcygZQ42rfGsefB4lD1hAE8szUuzCBgn tqtcX2vF4IdUxnzgYXW4lnZKtyvXvXKSxma/ywjQDJl+fLfUuCWPDDgWaqh1bX5SKewW r+coklRwzLy8cuDs6huzXzyMDma54OTglVl7Pr8X3JbSG/1wKw2YMLkc0fMrdCcLYu4M N5vnIwo8dGqW9UEBebLNGoMsYMQio8rlZ8TRcXPdci0KQAlzpUBpDkxW3jSVUwRa3zAJ iu6H9Arw692Ngjjgt0dZ9JQH1Np7lzeSw2IhM3cCQOPziLiew47temx4HitUyBucAVOW /qhg== X-Gm-Message-State: ALoCoQlAyoWt0EtDtb6xqkrApgtCgyJmHdLrZamYkQNYuvFR+e5A+Av5u1NsHubjDOu+bnNmzd4e X-Received: by 10.180.85.129 with SMTP id h1mr1607157wiz.6.1431752119747; Fri, 15 May 2015 21:55:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.74 with SMTP id k10ls618852laf.30.gmail; Fri, 15 May 2015 21:55:19 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr9459023lak.29.1431752119494; Fri, 15 May 2015 21:55:19 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id v13si2375375lal.98.2015.05.15.21.55.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 21:55:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lagr1 with SMTP id r1so68031755lag.0 for ; Fri, 15 May 2015 21:55:19 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr9412052lag.112.1431752119042; Fri, 15 May 2015 21:55:19 -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 hn6csp2474176lbb; Fri, 15 May 2015 21:55:17 -0700 (PDT) X-Received: by 10.66.192.1 with SMTP id hc1mr24503170pac.38.1431752117195; Fri, 15 May 2015 21:55:17 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qp7si5668033pac.120.2015.05.15.21.55.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 21:55:17 -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 1YtU6D-0002uT-7I; Sat, 16 May 2015 04:53:21 +0000 Received: from mail-pa0-f47.google.com ([209.85.220.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YtU0n-0006so-0S for linux-arm-kernel@lists.infradead.org; Sat, 16 May 2015 04:47:45 +0000 Received: by pacwv17 with SMTP id wv17so47602090pac.2 for ; Fri, 15 May 2015 21:47:23 -0700 (PDT) X-Received: by 10.68.219.201 with SMTP id pq9mr24560425pbc.97.1431751643547; Fri, 15 May 2015 21:47:23 -0700 (PDT) Received: from localhost ([167.160.116.91]) by mx.google.com with ESMTPSA id v3sm3377758pbs.18.2015.05.15.21.47.20 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 May 2015 21:47:22 -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 Subject: [PATCH 10/10] KVM: arm: enable trapping of all debug registers Date: Sat, 16 May 2015 12:45:51 +0800 Message-Id: <1431751551-4788-11-git-send-email-zhichao.huang@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1431751551-4788-1-git-send-email-zhichao.huang@linaro.org> References: <1431751551-4788-1-git-send-email-zhichao.huang@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150515_214745_155175_D165776A X-CRM114-Status: UNSURE ( 8.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.47 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.2 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.220.47 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.52 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