summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2021-09-14 13:26:33 +0300
committerMathieu Poirier <mathieu.poirier@linaro.org>2021-10-27 20:45:18 +0300
commit5f6fd1aa8cc147b111af1a833574487a87237dc0 (patch)
tree889a551d95708ffd5b3350b6c5083e58efe965d5 /drivers/hwtracing/coresight/coresight-self-hosted-trace.h
parent937d3f58cacf377cab7c32e475e1ffa91d611dce (diff)
downloadlinux-5f6fd1aa8cc147b111af1a833574487a87237dc0.tar.xz
coresight: etm4x: Use Trace Filtering controls dynamically
The Trace Filtering support (FEAT_TRF) ensures that the ETM can be prohibited from generating any trace for a given EL. This is much stricter knob, than the TRCVICTLR exception level masks, which doesn't prevent the ETM from generating Context packets for an "excluded" EL. At the moment, we do a onetime enable trace at user and kernel and leave it untouched for the kernel life time. This implies that the ETM could potentially generate trace packets containing the kernel addresses, and thus leaking the kernel virtual address in the trace. This patch makes the switch dynamic, by honoring the filters set by the user and enforcing them in the TRFCR controls. We also rename the cpu_enable_tracing() appropriately to cpu_detect_trace_filtering() and the drvdata member trfc => trfcr to indicate the "value" of the TRFCR_EL1. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Al Grant <al.grant@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Leo Yan <leo.yan@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Link: https://lore.kernel.org/r/20210914102641.1852544-3-suzuki.poulose@arm.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-self-hosted-trace.h')
-rw-r--r--drivers/hwtracing/coresight/coresight-self-hosted-trace.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hwtracing/coresight/coresight-self-hosted-trace.h b/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
index 303d71911870..23f05df3f173 100644
--- a/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
+++ b/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
@@ -21,4 +21,11 @@ static inline void write_trfcr(u64 val)
isb();
}
+static inline void cpu_prohibit_trace(void)
+{
+ u64 trfcr = read_trfcr();
+
+ /* Prohibit tracing at EL0 & the kernel EL */
+ write_trfcr(trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE));
+}
#endif /* __CORESIGHT_SELF_HOSTED_TRACE_H */