All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: [PATCH 11/13] arm64: KVM/debug: trap all accesses to SPE controls at EL1
Date: Thu, 28 Feb 2019 16:07:33 +0000	[thread overview]
Message-ID: <20190228160737.3323-12-sudeep.holla@arm.com> (raw)
In-Reply-To: <20190228160737.3323-1-sudeep.holla@arm.com>

Now that we have all the save/restore mechanism in place, lets enable
trapping of accesses to SPE profiling buffer controls at EL1 to EL2.
This will also change the translation regime used by buffer from EL2
stage 1 to EL1 stage 1 on VHE systems.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/arm64/kvm/hyp/switch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
index 3054b8b8f037..8738e9438780 100644
--- a/arch/arm64/kvm/hyp/switch.c
+++ b/arch/arm64/kvm/hyp/switch.c
@@ -106,6 +106,7 @@ static void activate_traps_vhe(struct kvm_vcpu *vcpu)
 
 	write_sysreg(val, cpacr_el1);
 
+	write_sysreg(vcpu->arch.mdcr_el2 | 2 << MDCR_EL2_E2PB_SHIFT, mdcr_el2);
 	write_sysreg(kvm_get_hyp_vector(), vbar_el1);
 }
 NOKPROBE_SYMBOL(activate_traps_vhe);
@@ -123,6 +124,7 @@ static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu)
 		__activate_traps_fpsimd32(vcpu);
 	}
 
+	write_sysreg(vcpu->arch.mdcr_el2 | 2 << MDCR_EL2_E2PB_SHIFT, mdcr_el2);
 	write_sysreg(val, cptr_el2);
 }
 
-- 
2.17.1

WARNING: multiple messages have this Message-ID (diff)
From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Christoffer Dall <christoffer.dall@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: [PATCH 11/13] arm64: KVM/debug: trap all accesses to SPE controls at EL1
Date: Thu, 28 Feb 2019 16:07:33 +0000	[thread overview]
Message-ID: <20190228160737.3323-12-sudeep.holla@arm.com> (raw)
In-Reply-To: <20190228160737.3323-1-sudeep.holla@arm.com>

Now that we have all the save/restore mechanism in place, lets enable
trapping of accesses to SPE profiling buffer controls at EL1 to EL2.
This will also change the translation regime used by buffer from EL2
stage 1 to EL1 stage 1 on VHE systems.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/arm64/kvm/hyp/switch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
index 3054b8b8f037..8738e9438780 100644
--- a/arch/arm64/kvm/hyp/switch.c
+++ b/arch/arm64/kvm/hyp/switch.c
@@ -106,6 +106,7 @@ static void activate_traps_vhe(struct kvm_vcpu *vcpu)
 
 	write_sysreg(val, cpacr_el1);
 
+	write_sysreg(vcpu->arch.mdcr_el2 | 2 << MDCR_EL2_E2PB_SHIFT, mdcr_el2);
 	write_sysreg(kvm_get_hyp_vector(), vbar_el1);
 }
 NOKPROBE_SYMBOL(activate_traps_vhe);
@@ -123,6 +124,7 @@ static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu)
 		__activate_traps_fpsimd32(vcpu);
 	}
 
+	write_sysreg(vcpu->arch.mdcr_el2 | 2 << MDCR_EL2_E2PB_SHIFT, mdcr_el2);
 	write_sysreg(val, cptr_el2);
 }
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-02-28 16:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 16:07 [PATCH 00/13] arm64: KVM: add SPE profiling support for guest Sudeep Holla
2019-02-28 16:07 ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 01/13] KVM: arm64: add {read, write}_sysreg_elx_s versions for new registers Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 02/13] dt-bindings: ARM SPE: highlight the need for PPI partitions on heterogeneous systems Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 03/13] arm64: KVM: reset E2PB correctly in MDCR_EL2 when exiting the guest(VHE) Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 04/13] arm64: KVM: define SPE data structure for each vcpu Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 05/13] arm64: KVM: add access handler for SPE system registers Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 06/13] arm64: KVM/VHE: enable the use PMSCR_EL12 on VHE systems Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 07/13] arm64: KVM: split debug save restore across vm/traps activation Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 08/13] arm64: KVM/debug: drop pmscr_el1 and use sys_regs[PMSCR_EL1] in kvm_cpu_context Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 09/13] arm64: KVM: add support to save/restore SPE profiling buffer controls Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 10/13] arm64: KVM: enable conditional save/restore full " Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` Sudeep Holla [this message]
2019-02-28 16:07   ` [PATCH 11/13] arm64: KVM/debug: trap all accesses to SPE controls at EL1 Sudeep Holla
2019-02-28 16:07 ` [PATCH 12/13] KVM: arm64: add a new vcpu device control group for SPEv1 Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [PATCH 13/13] KVM: arm64: enable SPE support Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [KVMTOOL PATCH 14/15] kvm: update/sync the uapi headers from kernel(v5.0) Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla
2019-02-28 16:07 ` [KVMTOOL PATCH 15/15] kvm: add a vcpu feature for SPEv1 support Sudeep Holla
2019-02-28 16:07   ` Sudeep Holla

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=20190228160737.3323-12-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=will.deacon@arm.com \
    /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.