All of lore.kernel.org
 help / color / mirror / Atom feed
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 9/9] arm64: KVM: enable trapping of all debug registers
Date: Sun, 25 May 2014 16:36:29 +0100	[thread overview]
Message-ID: <20140525153629.GJ3866@lvm> (raw)
In-Reply-To: <1400604945-25247-10-git-send-email-marc.zyngier@arm.com>

On Tue, May 20, 2014 at 05:55:45PM +0100, Marc Zyngier wrote:
> 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 <anup.patel@linaro.org>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  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)

so we unconditionally trap on the OS register access, but we don't
properly emulate these do we?  What's the rationale?  (atmittedly,
again, I'm not 100% clear on how the OS lock thingy is supposed to
work/be used).

> +
> +	// Check for KVM_ARM64_DEBUG_DIRTY, and set to debug to trap
> +	// if not dirty.

s/set to debug to trap/set debug to trap/ ??

> +	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
>  
> -- 
> 1.8.3.4
> 

as per the functionality in this patch otherwise:

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>

WARNING: multiple messages have this Message-ID (diff)
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	Will Deacon <will.deacon@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Anup Patel <anup.patel@linaro.org>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH v2 9/9] arm64: KVM: enable trapping of all debug registers
Date: Sun, 25 May 2014 16:36:29 +0100	[thread overview]
Message-ID: <20140525153629.GJ3866@lvm> (raw)
In-Reply-To: <1400604945-25247-10-git-send-email-marc.zyngier@arm.com>

On Tue, May 20, 2014 at 05:55:45PM +0100, Marc Zyngier wrote:
> 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 <anup.patel@linaro.org>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  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)

so we unconditionally trap on the OS register access, but we don't
properly emulate these do we?  What's the rationale?  (atmittedly,
again, I'm not 100% clear on how the OS lock thingy is supposed to
work/be used).

> +
> +	// Check for KVM_ARM64_DEBUG_DIRTY, and set to debug to trap
> +	// if not dirty.

s/set to debug to trap/set debug to trap/ ??

> +	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
>  
> -- 
> 1.8.3.4
> 

as per the functionality in this patch otherwise:

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>

  reply	other threads:[~2014-05-25 15:36 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 16:55 [PATCH v2 0/9] arm64: KVM: debug infrastructure support Marc Zyngier
2014-05-20 16:55 ` Marc Zyngier
2014-05-20 16:55 ` [PATCH v2 1/9] arm64: KVM: rename pm_fake handler to trap_raz_wi Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:34   ` Christoffer Dall
2014-05-25 15:34     ` Christoffer Dall
2014-05-20 16:55 ` [PATCH v2 2/9] arm64: move DBG_MDSCR_* to asm/debug-monitors.h Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:34   ` Christoffer Dall
2014-05-25 15:34     ` Christoffer Dall
2014-05-20 16:55 ` [PATCH v2 3/9] arm64: KVM: add trap handlers for AArch64 debug registers Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:34   ` Christoffer Dall
2014-05-25 15:34     ` Christoffer Dall
2014-05-28 10:27     ` Marc Zyngier
2014-05-28 10:27       ` Marc Zyngier
2014-05-20 16:55 ` [PATCH v2 4/9] arm64: KVM: common infrastructure for handling AArch32 CP14/CP15 Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:34   ` Christoffer Dall
2014-05-25 15:34     ` Christoffer Dall
2014-05-28 10:34     ` Marc Zyngier
2014-05-28 10:34       ` Marc Zyngier
2014-05-20 16:55 ` [PATCH v2 5/9] arm64: KVM: use separate tables for AArch32 32 and 64bit traps Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:35   ` Christoffer Dall
2014-05-25 15:35     ` Christoffer Dall
2014-05-20 16:55 ` [PATCH v2 6/9] arm64: KVM: check ordering of all system register tables Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:35   ` Christoffer Dall
2014-05-25 15:35     ` Christoffer Dall
2014-05-20 16:55 ` [PATCH v2 7/9] arm64: KVM: add trap handlers for AArch32 debug registers Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:35   ` Christoffer Dall
2014-05-25 15:35     ` Christoffer Dall
2014-05-28 16:00     ` Marc Zyngier
2014-05-28 16:00       ` Marc Zyngier
2014-05-29  8:53       ` Christoffer Dall
2014-05-29  8:53         ` Christoffer Dall
2014-05-20 16:55 ` [PATCH v2 8/9] arm64: KVM: implement lazy world switch for " Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:35   ` Christoffer Dall
2014-05-25 15:35     ` Christoffer Dall
2014-05-20 16:55 ` [PATCH v2 9/9] arm64: KVM: enable trapping of all " Marc Zyngier
2014-05-20 16:55   ` Marc Zyngier
2014-05-25 15:36   ` Christoffer Dall [this message]
2014-05-25 15:36     ` Christoffer Dall
2014-05-28 16:10     ` Marc Zyngier
2014-05-28 16:10       ` Marc Zyngier
2014-05-29  8:55       ` Christoffer Dall
2014-05-29  8:55         ` Christoffer Dall
2014-05-25 15:34 ` [PATCH v2 0/9] arm64: KVM: debug infrastructure support Christoffer Dall
2014-05-25 15:34   ` Christoffer Dall
2014-05-28  9:56   ` Marc Zyngier
2014-05-28  9:56     ` Marc Zyngier
2014-05-28  9:58     ` Christoffer Dall
2014-05-28  9:58       ` Christoffer Dall
2014-05-28 10:11       ` Marc Zyngier
2014-05-28 10:11         ` Marc Zyngier

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=20140525153629.GJ3866@lvm \
    --to=christoffer.dall@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.