Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Arm v8 Self-Hosted trace support.
0004  *
0005  * Copyright (C) 2021 ARM Ltd.
0006  */
0007 
0008 #ifndef __CORESIGHT_SELF_HOSTED_TRACE_H
0009 #define __CORESIGHT_SELF_HOSTED_TRACE_H
0010 
0011 #include <asm/sysreg.h>
0012 
0013 static inline u64 read_trfcr(void)
0014 {
0015     return read_sysreg_s(SYS_TRFCR_EL1);
0016 }
0017 
0018 static inline void write_trfcr(u64 val)
0019 {
0020     write_sysreg_s(val, SYS_TRFCR_EL1);
0021     isb();
0022 }
0023 
0024 static inline u64 cpu_prohibit_trace(void)
0025 {
0026     u64 trfcr = read_trfcr();
0027 
0028     /* Prohibit tracing at EL0 & the kernel EL */
0029     write_trfcr(trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE));
0030     /* Return the original value of the TRFCR */
0031     return trfcr;
0032 }
0033 #endif /*  __CORESIGHT_SELF_HOSTED_TRACE_H */