* [PATCH v1] coresight: tpda: fix the logic to setup the element size
@ 2025-08-06 8:09 Jie Gan
2025-08-06 11:00 ` James Clark
2025-09-03 8:57 ` Suzuki K Poulose
0 siblings, 2 replies; 5+ messages in thread
From: Jie Gan @ 2025-08-06 8:09 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Tao Zhang, Mao Jinlong
Cc: tingwei.zhang, coresight, linux-arm-kernel, linux-kernel,
linux-arm-msm
Some TPDM devices support both CMB and DSB datasets, requiring
the system to enable the port with both corresponding element sizes.
Currently, the logic treats tpdm_read_element_size as successful if
the CMB element size is retrieved correctly, regardless of whether
the DSB element size is obtained. This behavior causes issues
when parsing data from TPDM devices that depend on both element sizes.
To address this, the function should explicitly fail if the DSB
element size cannot be read correctly.
Fixes: e6d7f5252f73 ("coresight-tpda: Add support to configure CMB element")
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
---
drivers/hwtracing/coresight/coresight-tpda.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
index 0633f04beb24..333b3cb23685 100644
--- a/drivers/hwtracing/coresight/coresight-tpda.c
+++ b/drivers/hwtracing/coresight/coresight-tpda.c
@@ -71,6 +71,8 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
if (tpdm_data->dsb) {
rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
"qcom,dsb-element-bits", &drvdata->dsb_esize);
+ if (rc)
+ goto out;
}
if (tpdm_data->cmb) {
@@ -78,6 +80,7 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
"qcom,cmb-element-bits", &drvdata->cmb_esize);
}
+out:
if (rc)
dev_warn_once(&csdev->dev,
"Failed to read TPDM Element size: %d\n", rc);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] coresight: tpda: fix the logic to setup the element size
2025-08-06 8:09 [PATCH v1] coresight: tpda: fix the logic to setup the element size Jie Gan
@ 2025-08-06 11:00 ` James Clark
2025-09-03 8:57 ` Suzuki K Poulose
1 sibling, 0 replies; 5+ messages in thread
From: James Clark @ 2025-08-06 11:00 UTC (permalink / raw)
To: Jie Gan
Cc: tingwei.zhang, coresight, linux-arm-kernel, linux-kernel,
linux-arm-msm, Suzuki K Poulose, Mike Leach, Alexander Shishkin,
Tao Zhang, Mao Jinlong
On 06/08/2025 9:09 am, Jie Gan wrote:
> Some TPDM devices support both CMB and DSB datasets, requiring
> the system to enable the port with both corresponding element sizes.
>
> Currently, the logic treats tpdm_read_element_size as successful if
> the CMB element size is retrieved correctly, regardless of whether
> the DSB element size is obtained. This behavior causes issues
> when parsing data from TPDM devices that depend on both element sizes.
>
> To address this, the function should explicitly fail if the DSB
> element size cannot be read correctly.
>
> Fixes: e6d7f5252f73 ("coresight-tpda: Add support to configure CMB element")
> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
> ---
> drivers/hwtracing/coresight/coresight-tpda.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
> index 0633f04beb24..333b3cb23685 100644
> --- a/drivers/hwtracing/coresight/coresight-tpda.c
> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
> @@ -71,6 +71,8 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
> if (tpdm_data->dsb) {
> rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
> "qcom,dsb-element-bits", &drvdata->dsb_esize);
> + if (rc)
> + goto out;
> }
>
> if (tpdm_data->cmb) {
> @@ -78,6 +80,7 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
> "qcom,cmb-element-bits", &drvdata->cmb_esize);
> }
>
> +out:
> if (rc)
> dev_warn_once(&csdev->dev,
> "Failed to read TPDM Element size: %d\n", rc);
Reviewed-by: James Clark <james.clark@linaro.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] coresight: tpda: fix the logic to setup the element size
2025-08-06 8:09 [PATCH v1] coresight: tpda: fix the logic to setup the element size Jie Gan
2025-08-06 11:00 ` James Clark
@ 2025-09-03 8:57 ` Suzuki K Poulose
2025-09-03 9:45 ` Jie Gan
1 sibling, 1 reply; 5+ messages in thread
From: Suzuki K Poulose @ 2025-09-03 8:57 UTC (permalink / raw)
To: Jie Gan, Mike Leach, James Clark, Alexander Shishkin, Tao Zhang,
Mao Jinlong
Cc: tingwei.zhang, coresight, linux-arm-kernel, linux-kernel,
linux-arm-msm
On 06/08/2025 09:09, Jie Gan wrote:
> Some TPDM devices support both CMB and DSB datasets, requiring
> the system to enable the port with both corresponding element sizes.
>
> Currently, the logic treats tpdm_read_element_size as successful if
> the CMB element size is retrieved correctly, regardless of whether
> the DSB element size is obtained. This behavior causes issues
> when parsing data from TPDM devices that depend on both element sizes.
>
> To address this, the function should explicitly fail if the DSB
> element size cannot be read correctly.
But what is the device only has CMB ? Back when this was originally
merged, we raised this question and the answer was, "Only one is
supported, not both." But this sounds like that is wrong.
Could we defer the "Warning" to the caller. i.e., Let the caller
figure out the if the DSB size is found and predicate that on the
DSB support on the TPDM.
Suzuki
>
> Fixes: e6d7f5252f73 ("coresight-tpda: Add support to configure CMB element")
> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
> ---
> drivers/hwtracing/coresight/coresight-tpda.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
> index 0633f04beb24..333b3cb23685 100644
> --- a/drivers/hwtracing/coresight/coresight-tpda.c
> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
> @@ -71,6 +71,8 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
> if (tpdm_data->dsb) {
> rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
> "qcom,dsb-element-bits", &drvdata->dsb_esize);
> + if (rc)
> + goto out;
> }
>
> if (tpdm_data->cmb) {
> @@ -78,6 +80,7 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
> "qcom,cmb-element-bits", &drvdata->cmb_esize);
> }
>
> +out:
> if (rc)
> dev_warn_once(&csdev->dev,
> "Failed to read TPDM Element size: %d\n", rc);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] coresight: tpda: fix the logic to setup the element size
2025-09-03 8:57 ` Suzuki K Poulose
@ 2025-09-03 9:45 ` Jie Gan
2025-09-04 1:12 ` Jie Gan
0 siblings, 1 reply; 5+ messages in thread
From: Jie Gan @ 2025-09-03 9:45 UTC (permalink / raw)
To: Suzuki K Poulose, Jie Gan, Mike Leach, James Clark,
Alexander Shishkin, Tao Zhang, Mao Jinlong
Cc: tingwei.zhang, coresight, linux-arm-kernel, linux-kernel,
linux-arm-msm
On 9/3/2025 4:57 PM, Suzuki K Poulose wrote:
> On 06/08/2025 09:09, Jie Gan wrote:
>> Some TPDM devices support both CMB and DSB datasets, requiring
>> the system to enable the port with both corresponding element sizes.
>>
>> Currently, the logic treats tpdm_read_element_size as successful if
>> the CMB element size is retrieved correctly, regardless of whether
>> the DSB element size is obtained. This behavior causes issues
>> when parsing data from TPDM devices that depend on both element sizes.
>>
>> To address this, the function should explicitly fail if the DSB
>> element size cannot be read correctly.
>
> But what is the device only has CMB ? Back when this was originally
We have CMB TPDM, DSB TPDM and CMB&&DSB TPDM.
> merged, we raised this question and the answer was, "Only one is
> supported, not both." But this sounds like that is wrong.
I think we may not answer the previous question clearly. But it
definitely has issue here.
> Could we defer the "Warning" to the caller. i.e., Let the caller
> figure out the if the DSB size is found and predicate that on the
> DSB support on the TPDM.
Understood, below codes will be added in the caller to check the error:
if ((tpdm_data->dsb && !drvdata->dsb_esize) ||
(tpdm_data->cmb && !drvdata->cmb_esize))
goto err;
Thanks,
Jie
>
> Suzuki
>
>>
>> Fixes: e6d7f5252f73 ("coresight-tpda: Add support to configure CMB
>> element")
>> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
>> ---
>> drivers/hwtracing/coresight/coresight-tpda.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/
>> hwtracing/coresight/coresight-tpda.c
>> index 0633f04beb24..333b3cb23685 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpda.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
>> @@ -71,6 +71,8 @@ static int tpdm_read_element_size(struct
>> tpda_drvdata *drvdata,
>> if (tpdm_data->dsb) {
>> rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
>> "qcom,dsb-element-bits", &drvdata->dsb_esize);
>> + if (rc)
>> + goto out;
>> }
>> if (tpdm_data->cmb) {
>> @@ -78,6 +80,7 @@ static int tpdm_read_element_size(struct
>> tpda_drvdata *drvdata,
>> "qcom,cmb-element-bits", &drvdata->cmb_esize);
>> }
>> +out:
>> if (rc)
>> dev_warn_once(&csdev->dev,
>> "Failed to read TPDM Element size: %d\n", rc);
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] coresight: tpda: fix the logic to setup the element size
2025-09-03 9:45 ` Jie Gan
@ 2025-09-04 1:12 ` Jie Gan
0 siblings, 0 replies; 5+ messages in thread
From: Jie Gan @ 2025-09-04 1:12 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Tao Zhang, Mao Jinlong
Cc: tingwei.zhang, coresight, linux-arm-kernel, linux-kernel,
linux-arm-msm
On 9/3/2025 5:45 PM, Jie Gan wrote:
>
>
> On 9/3/2025 4:57 PM, Suzuki K Poulose wrote:
>> On 06/08/2025 09:09, Jie Gan wrote:
>>> Some TPDM devices support both CMB and DSB datasets, requiring
>>> the system to enable the port with both corresponding element sizes.
>>>
>>> Currently, the logic treats tpdm_read_element_size as successful if
>>> the CMB element size is retrieved correctly, regardless of whether
>>> the DSB element size is obtained. This behavior causes issues
>>> when parsing data from TPDM devices that depend on both element sizes.
>>>
>>> To address this, the function should explicitly fail if the DSB
>>> element size cannot be read correctly.
>>
>> But what is the device only has CMB ? Back when this was originally
>
> We have CMB TPDM, DSB TPDM and CMB&&DSB TPDM.
>
>> merged, we raised this question and the answer was, "Only one is
>> supported, not both." But this sounds like that is wrong.
>
> I think we may not answer the previous question clearly. But it
> definitely has issue here.
>
>> Could we defer the "Warning" to the caller. i.e., Let the caller
>> figure out the if the DSB size is found and predicate that on the
>> DSB support on the TPDM.
>
> Understood, below codes will be added in the caller to check the error:
> if ((tpdm_data->dsb && !drvdata->dsb_esize) ||
> (tpdm_data->cmb && !drvdata->cmb_esize))
> goto err;
>
> Thanks,
> Jie
>
Hi Suzuki,
I've reviewed the logic here. It's not feasible for the caller to
perform the check, since we first retrieve TPDM's drvdata, which adds
complexity to the code. I believe it's better to handle this within the
function itself.
We are expecting the element_size for cmb if the condition is true, as
well as dsb:
if (tpdm_data->dsb)
...
should obtain a valid element size for dsb.
...
if (tpdm_data->cmb)
...
should obtain a valid element size for cmb.
...
Thanks,
Jie
>>
>> Suzuki
>>
>>>
>>> Fixes: e6d7f5252f73 ("coresight-tpda: Add support to configure CMB
>>> element")
>>> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
>>> ---
>>> drivers/hwtracing/coresight/coresight-tpda.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/
>>> hwtracing/coresight/coresight-tpda.c
>>> index 0633f04beb24..333b3cb23685 100644
>>> --- a/drivers/hwtracing/coresight/coresight-tpda.c
>>> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
>>> @@ -71,6 +71,8 @@ static int tpdm_read_element_size(struct
>>> tpda_drvdata *drvdata,
>>> if (tpdm_data->dsb) {
>>> rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
>>> "qcom,dsb-element-bits", &drvdata->dsb_esize);
>>> + if (rc)
>>> + goto out;
>>> }
>>> if (tpdm_data->cmb) {
>>> @@ -78,6 +80,7 @@ static int tpdm_read_element_size(struct
>>> tpda_drvdata *drvdata,
>>> "qcom,cmb-element-bits", &drvdata->cmb_esize);
>>> }
>>> +out:
>>> if (rc)
>>> dev_warn_once(&csdev->dev,
>>> "Failed to read TPDM Element size: %d\n", rc);
>>
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-04 2:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 8:09 [PATCH v1] coresight: tpda: fix the logic to setup the element size Jie Gan
2025-08-06 11:00 ` James Clark
2025-09-03 8:57 ` Suzuki K Poulose
2025-09-03 9:45 ` Jie Gan
2025-09-04 1:12 ` Jie Gan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).