From patchwork Wed May 7 15:20:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 29799 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 058B0202E4 for ; Wed, 7 May 2014 15:23:52 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wm4sf5602248obc.6 for ; Wed, 07 May 2014 08:23:52 -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=z4RX1kiVxmAO78p2k1pbFRtM03+MqpS2Pq1bVcYx7mM=; b=HdGAtJUhYICVmZThVFYK6h8NRChokO2jLNNtwr4WOc+5InW3yPH7YPh/FTmOpN8AA1 wenZja7lrejIHlSMTdU72xLAkQof3lLm6PslNwZE8VxMJgtxELd9EzWd9eXTPO6XnNcZ tOzjdtVISMl1eWJWHnzOE5bnXkz//JNp/cVZjEzfIW5mbtau7LdHgsERe3pA2cg12wSH 1/2jZ38ZY//abT0jlnc1ntqG3c3Yf8IyzU3oPC5Ue8waYi4wnkfTiRh3A5vOMbdwM6RV L1yZShYeAsTXMTkJc/ertFKs3PRJvfbUTtjqRbS6nvgdXBkqjO/B0hkIQBeC1Jrns5ur 6D5A== X-Gm-Message-State: ALoCoQlPzy2k5Xn5xetweFrDhbv9VF1Bp24kGlSuIz93tt1K6iw91NFkbC19U5X2X65qqSs5q6BJ X-Received: by 10.50.50.2 with SMTP id y2mr4654593ign.1.1399476232176; Wed, 07 May 2014 08:23:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.20 with SMTP id b20ls3374599qga.5.gmail; Wed, 07 May 2014 08:23:52 -0700 (PDT) X-Received: by 10.220.81.194 with SMTP id y2mr8080298vck.29.1399476232042; Wed, 07 May 2014 08:23:52 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id bj3si2959206vcb.172.2014.05.07.08.23.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 May 2014 08:23:52 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id jx11so1515858veb.28 for ; Wed, 07 May 2014 08:23:51 -0700 (PDT) X-Received: by 10.58.186.207 with SMTP id fm15mr2312937vec.4.1399476231949; Wed, 07 May 2014 08:23:51 -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.220.221.72 with SMTP id ib8csp318805vcb; Wed, 7 May 2014 08:23:50 -0700 (PDT) X-Received: by 10.224.164.197 with SMTP id f5mr19424146qay.32.1399476230349; Wed, 07 May 2014 08:23:50 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id e7si6901162qai.65.2014.05.07.08.23.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 May 2014 08:23:50 -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 1Wi3g5-0000Fd-MS; Wed, 07 May 2014 15:22:37 +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 1Wi3fB-0007Dl-Hq for linux-arm-kernel@lists.infradead.org; Wed, 07 May 2014 15:21:42 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.166]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 8226513FAAC; Wed, 7 May 2014 10:21:07 -0500 (CDT) From: Marc Zyngier To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Subject: [PATCH 9/9] arm64: KVM: enable trapping of all debug registers Date: Wed, 7 May 2014 16:20:54 +0100 Message-Id: <1399476054-21571-10-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1399476054-21571-1-git-send-email-marc.zyngier@arm.com> References: <1399476054-21571-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140507_082141_704840_96DBBD21 X-CRM114-Status: UNSURE ( 6.97 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: Catalin Marinas , Will Deacon , Ian Campbell , Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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). 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 f9d5a1d..037d5d9 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S @@ -753,6 +753,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 to 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