Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / hwtracing / coresight / coresight-self-hosted-trace.h
blob53840a2c41f2c7051e7d4acabd895f6934275ce7
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Arm v8 Self-Hosted trace support.
5 * Copyright (C) 2021 ARM Ltd.
6 */
8 #ifndef __CORESIGHT_SELF_HOSTED_TRACE_H
9 #define __CORESIGHT_SELF_HOSTED_TRACE_H
11 #include <asm/sysreg.h>
13 static inline u64 read_trfcr(void)
15 return read_sysreg_s(SYS_TRFCR_EL1);
18 static inline void write_trfcr(u64 val)
20 write_sysreg_s(val, SYS_TRFCR_EL1);
21 isb();
24 static inline u64 cpu_prohibit_trace(void)
26 u64 trfcr = read_trfcr();
28 /* Prohibit tracing at EL0 & the kernel EL */
29 write_trfcr(trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE));
30 /* Return the original value of the TRFCR */
31 return trfcr;
33 #endif /* __CORESIGHT_SELF_HOSTED_TRACE_H */