[PATCH v12 02/14] coresight: etm4x: prohibit modifying cntr_val while session is enabled
Mike Leach
mike.leach at arm.com
Tue Sep 29 03:40:50 PDT 2026
Reviewed-by: Mike Leach <mike.leach at arm.com>
On 9/24/26 18:33, Yeoreum Yun wrote:
> cntr_val is overwritten with the values read from the corresponding
> registers by etm4_disable_hw() when the session is disabled.
>
> This means that any changes to these values made while the session is
> enabled would be lost when the session is disabled.
>
> Therefore, prohibit modifying cntr_val while the session is enabled.
>
> Tested-by: Leo Yan <leo.yan at arm.com>
> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
> ---
> drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> index db3cf4ad6806..a547de5a3f9c 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> @@ -1615,6 +1615,9 @@ static ssize_t cntr_val_store(struct device *dev,
> return -EINVAL;
> if (val > ETM_CNTR_MAX_VAL)
> return -EINVAL;
> + if (IS_ERR_OR_NULL(drvdata->csdev) ||
> + coresight_get_mode(drvdata->csdev))
> + return -EBUSY;
>
> raw_spin_lock(&drvdata->spinlock);
> idx = config->cntr_idx;
>
More information about the linux-arm-kernel
mailing list