[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250530-showtraceid-v1-1-2761352cf7b4@quicinc.com>
Date: Fri, 30 May 2025 15:29:14 +0800
From: Yuanfang Zhang <quic_yuanfang@...cinc.com>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach
<mike.leach@...aro.org>,
James Clark <james.clark@...aro.org>,
"Alexander
Shishkin" <alexander.shishkin@...ux.intel.com>
CC: <kernel@....qualcomm.com>, <coresight@...ts.linaro.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
Yuanfang Zhang <quic_yuanfang@...cinc.com>
Subject: [PATCH] coresight-tpdm: add trace_id sysfs node
The trace ID of TPMD is the trace ID of the TPDA or TNOC
which it is connected to, this change adds trace_id sysfs
node to expose this trace id to userspace.
Signed-off-by: Yuanfang Zhang <quic_yuanfang@...cinc.com>
---
drivers/hwtracing/coresight/coresight-tpdm.c | 16 ++++++++++++++++
drivers/hwtracing/coresight/coresight-tpdm.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
index 7214e65097ec9ac69f6c7c9278bcd28d25945c9e..8a5d115157924f39b09f8e3005827d7d64aa376c 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.c
+++ b/drivers/hwtracing/coresight/coresight-tpdm.c
@@ -497,6 +497,9 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event,
__tpdm_enable(drvdata);
drvdata->enable = true;
+
+ if (path)
+ drvdata->traceid = path->trace_id;
spin_unlock(&drvdata->spinlock);
dev_dbg(drvdata->dev, "TPDM tracing enabled\n");
@@ -554,6 +557,7 @@ static void tpdm_disable(struct coresight_device *csdev,
__tpdm_disable(drvdata);
coresight_set_mode(csdev, CS_MODE_DISABLED);
drvdata->enable = false;
+ drvdata->traceid = 0;
spin_unlock(&drvdata->spinlock);
dev_dbg(drvdata->dev, "TPDM tracing disabled\n");
@@ -655,9 +659,21 @@ static ssize_t integration_test_store(struct device *dev,
}
static DEVICE_ATTR_WO(integration_test);
+static ssize_t traceid_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ unsigned long val;
+ struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
+
+ val = drvdata->traceid;
+ return sprintf(buf, "%#lx\n", val);
+}
+static DEVICE_ATTR_RO(traceid);
+
static struct attribute *tpdm_attrs[] = {
&dev_attr_reset_dataset.attr,
&dev_attr_integration_test.attr,
+ &dev_attr_traceid.attr,
NULL,
};
diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtracing/coresight/coresight-tpdm.h
index b117543897344b689f666f6890cabb59c8ee4869..e12a64f265daa86f1b82fa3640e271e8386f99af 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.h
+++ b/drivers/hwtracing/coresight/coresight-tpdm.h
@@ -300,6 +300,7 @@ struct cmb_dataset {
* @cmb Specifics associated to TPDM CMB.
* @dsb_msr_num Number of MSR supported by DSB TPDM
* @cmb_msr_num Number of MSR supported by CMB TPDM
+ * @traceid: Value of the current ID for this component.
*/
struct tpdm_drvdata {
@@ -313,6 +314,7 @@ struct tpdm_drvdata {
struct cmb_dataset *cmb;
u32 dsb_msr_num;
u32 cmb_msr_num;
+ u8 traceid;
};
/* Enumerate members of various datasets */
---
base-commit: 94305e83eccb3120c921cd3a015cd74731140bac
change-id: 20250523-showtraceid-2df91c89be8f
Best regards,
--
Yuanfang Zhang <quic_yuanfang@...cinc.com>
Powered by blists - more mailing lists