[PATCH RESEND v13 03/14] coresight: etm3x: prohibit modifying cntr_val and reset while session is enabled

Suzuki K Poulose suzuki.poulose at arm.com
Fri Oct 2 23:10:01 PDT 2026


On 03/10/2026 03:52, 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.
> 

Same as the other one, fixed subject and the above line

Cheers
Suzuki

> Reviewed-by: Mike Leach <mike.leach at arm.com>
> Tested-by: Leo Yan <leo.yan at arm.com>
> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
> ---
>   drivers/hwtracing/coresight/coresight-etm3x-sysfs.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
> index b3c67e96a82a..cdb70a4382eb 100644
> --- a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
> @@ -75,6 +75,10 @@ static ssize_t reset_store(struct device *dev,
>   	if (ret)
>   		return ret;
>   
> +	if (IS_ERR_OR_NULL(drvdata->csdev) ||
> +	    coresight_get_mode(drvdata->csdev))
> +		return -EBUSY;
> +
>   	if (val) {
>   		spin_lock(&drvdata->spinlock);
>   		memset(config, 0, sizeof(struct etm_config));
> @@ -744,6 +748,9 @@ static ssize_t cntr_val_store(struct device *dev,
>   	ret = kstrtoul(buf, 16, &val);
>   	if (ret)
>   		return ret;
> +	if (IS_ERR_OR_NULL(drvdata->csdev) ||
> +	    coresight_get_mode(drvdata->csdev))
> +		return -EBUSY;
>   
>   	spin_lock(&drvdata->spinlock);
>   	config->cntr_val[config->cntr_idx] = val;
> 




More information about the linux-arm-kernel mailing list