mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-21 20:14:29 +00:00
feat(trbe): introduce trbe_disable() function
This patch adds trbe_disable() which disables Trace buffer access from lower ELs in all security state. This function makes Secure state the owner of Trace buffer and access from EL2/EL1 generate trap exceptions to EL3. Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com> Change-Id: If3e3bd621684b3c28f44c3ed2fe3df30b143f8cd
This commit is contained in:
parent
651fe5073c
commit
b36e975ea3
2 changed files with 23 additions and 0 deletions
|
@ -10,9 +10,13 @@
|
|||
#include <context.h>
|
||||
|
||||
#if ENABLE_TRBE_FOR_NS
|
||||
void trbe_disable(cpu_context_t *ctx);
|
||||
void trbe_enable(cpu_context_t *ctx);
|
||||
void trbe_init_el2_unused(void);
|
||||
#else
|
||||
static inline void trbe_disable(cpu_context_t *ctx)
|
||||
{
|
||||
}
|
||||
static inline void trbe_enable(cpu_context_t *ctx)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -39,6 +39,25 @@ void trbe_enable(cpu_context_t *ctx)
|
|||
write_ctx_reg(state, CTX_MDCR_EL3, mdcr_el3_val);
|
||||
}
|
||||
|
||||
void trbe_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.NSTBE = 0b0
|
||||
* Trace Buffer owning Security state is secure state. If FEAT_RME
|
||||
* is not implemented, this field is RES0.
|
||||
*
|
||||
* MDCR_EL3.NSTB = 0b00
|
||||
* Clear these bits to disable access of trace buffer control registers
|
||||
* from lower ELs in any security state.
|
||||
*/
|
||||
mdcr_el3_val &= ~(MDCR_NSTB(MDCR_NSTB_EL1));
|
||||
mdcr_el3_val &= ~(MDCR_NSTBE_BIT);
|
||||
write_ctx_reg(state, CTX_MDCR_EL3, mdcr_el3_val);
|
||||
}
|
||||
|
||||
void trbe_init_el2_unused(void)
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue