diff mbox series

[v2,3/3] coresight-tpda: Optimize the function of reading element size

Message ID 20240711081750.21792-4-quic_taozha@quicinc.com (mailing list archive)
State New, archived
Headers show
Series Add source filtering for multi-port output | expand

Commit Message

Tao Zhang July 11, 2024, 8:17 a.m. UTC
Since the new funnel device supports multi-port output scenarios,
there may be more than one TPDM connected to one TPDA. In this
way, when reading the element size of the TPDM, TPDA driver needs
to find the expected TPDM corresponding to the filter source.
When TPDA finds a TPDM or a filter source from a input connection,
it will read the Devicetree to get the expected TPDM's element
size.

Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
---
 drivers/hwtracing/coresight/coresight-tpda.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Suzuki K Poulose July 11, 2024, 1:25 p.m. UTC | #1
On 11/07/2024 09:17, Tao Zhang wrote:
> Since the new funnel device supports multi-port output scenarios,
> there may be more than one TPDM connected to one TPDA. In this
> way, when reading the element size of the TPDM, TPDA driver needs
> to find the expected TPDM corresponding to the filter source.
> When TPDA finds a TPDM or a filter source from a input connection,
> it will read the Devicetree to get the expected TPDM's element
> size.
> 
> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
> ---
>   drivers/hwtracing/coresight/coresight-tpda.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
> index bfca103f9f84..4936ba4a7625 100644
> --- a/drivers/hwtracing/coresight/coresight-tpda.c
> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
> @@ -110,6 +110,8 @@ static int tpda_get_element_size(struct tpda_drvdata *drvdata,
>   		    csdev->pdata->in_conns[i]->dest_port != inport)
>   			continue;
>   
> +		if (csdev->pdata->in_conns[i]->filter_src_dev)
> +			in = csdev->pdata->in_conns[i]->filter_src_dev;

Actually, this may not be complete, if the device was removed. Also add
a comment here.

		/*
		 * If this port has a hardcoded filter, use the source
		 * device directly.
		 */
		if (csdev->pdata->in_conns[i]->filter_src_fwnode) {
			in = csdev->pdata->in_conns[i]->filter_src_dev;
			if (!in)
				continue;
		}


Suzuki

>   		if (coresight_device_is_tpdm(in)) {
>   			if (drvdata->dsb_esize || drvdata->cmb_esize)
>   				return -EEXIST;
> @@ -124,7 +126,6 @@ static int tpda_get_element_size(struct tpda_drvdata *drvdata,
>   		}
>   	}
>   
> -

>   	return rc;
>   }
>
Tao Zhang July 18, 2024, 2:24 a.m. UTC | #2
On 7/11/2024 9:25 PM, Suzuki K Poulose wrote:
> On 11/07/2024 09:17, Tao Zhang wrote:
>> Since the new funnel device supports multi-port output scenarios,
>> there may be more than one TPDM connected to one TPDA. In this
>> way, when reading the element size of the TPDM, TPDA driver needs
>> to find the expected TPDM corresponding to the filter source.
>> When TPDA finds a TPDM or a filter source from a input connection,
>> it will read the Devicetree to get the expected TPDM's element
>> size.
>>
>> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-tpda.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c 
>> b/drivers/hwtracing/coresight/coresight-tpda.c
>> index bfca103f9f84..4936ba4a7625 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpda.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
>> @@ -110,6 +110,8 @@ static int tpda_get_element_size(struct 
>> tpda_drvdata *drvdata,
>>               csdev->pdata->in_conns[i]->dest_port != inport)
>>               continue;
>>   +        if (csdev->pdata->in_conns[i]->filter_src_dev)
>> +            in = csdev->pdata->in_conns[i]->filter_src_dev;
>
> Actually, this may not be complete, if the device was removed. Also add
> a comment here.
>
>         /*
>          * If this port has a hardcoded filter, use the source
>          * device directly.
>          */
>         if (csdev->pdata->in_conns[i]->filter_src_fwnode) {
>             in = csdev->pdata->in_conns[i]->filter_src_dev;
>             if (!in)
>                 continue;
>         }

I will update to the next version.


Best,

Tao

>
>
> Suzuki
>
>>           if (coresight_device_is_tpdm(in)) {
>>               if (drvdata->dsb_esize || drvdata->cmb_esize)
>>                   return -EEXIST;
>> @@ -124,7 +126,6 @@ static int tpda_get_element_size(struct 
>> tpda_drvdata *drvdata,
>>           }
>>       }
>>   -
>
>>       return rc;
>>   }
>
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
index bfca103f9f84..4936ba4a7625 100644
--- a/drivers/hwtracing/coresight/coresight-tpda.c
+++ b/drivers/hwtracing/coresight/coresight-tpda.c
@@ -110,6 +110,8 @@  static int tpda_get_element_size(struct tpda_drvdata *drvdata,
 		    csdev->pdata->in_conns[i]->dest_port != inport)
 			continue;
 
+		if (csdev->pdata->in_conns[i]->filter_src_dev)
+			in = csdev->pdata->in_conns[i]->filter_src_dev;
 		if (coresight_device_is_tpdm(in)) {
 			if (drvdata->dsb_esize || drvdata->cmb_esize)
 				return -EEXIST;
@@ -124,7 +126,6 @@  static int tpda_get_element_size(struct tpda_drvdata *drvdata,
 		}
 	}
 
-
 	return rc;
 }