On Mon, May 19, 2025 at 04:12:32PM +0100, Suzuki Kuruppassery Poulose wrote:
[...]
--- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -2315,23 +2315,10 @@ static ssize_t ts_source_show(struct device *dev, int val; struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); - if (!drvdata->trfcr) { + val = FIELD_GET(TRFCR_EL1_TS_MASK, drvdata->trfcr); + if (!val)
I think this might be problematic. TS==0 is a reserved value for software, and doesn't imply a TS is not in effect.
Good point.
Thus I think we should retain the older check as before to ensure TRFCR is effective.
If we intend to return TS values directly (include '0' case), then it makes sense to make change like:
if (!drvdata->trfcr) val = -1; else val = FIELD_GET(TRFCR_EL1_TS_MASK, drvdata->trfcr);
return sysfs_emit(buf, "%d\n", val);
I checked again in Linux perf tool, it would be fine if we return 0 for TS==0 case, as the perf tool now only use virtual time counter (see cs_etm__has_virtual_ts()).
@James, could you confirm if this fine?
Thanks, Leo