From patchwork Fri Jun 20 13:00:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 32279 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 33767203F4 for ; Fri, 20 Jun 2014 13:03:12 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lj1sf13311592pab.1 for ; Fri, 20 Jun 2014 06:03:11 -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:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=kPHfXycv1z0yxQGOwWUDvBL8j6QXcEv5gAwOueHkOLo=; b=MYkeUVgjOw36R82OPUW0WlqfvY285dX4QVac19tofpbZ+RPjjklWMXIbZz3DmCtMJ2 2up6UphBfaJgcKAlN/diAGZsfuL54Q1PWfFgisJkzLU1fnkTgStWFB7i2NSg/j77m4LN 2YphhZIyaBcRlzI+MlPv96pLjcWFckvxfrxp6XeWVmRRdPEj5UxwtZ2rRiriS1RsmmNa 31OLztl3E5V78jvQV9puDMb5494V4i+hGK3bglGa9di8UP/t4soH09gJB+WbnZlU0aYs LRg6IM8gJh5Yy0GEDZiauL7TUX+iDHGYGPcbkErPSnCkLtZ+EFqijdAUvKQmXuVtr/9j 8WXQ== X-Gm-Message-State: ALoCoQnsXIOzHzCX966nyzzNzEe4cnZRDVxo2BdWShLVLn97wNFD6QhXUbou+/A1F7nA979SsDZH X-Received: by 10.68.216.230 with SMTP id ot6mr1297235pbc.3.1403269391529; Fri, 20 Jun 2014 06:03:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.54 with SMTP id b51ls999596qgf.48.gmail; Fri, 20 Jun 2014 06:03:11 -0700 (PDT) X-Received: by 10.58.160.10 with SMTP id xg10mr2941576veb.0.1403269391395; Fri, 20 Jun 2014 06:03:11 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id om8si3943253vcb.90.2014.06.20.06.03.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Jun 2014 06:03:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so3382230vcb.24 for ; Fri, 20 Jun 2014 06:03:11 -0700 (PDT) X-Received: by 10.58.112.65 with SMTP id io1mr275731veb.61.1403269391319; Fri, 20 Jun 2014 06:03:11 -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.221.37.5 with SMTP id tc5csp20773vcb; Fri, 20 Jun 2014 06:03:11 -0700 (PDT) X-Received: by 10.224.161.138 with SMTP id r10mr4837026qax.2.1403269390859; Fri, 20 Jun 2014 06:03:10 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id i4si10520441qge.31.2014.06.20.06.03.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jun 2014 06:03:10 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) 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 1WxyRQ-0002J1-I5; Fri, 20 Jun 2014 13:01:16 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxyR8-0002Aw-L6 for linux-arm-kernel@lists.infradead.org; Fri, 20 Jun 2014 13:01:02 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.143]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 1577913FB7C; Fri, 20 Jun 2014 08:00:16 -0500 (CDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v3 9/9] arm64: KVM: enable trapping of all debug registers Date: Fri, 20 Jun 2014 14:00:07 +0100 Message-Id: <1403269207-1625-10-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1403269207-1625-1-git-send-email-marc.zyngier@arm.com> References: <1403269207-1625-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140620_060058_786354_D0CE120E X-CRM114-Status: UNSURE ( 6.55 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Anup Patel , Christoffer Dall 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: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 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, preventing the guests to mess with the host state (and allowing guests to use the debug infrastructure as well). Reviewed-by: Anup Patel Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S index 727087c..e36ca91 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S @@ -777,6 +777,14 @@ __kvm_hyp_code_start: mrs x2, mdcr_el2 and x2, x2, #MDCR_EL2_HPMN_MASK orr x2, x2, #(MDCR_EL2_TPM | MDCR_EL2_TPMCR) + orr x2, x2, #(MDCR_EL2_TDRA | MDCR_EL2_TDOSA) + + // Check for KVM_ARM64_DEBUG_DIRTY, and set debug to trap + // if not dirty. + ldr x3, [x0, #VCPU_DEBUG_FLAGS] + tbnz x3, #KVM_ARM64_DEBUG_DIRTY_SHIFT, 1f + orr x2, x2, #MDCR_EL2_TDA +1: msr mdcr_el2, x2 .endm