From patchwork Wed Jul 9 17:13:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 33336 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8BA6203F4 for ; Wed, 9 Jul 2014 17:15:36 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 200sf17882029ykr.2 for ; Wed, 09 Jul 2014 10:15:36 -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=ehoOVCzLe+vrjk8+EnpreGAI4Hi1EoYxtZMfL+KbBWk=; b=V3zBFs2JUJi7sa6IvL6LCt1Sbzz5k07W0spTqzExZzq3vC5eEncoVZP+aNGeHGtaPq ARiVxDYB2yATyFRf/oBna7mIVEgNadP7twKXhYg9K/t5E9xlodRnr3JtEsZgEb+vpHyg NFNcsfSAeC8vEw3lZx8GKU6p9mW1lxrbFBQgjh4ydaSErFSSnxh1h8putxoajD8l5gF1 RuHSBxwQtoI6TnUw2o0BSRUCb8UEu/f7BFKIizxzo3Smi3IGbWWAKiqZxU4sP6SyLIC2 ZVi0nIPxZbMExdeKjXjN/M4hnv7L6JOrdwfUUKmgN9l7MUOuLQ+q+N74wfI3viK9NmRA WaqA== X-Gm-Message-State: ALoCoQm3agZYYzwnXkrZAytpCduAqBEmfSPAJ37hV5PKL8uLKFDgUI2+gzIRe/nLeN5uQw3PZ1/c X-Received: by 10.58.154.198 with SMTP id vq6mr523851veb.42.1404926136541; Wed, 09 Jul 2014 10:15:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.6 with SMTP id u6ls363824qgu.59.gmail; Wed, 09 Jul 2014 10:15:36 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr40465728vcb.24.1404926136471; Wed, 09 Jul 2014 10:15:36 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id cl2si21849694vcb.98.2014.07.09.10.15.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 10:15:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hy10so7522012vcb.15 for ; Wed, 09 Jul 2014 10:15:36 -0700 (PDT) X-Received: by 10.58.188.199 with SMTP id gc7mr41094777vec.4.1404926136305; Wed, 09 Jul 2014 10:15:36 -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 tc5csp64885vcb; Wed, 9 Jul 2014 10:15:35 -0700 (PDT) X-Received: by 10.66.236.6 with SMTP id uq6mr41966206pac.24.1404926135475; Wed, 09 Jul 2014 10:15:35 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id kr7si46561711pab.13.2014.07.09.10.15.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jul 2014 10:15:35 -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 1X4vRY-0007Zx-Lz; Wed, 09 Jul 2014 17:14:08 +0000 Received: from inca-roads.misterjones.org ([213.251.177.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4vRJ-0007Nw-6t for linux-arm-kernel@lists.infradead.org; Wed, 09 Jul 2014 17:13:55 +0000 Received: from [176.25.195.83] (helo=why.wild-wind.fr.eu.org) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.80) (envelope-from ) id 1X4vQw-0007MV-5w; Wed, 09 Jul 2014 19:13:30 +0200 From: Marc Zyngier To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Subject: [PATCH v4 9/9] arm64: KVM: enable trapping of all debug registers Date: Wed, 9 Jul 2014 18:13:01 +0100 Message-Id: <1404925981-17561-10-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1404925981-17561-1-git-send-email-marc.zyngier@arm.com> References: <1404925981-17561-1-git-send-email-marc.zyngier@arm.com> X-SA-Exim-Connect-IP: 176.25.195.83 X-SA-Exim-Rcpt-To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, christoffer.dall@linaro.org, will.deacon@arm.com, ian.campbell@citrix.com X-SA-Exim-Mail-From: marc.zyngier@arm.com X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140709_101353_405317_3AE85010 X-CRM114-Status: UNSURE ( 7.29 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) Cc: Will Deacon , Ian Campbell , 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.170 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 100494b..b72aa9f 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S @@ -770,6 +770,14 @@ 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