aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-01-01 11:01:41 +0100
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2019-01-08 15:24:16 +0100
commitc024ea6cd2b18487629dfc38707615bedd42901c (patch)
treea6d8eaf15779210bdba62d45a778e8715cc58246 /services
parent0560efb93eeba9cf16dc837893a07430e638dcc5 (diff)
downloadtrusted-firmware-a-c024ea6cd2b18487629dfc38707615bedd42901c.tar.gz
services/spm_deprecated: permit timer sysreg access at S-EL0
Expose the timer registers that are accessible at EL0 per the architecture to the SPM payload running in secure EL0. Note that this requires NS_TIMER_SWITCH to be enable for all users of this code. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'services')
-rw-r--r--services/std_svc/spm_deprecated/spm.mk3
-rw-r--r--services/std_svc/spm_deprecated/spm_setup.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/services/std_svc/spm_deprecated/spm.mk b/services/std_svc/spm_deprecated/spm.mk
index ed36812f9b..35030206ba 100644
--- a/services/std_svc/spm_deprecated/spm.mk
+++ b/services/std_svc/spm_deprecated/spm.mk
@@ -21,3 +21,6 @@ SPM_SOURCES := $(addprefix services/std_svc/spm_deprecated/, \
# Let the top-level Makefile know that we intend to include a BL32 image
NEED_BL32 := yes
+
+# required so that SPM code executing at S-EL0 can access the timer registers
+NS_TIMER_SWITCH := 1
diff --git a/services/std_svc/spm_deprecated/spm_setup.c b/services/std_svc/spm_deprecated/spm_setup.c
index e78a42c72e..beaff946c3 100644
--- a/services/std_svc/spm_deprecated/spm_setup.c
+++ b/services/std_svc/spm_deprecated/spm_setup.c
@@ -168,6 +168,9 @@ void spm_sp_setup(sp_context_t *sp_ctx)
write_ctx_reg(get_sysregs_ctx(ctx), CTX_VBAR_EL1,
SPM_SHIM_EXCEPTIONS_PTR);
+ write_ctx_reg(get_sysregs_ctx(ctx), CTX_CNTKCTL_EL1,
+ EL0PTEN_BIT | EL0VTEN_BIT | EL0PCTEN_BIT | EL0VCTEN_BIT);
+
/*
* FPEN: Allow the Secure Partition to access FP/SIMD registers.
* Note that SPM will not do any saving/restoring of these registers on