From patchwork Mon Aug 4 08:47:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 34817 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A79DD21F5F for ; Mon, 4 Aug 2014 09:02:24 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h18sf13303027igc.5 for ; Mon, 04 Aug 2014 02:02:24 -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=nwS+vZBgGcVw7rySjfk1mgwIFbIHsYM+WWdf0/k/QMg=; b=HoSf8MTamZSsIHoCZZjHRrSIpJKFWFrR/9969KuAnOdvCQg2sRjsIFa/L9Ky7Xr88K JAnmOc717U6/BI9OstgsTu0/FqxZHPZA0H6b+m9RnD3MW0cB443Jhd0OblkwpP4oNv/y v62PzbbmxUuZF0Uq+JUimMe/YJgSRcn7CR8ZWc5goGQCiYx1aL3nm1+ZQ4do5WEQZWnK CaU20aaPn8UEf2Cp8LgzAdNBobiiAiLWtovSyRgL47AJgfCQkKxD7odCQqvf2x8yp+pa ahOshj97DxiM5fRl6cnwtBVp9gPlLmP9VNCzWHAF5Kd442laiCQtDWj3gcKfp8w5uD4U 9THQ== X-Gm-Message-State: ALoCoQm3TKFU/6/wnA/si/eGGfiU7nPoNaeH0yM4+USsxpfEsoV9H8G8MoOQRDycZL7WNmqMzuKu X-Received: by 10.182.115.229 with SMTP id jr5mr8971874obb.38.1407142943217; Mon, 04 Aug 2014 02:02:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.18.194 with SMTP id 60ls2068615qgf.7.gmail; Mon, 04 Aug 2014 02:02:23 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr21900119vcb.3.1407142943142; Mon, 04 Aug 2014 02:02:23 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id ey8si11543298vdc.18.2014.08.04.02.02.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 02:02:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so10436878vcb.0 for ; Mon, 04 Aug 2014 02:02:23 -0700 (PDT) X-Received: by 10.52.69.172 with SMTP id f12mr18836066vdu.9.1407142943022; Mon, 04 Aug 2014 02:02:23 -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 tc5csp288899vcb; Mon, 4 Aug 2014 02:02:22 -0700 (PDT) X-Received: by 10.70.45.97 with SMTP id l1mr840165pdm.148.1407142942090; Mon, 04 Aug 2014 02:02:22 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qj6si16962314pac.52.2014.08.04.02.02.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Aug 2014 02:02:21 -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 1XEE8Z-000275-6j; Mon, 04 Aug 2014 09:00:59 +0000 Received: from mail-la0-f53.google.com ([209.85.215.53]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEDxB-0002mn-HG for linux-arm-kernel@lists.infradead.org; Mon, 04 Aug 2014 08:49:14 +0000 Received: by mail-la0-f53.google.com with SMTP id gl10so5004746lab.40 for ; Mon, 04 Aug 2014 01:48:50 -0700 (PDT) X-Received: by 10.112.84.75 with SMTP id w11mr20619463lby.24.1407142130159; Mon, 04 Aug 2014 01:48:50 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id px1sm26731207lbb.46.2014.08.04.01.48.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Aug 2014 01:48:49 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , Gleb Natapov Subject: [GIT PULL 48/51] arm64: KVM: enable trapping of all debug registers Date: Mon, 4 Aug 2014 10:47:05 +0200 Message-Id: <1407142028-31105-49-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1407142028-31105-1-git-send-email-christoffer.dall@linaro.org> References: <1407142028-31105-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140804_014913_793243_1491CD08 X-CRM114-Status: UNSURE ( 8.73 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.53 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.53 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org 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: christoffer.dall@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.220.169 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 From: Marc Zyngier 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