Re: [PATCH v11 2/9] coresight: etm3x: prohibit modifying cntr_val and reset while session is enabled
From: Mike Leach
Date: Fri Sep 18 2026 - 07:18:13 EST
Reviewed-by: Mike Leach <mike.leach@xxxxxxx>
On 9/15/26 12:34, Yeoreum Yun wrote:
cntr_val are overwritten with the values read from the corresponding
registers by etm_disable_hw() when the session is disabled.
This means that any changes to this value made while the session is
enabled would be lost when the session is disabled.
Also, reset shouldn't be called while session is enabled.
Therefore, prohibit modifying cntr_val and reset while the session is enabled.
Signed-off-by: Yeoreum Yun <yeoreum.yun@xxxxxxx>
---
drivers/hwtracing/coresight/coresight-etm3x-sysfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
index b3c67e96a82a4..d4846d6364945 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
@@ -74,6 +74,8 @@ static ssize_t reset_store(struct device *dev,
ret = kstrtoul(buf, 16, &val);
if (ret)
return ret;
+ if (coresight_get_mode(drvdata->csdev))
+ return -EBUSY;
if (val) {
spin_lock(&drvdata->spinlock);
@@ -744,6 +746,8 @@ static ssize_t cntr_val_store(struct device *dev,
ret = kstrtoul(buf, 16, &val);
if (ret)
return ret;
+ if (coresight_get_mode(drvdata->csdev))
+ return -EBUSY;
spin_lock(&drvdata->spinlock);
config->cntr_val[config->cntr_idx] = val;