[PATCH v4 07/13] coresight: Don't reject unrecognized ETMv3 format attributes

James Clark posted 13 patches 2 months, 4 weeks ago
There is a newer version of this series
[PATCH v4 07/13] coresight: Don't reject unrecognized ETMv3 format attributes
Posted by James Clark 2 months, 4 weeks ago
config isn't the only field, there are also config1, config2, etc.
Rejecting unrecognized attributes is therefore inconsistent as it wasn't
done for all fields. It was only necessary when we were directly
programming attr->config into ETMCR and didn't hide the unsupported
fields, but now it's not needed so remove it.

Signed-off-by: James Clark <james.clark@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm3x-core.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c
index 4511fc2f8d72..584d653eda81 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c
@@ -333,13 +333,6 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,
 	if (config->mode)
 		etm_config_trace_mode(config);
 
-	/*
-	 * At this time only cycle accurate, return stack  and timestamp
-	 * options are available.
-	 */
-	if (attr->config & ~ETM3X_SUPPORTED_OPTIONS)
-		return -EINVAL;
-
 	config->ctrl = 0;
 
 	if (ATTR_CFG_GET_FLD(attr, cycacc))

-- 
2.34.1
Re: [PATCH v4 07/13] coresight: Don't reject unrecognized ETMv3 format attributes
Posted by Leo Yan 2 months, 3 weeks ago
On Wed, Nov 12, 2025 at 03:22:13PM +0000, James Clark wrote:
> config isn't the only field, there are also config1, config2, etc.
> Rejecting unrecognized attributes is therefore inconsistent as it wasn't
> done for all fields. It was only necessary when we were directly
> programming attr->config into ETMCR and didn't hide the unsupported
> fields, but now it's not needed so remove it.

It is fine for not validating all configs (please ignore my comment for
checking all configs in my reply for patch 04).

I am wandering if need to remove ETM3X_SUPPORTED_OPTIONS totally. I
saw etm_enable_hw() uses it to clear config bits, so it makes sense to
keep it.

Reviewed-by: Leo Yan <leo.yan@arm.com>

> 
> Signed-off-by: James Clark <james.clark@linaro.org>
> ---
>  drivers/hwtracing/coresight/coresight-etm3x-core.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> index 4511fc2f8d72..584d653eda81 100644
> --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> @@ -333,13 +333,6 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,
>  	if (config->mode)
>  		etm_config_trace_mode(config);
>  
> -	/*
> -	 * At this time only cycle accurate, return stack  and timestamp
> -	 * options are available.
> -	 */
> -	if (attr->config & ~ETM3X_SUPPORTED_OPTIONS)
> -		return -EINVAL;
> -
>  	config->ctrl = 0;
>  
>  	if (ATTR_CFG_GET_FLD(attr, cycacc))
> 
> -- 
> 2.34.1
>
Re: [PATCH v4 07/13] coresight: Don't reject unrecognized ETMv3 format attributes
Posted by James Clark 2 months, 3 weeks ago

On 14/11/2025 3:18 pm, Leo Yan wrote:
> On Wed, Nov 12, 2025 at 03:22:13PM +0000, James Clark wrote:
>> config isn't the only field, there are also config1, config2, etc.
>> Rejecting unrecognized attributes is therefore inconsistent as it wasn't
>> done for all fields. It was only necessary when we were directly
>> programming attr->config into ETMCR and didn't hide the unsupported
>> fields, but now it's not needed so remove it.
> 
> It is fine for not validating all configs (please ignore my comment for
> checking all configs in my reply for patch 04).
> 
> I am wandering if need to remove ETM3X_SUPPORTED_OPTIONS totally. I
> saw etm_enable_hw() uses it to clear config bits, so it makes sense to
> keep it.
> 
> Reviewed-by: Leo Yan <leo.yan@arm.com>
> 

I tried to remove it, but as you saw it's used to clear the old config. 
It wasn't obvious to me if there was some other state in ETMCR that 
needed to be preserved, so only selected bits are cleared. I assumed 
there was a reason it wasn't just overwritten with config->ctrl to begin 
with as that would have been much simpler.

There wasn't a comment and I didn't want to spend much more time digging 
so I just left it. I think it's harmless to leave for now.

>>
>> Signed-off-by: James Clark <james.clark@linaro.org>
>> ---
>>   drivers/hwtracing/coresight/coresight-etm3x-core.c | 7 -------
>>   1 file changed, 7 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c
>> index 4511fc2f8d72..584d653eda81 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c
>> @@ -333,13 +333,6 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,
>>   	if (config->mode)
>>   		etm_config_trace_mode(config);
>>   
>> -	/*
>> -	 * At this time only cycle accurate, return stack  and timestamp
>> -	 * options are available.
>> -	 */
>> -	if (attr->config & ~ETM3X_SUPPORTED_OPTIONS)
>> -		return -EINVAL;
>> -
>>   	config->ctrl = 0;
>>   
>>   	if (ATTR_CFG_GET_FLD(attr, cycacc))
>>
>> -- 
>> 2.34.1
>>