From: Sudeep Holla Subject: [PATCH 11/13] arm64: KVM/debug: trap all accesses to SPE controls at EL1 Date: Thu, 28 Feb 2019 16:07:33 +0000 Message-ID: <20190228160737.3323-12-sudeep.holla@arm.com> References: <20190228160737.3323-1-sudeep.holla@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4D3474A48C for ; Thu, 28 Feb 2019 11:08:20 -0500 (EST) Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZZk7RD+Ym6jM for ; Thu, 28 Feb 2019 11:08:19 -0500 (EST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 00DCC4A429 for ; Thu, 28 Feb 2019 11:08:19 -0500 (EST) In-Reply-To: <20190228160737.3323-1-sudeep.holla@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Marc Zyngier , Catalin Marinas , Will Deacon , Sudeep Holla List-Id: kvmarm@lists.cs.columbia.edu 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 --- 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