mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00
feat(spe): introduce spe_disable() function
Introduce a function to disable SPE feature for Non-secure state and do the default setting of making Secure state the owner of profiling buffers and trap access of profiling and profiling buffer control registers from lower ELs to EL3. This functionality is required to handle asymmetric cores where SPE has to disabled at runtime. Signed-off-by: Manish Pandey <manish.pandey2@arm.com> Change-Id: I2f99e922e8df06bfc900c153137aef7c9dcfd759
This commit is contained in:
parent
4de07b4be7
commit
651fe5073c
2 changed files with 25 additions and 0 deletions
|
@ -12,12 +12,16 @@
|
|||
|
||||
#if ENABLE_SPE_FOR_NS
|
||||
void spe_enable(cpu_context_t *ctx);
|
||||
void spe_disable(cpu_context_t *ctx);
|
||||
void spe_init_el2_unused(void);
|
||||
void spe_stop(void);
|
||||
#else
|
||||
static inline void spe_enable(cpu_context_t *ctx)
|
||||
{
|
||||
}
|
||||
static inline void spe_disable(cpu_context_t *ctx)
|
||||
{
|
||||
}
|
||||
static inline void spe_init_el2_unused(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -52,6 +52,27 @@ void spe_enable(cpu_context_t *ctx)
|
|||
write_ctx_reg(state, CTX_MDCR_EL3, mdcr_el3_val);
|
||||
}
|
||||
|
||||
void spe_disable(cpu_context_t *ctx)
|
||||
{
|
||||
el3_state_t *state = get_el3state_ctx(ctx);
|
||||
u_register_t mdcr_el3_val = read_ctx_reg(state, CTX_MDCR_EL3);
|
||||
|
||||
/*
|
||||
* MDCR_EL3.NSPB: Clear these bits to disable SPE feature, as it was enabled
|
||||
* for Non-secure state only. After clearing these bits Secure state owns
|
||||
* the Profiling Buffer and accesses to Statistical Profiling and Profiling
|
||||
* Buffer control registers at EL2 and EL1 generate Trap exceptions to EL3
|
||||
*
|
||||
* MDCR_EL3.NSPBE: Don't care as it was cleared during spe_enable and setting
|
||||
* this to 1 does not make sense as NSPBE{1} and NSPB{0b0x} is RESERVED.
|
||||
*
|
||||
* MDCR_EL3.EnPMSN (ARM v8.7): Clear the bit to trap access of PMSNEVFR_EL1
|
||||
* from EL2/EL1 to EL3.
|
||||
*/
|
||||
mdcr_el3_val &= ~(MDCR_NSPB(MDCR_NSPB_EL1) | MDCR_EnPMSN_BIT);
|
||||
write_ctx_reg(state, CTX_MDCR_EL3, mdcr_el3_val);
|
||||
}
|
||||
|
||||
void spe_init_el2_unused(void)
|
||||
{
|
||||
uint64_t v;
|
||||
|
|
Loading…
Add table
Reference in a new issue