Hi Levi
Please run checkpatch on your submissions.
The subject is too long, I have changed that to :
coresight: etm4x: Prohibit TRCSEQSTR modifications while tracing enabled
On 03/10/2026 03:52, Yeoreum Yun wrote:
TRCSEQSTR can be changed by the ETM while a session is active. Its value therefore needs to be preserved when a sysfs session is disabled so that users can read the current sequence state after the session ends.
This means that any changes made to TRCSEQSTR while the sysfs-session is active
Please stick to 75 spaces. I have fixed this up.
Cheers Suzuki
would be lost when the session is disabled.
Copy the TRCSEQSTR value when disabling a sysfs session, and prohibit modifying seq_state while the session is active.
Suggested-by: Mike Leach mike.leach@arm.com Reviewed-by: Mike Leach mike.leach@arm.com Signed-off-by: Yeoreum Yun yeoreum.yun@arm.com
drivers/hwtracing/coresight/coresight-etm4x-core.c | 4 ++++ drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 ++ 2 files changed, 6 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 2247ad55d444..9ca03a5913a3 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1073,6 +1073,10 @@ static void etm4_disable_hw(struct etmv4_drvdata *drvdata) etm4x_relaxed_read32(csa, TRCCNTVRn(i)); }
- /* read back the sequence state */
- if (drvdata->nrseqstate)
config->seq_state = etm4x_relaxed_read32(csa, TRCSEQSTR);- coresight_disclaim_device_unlocked(csdev); etm4_cs_lock(drvdata, csa);
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index cc6cdd3ae29d..4945d577ceab 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -1435,6 +1435,8 @@ static ssize_t seq_state_store(struct device *dev, if (kstrtoul(buf, 16, &val)) return -EINVAL;
- if (IS_ERR_OR_NULL(drvdata->csdev) || coresight_get_mode(drvdata->csdev))
if (val >= drvdata->nrseqstate) return -EINVAL;return -EBUSY;