From 14c0526b737592776360fec99b452e740879d532 Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Fri, 29 Aug 2014 14:41:58 +0100 Subject: [PATCH] Reset CNTVOFF_EL2 register before exit into EL1 on warm boot This patch resets the value of CNTVOFF_EL2 before exit to EL1 on warm boot. This needs to be done if only the Trusted Firmware exits to EL1 instead of EL2, otherwise the hypervisor would be responsible for this. Fixes ARM-software/tf-issues#240 Change-Id: I79d54831356cf3215bcf1f251c373bd8f89db0e0 --- bl31/context_mgmt.c | 3 +++ include/lib/aarch64/arch_helpers.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/bl31/context_mgmt.c b/bl31/context_mgmt.c index 489d45444..698fb6fa3 100644 --- a/bl31/context_mgmt.c +++ b/bl31/context_mgmt.c @@ -247,6 +247,9 @@ void cm_prepare_el3_exit(uint32_t security_state) /* Enable EL1 access to timer */ write_cnthctl_el2(EL1PCEN_BIT | EL1PCTEN_BIT); + /* Reset CNTVOFF_EL2 */ + write_cntvoff_el2(0); + /* Set VPIDR, VMPIDR to match MIDR, MPIDR */ write_vpidr_el2(read_midr_el1()); write_vmpidr_el2(read_mpidr_el1()); diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h index 09365fb9e..d431baaf8 100644 --- a/include/lib/aarch64/arch_helpers.h +++ b/include/lib/aarch64/arch_helpers.h @@ -262,6 +262,8 @@ DEFINE_SYSREG_RW_FUNCS(cnthctl_el2) DEFINE_SYSREG_RW_FUNCS(tpidr_el3) +DEFINE_SYSREG_RW_FUNCS(cntvoff_el2) + DEFINE_SYSREG_RW_FUNCS(vpidr_el2) DEFINE_SYSREG_RW_FUNCS(vmpidr_el2)