Skip to content

Commit 53abf3f

Browse files
Leo Yangregkh
authored andcommitted
coresight: etm-perf: Clarify comment on perf options
In theory, the options should be arbitrary values and are neutral for any ETM version; so far perf tool uses ETMv3.5/PTM ETMCR config bits except for register's bit definitions, also uses as options. This can introduce confusion, especially if we want to add a new option but the new option is not supported by ETMv3.5/PTM ETMCR. But on the other hand, we cannot change options since these options are generic CoreSight PMU ABI. For easier maintenance and avoid confusion, this patch refines the comment to clarify perf options, and gives out the background info for these bits are coming from ETMv3.5/PTM. Afterwards, we should take these options as general knobs, and if there have any confliction with ETMv3.5/PTM, should consider to define saperate macros for ETMv3.5/PTM ETMCR config bits. Suggested-by: Suzuki K Poulose <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Signed-off-by: Leo Yan <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 48139ba commit 53abf3f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

drivers/hwtracing/coresight/coresight-etm-perf.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ static bool etm_perf_up;
2727
static DEFINE_PER_CPU(struct perf_output_handle, ctx_handle);
2828
static DEFINE_PER_CPU(struct coresight_device *, csdev_src);
2929

30-
/* ETMv3.5/PTM's ETMCR is 'config' */
30+
/*
31+
* The PMU formats were orignally for ETMv3.5/PTM's ETMCR 'config';
32+
* now take them as general formats and apply on all ETMs.
33+
*/
3134
PMU_FORMAT_ATTR(cycacc, "config:" __stringify(ETM_OPT_CYCACC));
3235
PMU_FORMAT_ATTR(contextid, "config:" __stringify(ETM_OPT_CTXTID));
3336
PMU_FORMAT_ATTR(timestamp, "config:" __stringify(ETM_OPT_TS));

include/linux/coresight-pmu.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@
1010
#define CORESIGHT_ETM_PMU_NAME "cs_etm"
1111
#define CORESIGHT_ETM_PMU_SEED 0x10
1212

13-
/* ETMv3.5/PTM's ETMCR config bit */
14-
#define ETM_OPT_CYCACC 12
15-
#define ETM_OPT_CTXTID 14
16-
#define ETM_OPT_TS 28
17-
#define ETM_OPT_RETSTK 29
13+
/*
14+
* Below are the definition of bit offsets for perf option, and works as
15+
* arbitrary values for all ETM versions.
16+
*
17+
* Most of them are orignally from ETMv3.5/PTM's ETMCR config, therefore,
18+
* ETMv3.5/PTM doesn't define ETMCR config bits with prefix "ETM3_" and
19+
* directly use below macros as config bits.
20+
*/
21+
#define ETM_OPT_CYCACC 12
22+
#define ETM_OPT_CTXTID 14
23+
#define ETM_OPT_TS 28
24+
#define ETM_OPT_RETSTK 29
1825

1926
/* ETMv4 CONFIGR programming bits for the ETM OPTs */
2027
#define ETM4_CFG_BIT_CYCACC 4

0 commit comments

Comments
 (0)