Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

coresight: Hide unused ETMv3 format attributes

ETMv3 only has a few attributes, and setting unused ones results in an
error, so hide them to begin with.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Tested-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20251128-james-cs-syncfreq-v8-4-4d319764cc58@linaro.org

authored by

James Clark and committed by
Suzuki K Poulose
20bc2ea2 b02450de

+20 -17
+20 -17
drivers/hwtracing/coresight/coresight-etm-perf.c
··· 50 50 static DEFINE_PER_CPU(struct etm_ctxt, etm_ctxt); 51 51 static DEFINE_PER_CPU(struct coresight_device *, csdev_src); 52 52 53 - /* 54 - * The PMU formats were orignally for ETMv3.5/PTM's ETMCR 'config'; 55 - * now take them as general formats and apply on all ETMs. 56 - */ 57 - PMU_FORMAT_ATTR(branch_broadcast, "config:"__stringify(ETM_OPT_BRANCH_BROADCAST)); 58 53 PMU_FORMAT_ATTR(cycacc, "config:" __stringify(ETM_OPT_CYCACC)); 59 - /* contextid1 enables tracing CONTEXTIDR_EL1 for ETMv4 */ 60 - PMU_FORMAT_ATTR(contextid1, "config:" __stringify(ETM_OPT_CTXTID)); 61 - /* contextid2 enables tracing CONTEXTIDR_EL2 for ETMv4 */ 62 - PMU_FORMAT_ATTR(contextid2, "config:" __stringify(ETM_OPT_CTXTID2)); 63 54 PMU_FORMAT_ATTR(timestamp, "config:" __stringify(ETM_OPT_TS)); 64 55 PMU_FORMAT_ATTR(retstack, "config:" __stringify(ETM_OPT_RETSTK)); 56 + PMU_FORMAT_ATTR(sinkid, "config2:0-31"); 57 + 58 + #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) 59 + PMU_FORMAT_ATTR(branch_broadcast, "config:"__stringify(ETM_OPT_BRANCH_BROADCAST)); 60 + /* contextid1 enables tracing CONTEXTIDR_EL1*/ 61 + PMU_FORMAT_ATTR(contextid1, "config:" __stringify(ETM_OPT_CTXTID)); 62 + /* contextid2 enables tracing CONTEXTIDR_EL2*/ 63 + PMU_FORMAT_ATTR(contextid2, "config:" __stringify(ETM_OPT_CTXTID2)); 65 64 /* preset - if sink ID is used as a configuration selector */ 66 65 PMU_FORMAT_ATTR(preset, "config:0-3"); 67 - /* Sink ID - same for all ETMs */ 68 - PMU_FORMAT_ATTR(sinkid, "config2:0-31"); 69 66 /* config ID - set if a system configuration is selected */ 70 67 PMU_FORMAT_ATTR(configid, "config2:32-63"); 71 68 PMU_FORMAT_ATTR(cc_threshold, "config3:0-11"); 72 - 73 69 74 70 /* 75 71 * contextid always traces the "PID". The PID is in CONTEXTIDR_EL1 ··· 78 82 { 79 83 int pid_fmt = ETM_OPT_CTXTID; 80 84 81 - #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) 82 85 pid_fmt = is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID; 83 - #endif 84 86 return sprintf(page, "config:%d\n", pid_fmt); 85 87 } 86 88 87 89 static struct device_attribute format_attr_contextid = 88 90 __ATTR(contextid, 0444, format_attr_contextid_show, NULL); 91 + #endif 89 92 93 + /* 94 + * ETMv3 only uses the first 3 attributes for programming itself (see 95 + * ETM3X_SUPPORTED_OPTIONS). Sink ID is also supported for selecting a 96 + * sink in both, but not used for configuring the ETM. The remaining 97 + * attributes are ETMv4 specific. 98 + */ 90 99 static struct attribute *etm_config_formats_attr[] = { 91 100 &format_attr_cycacc.attr, 92 - &format_attr_contextid.attr, 93 - &format_attr_contextid1.attr, 94 - &format_attr_contextid2.attr, 95 101 &format_attr_timestamp.attr, 96 102 &format_attr_retstack.attr, 97 103 &format_attr_sinkid.attr, 104 + #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) 105 + &format_attr_contextid.attr, 106 + &format_attr_contextid1.attr, 107 + &format_attr_contextid2.attr, 98 108 &format_attr_preset.attr, 99 109 &format_attr_configid.attr, 100 110 &format_attr_branch_broadcast.attr, 101 111 &format_attr_cc_threshold.attr, 112 + #endif 102 113 NULL, 103 114 }; 104 115