Commit 11e4ae52 authored by Junhao He's avatar Junhao He Committed by Ma Wupeng
Browse files

drivers/ETM: fix error in invalid cs_id

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5YCYK



--------------------------------------------------------------------------

trace id is invalid(trace_id = 0 or trace_id > 0x6F). In this situation,
we cannot parse trace data using perf tool. so make trace_id in the
range of 1 to 0x6F in coresight_get_trace_id().

Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
parent 72f7a9f3
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -8,7 +8,8 @@
#define _LINUX_CORESIGHT_PMU_H

#define CORESIGHT_ETM_PMU_NAME "cs_etm"
#define CORESIGHT_ETM_PMU_SEED  0x10
#define CORESIGHT_ETM_PMU_SEED  0x1
#define CORESIGHT_ETM_CSID_MAX  0x70

/* ETMv3.5/PTM's ETMCR config bit */
#define ETM_OPT_CYCACC  12
@@ -30,7 +31,7 @@ static inline int coresight_get_trace_id(int cpu)
	 * the common convention is to have data trace IDs be I(N) + 1,
	 * set instruction trace IDs as a function of the CPU number.
	 */
	return (CORESIGHT_ETM_PMU_SEED + (cpu * 2));
	return (CORESIGHT_ETM_PMU_SEED + (cpu * 2)) % CORESIGHT_ETM_CSID_MAX;
}

#endif
+3 −2
Original line number Diff line number Diff line
@@ -8,7 +8,8 @@
#define _LINUX_CORESIGHT_PMU_H

#define CORESIGHT_ETM_PMU_NAME "cs_etm"
#define CORESIGHT_ETM_PMU_SEED  0x10
#define CORESIGHT_ETM_PMU_SEED  0x1
#define CORESIGHT_ETM_CSID_MAX  0x70

/* ETMv3.5/PTM's ETMCR config bit */
#define ETM_OPT_CYCACC  12
@@ -30,7 +31,7 @@ static inline int coresight_get_trace_id(int cpu)
	 * the common convention is to have data trace IDs be I(N) + 1,
	 * set instruction trace IDs as a function of the CPU number.
	 */
	return (CORESIGHT_ETM_PMU_SEED + (cpu * 2));
	return (CORESIGHT_ETM_PMU_SEED + (cpu * 2)) % CORESIGHT_ETM_CSID_MAX;
}

#endif