Browse Source
Introduced a build flag 'ENABLE_TRF_FOR_NS' to enable trace filter control registers access in NS-EL2, or NS-EL1 (when NS-EL2 is implemented but unused). Change-Id: If3f53b8173a5573424b9a405a4bd8c206ffdeb8c Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>pull/1981/head
Manish V Badarkhe
3 years ago
11 changed files with 113 additions and 0 deletions
@ -0,0 +1,12 @@ |
|||||
|
/*
|
||||
|
* Copyright (c) 2021, Arm Limited. All rights reserved. |
||||
|
* |
||||
|
* SPDX-License-Identifier: BSD-3-Clause |
||||
|
*/ |
||||
|
|
||||
|
#ifndef TRF_H |
||||
|
#define TRF_H |
||||
|
|
||||
|
void trf_enable(void); |
||||
|
|
||||
|
#endif /* TRF_H */ |
@ -0,0 +1,35 @@ |
|||||
|
/*
|
||||
|
* Copyright (c) 2021, Arm Limited. All rights reserved. |
||||
|
* |
||||
|
* SPDX-License-Identifier: BSD-3-Clause |
||||
|
*/ |
||||
|
|
||||
|
#include <stdbool.h> |
||||
|
|
||||
|
#include <arch.h> |
||||
|
#include <arch_helpers.h> |
||||
|
#include <lib/extensions/trf.h> |
||||
|
|
||||
|
static bool trf_supported(void) |
||||
|
{ |
||||
|
uint32_t features; |
||||
|
|
||||
|
features = read_id_dfr0() >> ID_DFR0_TRACEFILT_SHIFT; |
||||
|
return ((features & ID_DFR0_TRACEFILT_MASK) == |
||||
|
ID_DFR0_TRACEFILT_SUPPORTED); |
||||
|
} |
||||
|
|
||||
|
void trf_enable(void) |
||||
|
{ |
||||
|
uint32_t val; |
||||
|
|
||||
|
if (trf_supported()) { |
||||
|
/*
|
||||
|
* Allow access of trace filter control registers from |
||||
|
* non-monitor mode |
||||
|
*/ |
||||
|
val = read_sdcr(); |
||||
|
val &= ~SDCR_TTRF_BIT; |
||||
|
write_sdcr(val); |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
/*
|
||||
|
* Copyright (c) 2021, Arm Limited. All rights reserved. |
||||
|
* |
||||
|
* SPDX-License-Identifier: BSD-3-Clause |
||||
|
*/ |
||||
|
|
||||
|
#include <stdbool.h> |
||||
|
|
||||
|
#include <arch.h> |
||||
|
#include <arch_helpers.h> |
||||
|
#include <lib/extensions/trf.h> |
||||
|
|
||||
|
static bool trf_supported(void) |
||||
|
{ |
||||
|
uint64_t features; |
||||
|
|
||||
|
features = read_id_aa64dfr0_el1() >> ID_AA64DFR0_TRACEFILT_SHIFT; |
||||
|
return ((features & ID_AA64DFR0_TRACEFILT_MASK) == |
||||
|
ID_AA64DFR0_TRACEFILT_SUPPORTED); |
||||
|
} |
||||
|
|
||||
|
void trf_enable(void) |
||||
|
{ |
||||
|
uint64_t val; |
||||
|
|
||||
|
if (trf_supported()) { |
||||
|
/*
|
||||
|
* MDCR_EL3.TTRF = b0 |
||||
|
* Allow access of trace filter control registers from NS-EL2 |
||||
|
* and NS-EL1 when NS-EL2 is implemented but not used |
||||
|
*/ |
||||
|
val = read_mdcr_el3(); |
||||
|
val &= ~MDCR_TTRF_BIT; |
||||
|
write_mdcr_el3(val); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue