From patchwork Tue May 20 16:55:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 30481 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A999720671 for ; Tue, 20 May 2014 16:58:42 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id db11sf2362964veb.8 for ; Tue, 20 May 2014 09:58:42 -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=0iu2PrTg7VnHGrLZmX96rXb3003tFEu5i01IrWa0yCk=; b=F7Dwa/ntyb3uK+1/IZ+8OeQUKM0n0kbqbq8lbFJ7Kg6EcaZN7+tE6O7+NRx+9P9MGk mIswWdhdEuHR6/27lijazju1eMeiZlXmeBja4M0i3srYLSy0wdSloR8yY80oS1NUjwQ4 bgYHkmX6qXR3UwQyHsDBLBMam2KaRbr1Nyj6nkOTw2s+wPjAqDbcOtpL/BapmL5RuwGE KMUfXdTEtKVepYt2xR70R4YaEl/8786FryfinmoKvK+fzQDV1/o7RImGC3OsXdnxBJ9t zg2ZRWhKfQbQ4GxbTdEhddm4JfikvrcBPHLzl6qQ9ZxKPTySe6cKOyyEuNOkHbFH8F0A AN3g== X-Gm-Message-State: ALoCoQkTXtMJNnwcvQXzdphl50Z8LUzGw0gWfvPJ0avc4GGOOVGCS3Vi8oJiDA8VhgghiGRzKfus X-Received: by 10.58.94.163 with SMTP id dd3mr12380492veb.29.1400605122494; Tue, 20 May 2014 09:58:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.118 with SMTP id f109ls367654qge.8.gmail; Tue, 20 May 2014 09:58:42 -0700 (PDT) X-Received: by 10.53.5.194 with SMTP id co2mr1961537vdd.48.1400605122392; Tue, 20 May 2014 09:58:42 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id aw3si4394921vdd.75.2014.05.20.09.58.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 09:58:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id sa20so980945veb.13 for ; Tue, 20 May 2014 09:58:42 -0700 (PDT) X-Received: by 10.58.186.207 with SMTP id fm15mr38227626vec.4.1400605122322; Tue, 20 May 2014 09:58:42 -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 ib8csp46582vcb; Tue, 20 May 2014 09:58:42 -0700 (PDT) X-Received: by 10.140.44.72 with SMTP id f66mr57951877qga.78.1400605121777; Tue, 20 May 2014 09:58:41 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id e88si11038906qgf.197.2014.05.20.09.58.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 May 2014 09:58:41 -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 1WmnLs-0001Op-J3; Tue, 20 May 2014 16:57:20 +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 1WmnL4-0000xV-O6 for linux-arm-kernel@lists.infradead.org; Tue, 20 May 2014 16:56:31 +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 DE24913FB65; Tue, 20 May 2014 11:55:59 -0500 (CDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v2 9/9] arm64: KVM: enable trapping of all debug registers Date: Tue, 20 May 2014 17:55:45 +0100 Message-Id: <1400604945-25247-10-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1400604945-25247-1-git-send-email-marc.zyngier@arm.com> References: <1400604945-25247-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140520_095630_874977_927AC571 X-CRM114-Status: UNSURE ( 7.28 ) 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: Peter Maydell , Ian Campbell , Anup Patel , Catalin Marinas , Will Deacon , 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 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 Signed-off-by: Marc Zyngier Reviewed-by: Christoffer Dall --- 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 73ec5c4..72ed0bf8 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 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