linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: zhichao.huang@linaro.org (Zhichao Huang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/10] KVM: arm: enable trapping of all debug registers
Date: Sat, 16 May 2015 12:45:51 +0800	[thread overview]
Message-ID: <1431751551-4788-11-git-send-email-zhichao.huang@linaro.org> (raw)
In-Reply-To: <1431751551-4788-1-git-send-email-zhichao.huang@linaro.org>

Enable trapping of the debug registers, allowing guests to use
the debug infrastructure.

Signed-off-by: Zhichao Huang <zhichao.huang@linaro.org>
---
 arch/arm/kvm/interrupts_head.S | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index ed406be..107bda4 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -886,10 +886,21 @@ ARM_BE8(rev	r6, r6  )
 .endm
 
 /* Configures the HDCR (Hyp Debug Configuration Register) on entry/return
- * (hardware reset value is 0) */
+ * (hardware reset value is 0)
+ *
+ * Clobbers r2-r4
+ */
 .macro set_hdcr operation
 	mrc	p15, 4, r2, c1, c1, 1
-	ldr	r3, =(HDCR_TPM|HDCR_TPMCR)
+	ldr	r3, =(HDCR_TPM|HDCR_TPMCR|HDCR_TDRA|HDCR_TDOSA)
+
+	// Check for KVM_ARM_DEBUG_DIRTY, and set debug to trap
+	// if not dirty.
+	ldr	r4, [vcpu, #VCPU_DEBUG_FLAGS]
+	cmp	r4, #KVM_ARM_DEBUG_DIRTY
+	beq	1f
+	orr	r3, r3,  #HDCR_TDA
+1:
 	.if \operation == vmentry
 	orr	r2, r2, r3		@ Trap some perfmon accesses
 	.else
-- 
1.7.12.4

      parent reply	other threads:[~2015-05-16  4:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-16  4:45 [PATCH 00/10] KVM: arm: debug infrastructure support Zhichao Huang
2015-05-16  4:45 ` [PATCH 01/10] KVM: arm: plug guest debug exploit Zhichao Huang
2015-05-16  4:45 ` [PATCH 02/10] KVM: arm: rename pm_fake handler to trap_raz_wi Zhichao Huang
2015-05-16  4:45 ` [PATCH 03/10] KVM: arm: enable to use the ARM_DSCR_MDBGEN macro from KVM assembly code Zhichao Huang
2015-05-16  4:45 ` [PATCH 04/10] KVM: arm: common infrastructure for handling AArch32 CP14/CP15 Zhichao Huang
2015-05-16  4:45 ` [PATCH 05/10] KVM: arm: check ordering of all system register tables Zhichao Huang
2015-05-16  4:45 ` [PATCH 06/10] KVM: arm: add trap handlers for 32-bit debug registers Zhichao Huang
2015-05-16  4:45 ` [PATCH 07/10] KVM: arm: add trap handlers for 64-bit " Zhichao Huang
2015-05-16  4:45 ` [PATCH 08/10] KVM: arm: implement dirty bit mechanism for " Zhichao Huang
2015-05-16  4:45 ` [PATCH 09/10] KVM: arm: implement lazy world switch " Zhichao Huang
2015-05-16  4:45 ` Zhichao Huang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431751551-4788-11-git-send-email-zhichao.huang@linaro.org \
    --to=zhichao.huang@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).