mbox series

[v4,0/2] coresight: core: Add device name support

Message ID 20240703122340.26864-1-quic_jinlmao@quicinc.com (mailing list archive)
Headers show
Series coresight: core: Add device name support | expand

Message

Mao Jinlong July 3, 2024, 12:23 p.m. UTC
With current design, the name of the non-cpu bounded coresight
component is the device type with the number. And with 'ls' command
we can get the register address of the component. But from these
information, we can't know what the HW or system the component belongs
to. Add device-name in DT to support it.

cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2

Change since V3:
1. Change device-name to arm,cs-dev-name.
2. Add arm,cs-dev-name to only CTI and sources' dt-binding.

Change since V2:
1. Fix the error in coresight core.
drivers/hwtracing/coresight/coresight-core.c:1775:7: error: assigning to 'char *' from 'const char *' discards qualifiers

2. Fix the warning when run dtbinding check.
Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml: device-name: missing type definition

Change since V1:
1. Change coresight-name to device name.
2. Add the device-name in coresight dt bindings.


Mao Jinlong (2):
  coresight: core: Add device name support
  dt-bindings: arm: Add device-name in the coresight components

 .../bindings/arm/arm,coresight-catu.yaml      |  6 +++
 .../bindings/arm/arm,coresight-cpu-debug.yaml |  6 +++
 .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
 .../arm/arm,coresight-dummy-sink.yaml         |  6 +++
 .../arm/arm,coresight-dummy-source.yaml       |  6 +++
 .../arm/arm,coresight-dynamic-funnel.yaml     |  6 +++
 .../arm/arm,coresight-dynamic-replicator.yaml |  6 +++
 .../bindings/arm/arm,coresight-etb10.yaml     |  6 +++
 .../bindings/arm/arm,coresight-etm.yaml       |  6 +++
 .../arm/arm,coresight-static-funnel.yaml      |  6 +++
 .../arm/arm,coresight-static-replicator.yaml  |  6 +++
 .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
 .../bindings/arm/arm,coresight-tmc.yaml       |  6 +++
 .../bindings/arm/arm,coresight-tpiu.yaml      |  6 +++
 .../bindings/arm/qcom,coresight-tpda.yaml     |  6 +++
 .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
 drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
 .../hwtracing/coresight/coresight-platform.c  | 31 ++++++++++++++++
 include/linux/coresight.h                     |  3 +-
 19 files changed, 149 insertions(+), 18 deletions(-)

Mao Jinlong (2):
  dt-bindings: arm: Add device-name in the coresight components
  coresight: core: Add device name support

 .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
 .../arm/arm,coresight-dummy-source.yaml       |  6 +++
 .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
 .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
 drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
 .../hwtracing/coresight/coresight-platform.c  | 30 +++++++++++++++
 include/linux/coresight.h                     |  3 +-
 7 files changed, 76 insertions(+), 18 deletions(-)

Comments

Mike Leach July 31, 2024, 3:15 p.m. UTC | #1
Hi,

1) As per Krzysztof comment - use the standard "label" property

2) Do not use the label string as the node name - there is no
guarantee of uniqueness which will cause issues. Please add the label
as a sysfs file to the standard node.
This uses the existing standard names, allowing any scripting based on
this to continue to work, and will not cause issues with uniqueness

e.g.
This will allow :

cat cti_cpu0/label

to extract the additional hardware context information that you need.

Thanks

Mike


On Wed, 3 Jul 2024 at 13:24, Mao Jinlong <quic_jinlmao@quicinc.com> wrote:
>
> With current design, the name of the non-cpu bounded coresight
> component is the device type with the number. And with 'ls' command
> we can get the register address of the component. But from these
> information, we can't know what the HW or system the component belongs
> to. Add device-name in DT to support it.
>
> cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
> cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
> tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
> tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
> tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2
>
> Change since V3:
> 1. Change device-name to arm,cs-dev-name.
> 2. Add arm,cs-dev-name to only CTI and sources' dt-binding.
>
> Change since V2:
> 1. Fix the error in coresight core.
> drivers/hwtracing/coresight/coresight-core.c:1775:7: error: assigning to 'char *' from 'const char *' discards qualifiers
>
> 2. Fix the warning when run dtbinding check.
> Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml: device-name: missing type definition
>
> Change since V1:
> 1. Change coresight-name to device name.
> 2. Add the device-name in coresight dt bindings.
>
>
> Mao Jinlong (2):
>   coresight: core: Add device name support
>   dt-bindings: arm: Add device-name in the coresight components
>
>  .../bindings/arm/arm,coresight-catu.yaml      |  6 +++
>  .../bindings/arm/arm,coresight-cpu-debug.yaml |  6 +++
>  .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
>  .../arm/arm,coresight-dummy-sink.yaml         |  6 +++
>  .../arm/arm,coresight-dummy-source.yaml       |  6 +++
>  .../arm/arm,coresight-dynamic-funnel.yaml     |  6 +++
>  .../arm/arm,coresight-dynamic-replicator.yaml |  6 +++
>  .../bindings/arm/arm,coresight-etb10.yaml     |  6 +++
>  .../bindings/arm/arm,coresight-etm.yaml       |  6 +++
>  .../arm/arm,coresight-static-funnel.yaml      |  6 +++
>  .../arm/arm,coresight-static-replicator.yaml  |  6 +++
>  .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
>  .../bindings/arm/arm,coresight-tmc.yaml       |  6 +++
>  .../bindings/arm/arm,coresight-tpiu.yaml      |  6 +++
>  .../bindings/arm/qcom,coresight-tpda.yaml     |  6 +++
>  .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
>  drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
>  .../hwtracing/coresight/coresight-platform.c  | 31 ++++++++++++++++
>  include/linux/coresight.h                     |  3 +-
>  19 files changed, 149 insertions(+), 18 deletions(-)
>
> Mao Jinlong (2):
>   dt-bindings: arm: Add device-name in the coresight components
>   coresight: core: Add device name support
>
>  .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
>  .../arm/arm,coresight-dummy-source.yaml       |  6 +++
>  .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
>  .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
>  drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
>  .../hwtracing/coresight/coresight-platform.c  | 30 +++++++++++++++
>  include/linux/coresight.h                     |  3 +-
>  7 files changed, 76 insertions(+), 18 deletions(-)
>
> --
> 2.41.0
>


--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
Mao Jinlong Oct. 18, 2024, 8:42 a.m. UTC | #2
On 2024/7/31 23:15, Mike Leach wrote:
> Hi,
> 
> 1) As per Krzysztof comment - use the standard "label" property
> 
> 2) Do not use the label string as the node name - there is no
> guarantee of uniqueness which will cause issues. Please add the label
> as a sysfs file to the standard node.
> This uses the existing standard names, allowing any scripting based on
> this to continue to work, and will not cause issues with uniqueness
> 
> e.g.
> This will allow :
> 
> cat cti_cpu0/label
> 
> to extract the additional hardware context information that you need.
> 
> Thanks
> 
> Mike

Hi Mike,

I tried to get the label in the driver code. But I don't find any
function for it. Do you know the function to get the label of the device
tree node ?

label: node_name@node_address

Thanks
Jinlong Mao

> 
> 
> On Wed, 3 Jul 2024 at 13:24, Mao Jinlong <quic_jinlmao@quicinc.com> wrote:
>>
>> With current design, the name of the non-cpu bounded coresight
>> component is the device type with the number. And with 'ls' command
>> we can get the register address of the component. But from these
>> information, we can't know what the HW or system the component belongs
>> to. Add device-name in DT to support it.
>>
>> cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
>> cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
>> tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
>> tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
>> tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2
>>
>> Change since V3:
>> 1. Change device-name to arm,cs-dev-name.
>> 2. Add arm,cs-dev-name to only CTI and sources' dt-binding.
>>
>> Change since V2:
>> 1. Fix the error in coresight core.
>> drivers/hwtracing/coresight/coresight-core.c:1775:7: error: assigning to 'char *' from 'const char *' discards qualifiers
>>
>> 2. Fix the warning when run dtbinding check.
>> Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml: device-name: missing type definition
>>
>> Change since V1:
>> 1. Change coresight-name to device name.
>> 2. Add the device-name in coresight dt bindings.
>>
>>
>> Mao Jinlong (2):
>>    coresight: core: Add device name support
>>    dt-bindings: arm: Add device-name in the coresight components
>>
>>   .../bindings/arm/arm,coresight-catu.yaml      |  6 +++
>>   .../bindings/arm/arm,coresight-cpu-debug.yaml |  6 +++
>>   .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
>>   .../arm/arm,coresight-dummy-sink.yaml         |  6 +++
>>   .../arm/arm,coresight-dummy-source.yaml       |  6 +++
>>   .../arm/arm,coresight-dynamic-funnel.yaml     |  6 +++
>>   .../arm/arm,coresight-dynamic-replicator.yaml |  6 +++
>>   .../bindings/arm/arm,coresight-etb10.yaml     |  6 +++
>>   .../bindings/arm/arm,coresight-etm.yaml       |  6 +++
>>   .../arm/arm,coresight-static-funnel.yaml      |  6 +++
>>   .../arm/arm,coresight-static-replicator.yaml  |  6 +++
>>   .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
>>   .../bindings/arm/arm,coresight-tmc.yaml       |  6 +++
>>   .../bindings/arm/arm,coresight-tpiu.yaml      |  6 +++
>>   .../bindings/arm/qcom,coresight-tpda.yaml     |  6 +++
>>   .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
>>   drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
>>   .../hwtracing/coresight/coresight-platform.c  | 31 ++++++++++++++++
>>   include/linux/coresight.h                     |  3 +-
>>   19 files changed, 149 insertions(+), 18 deletions(-)
>>
>> Mao Jinlong (2):
>>    dt-bindings: arm: Add device-name in the coresight components
>>    coresight: core: Add device name support
>>
>>   .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
>>   .../arm/arm,coresight-dummy-source.yaml       |  6 +++
>>   .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
>>   .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
>>   drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
>>   .../hwtracing/coresight/coresight-platform.c  | 30 +++++++++++++++
>>   include/linux/coresight.h                     |  3 +-
>>   7 files changed, 76 insertions(+), 18 deletions(-)
>>
>> --
>> 2.41.0
>>
> 
> 
> --
> Mike Leach
> Principal Engineer, ARM Ltd.
> Manchester Design Centre. UK
Mike Leach Oct. 24, 2024, 12:45 p.m. UTC | #3
Hi Jinlong

I was suggesting using the label property - see p44, table 4.3 of the
devicetree specification.

e.g.

node_name@node_address {
        label = "text description of this device instance";
}

Then use the normal of_xxxx functions to extract the string value from "label".

Regards

Mike

On Fri, 18 Oct 2024 at 09:42, Jinlong Mao <quic_jinlmao@quicinc.com> wrote:
>
>
>
> On 2024/7/31 23:15, Mike Leach wrote:
> > Hi,
> >
> > 1) As per Krzysztof comment - use the standard "label" property
> >
> > 2) Do not use the label string as the node name - there is no
> > guarantee of uniqueness which will cause issues. Please add the label
> > as a sysfs file to the standard node.
> > This uses the existing standard names, allowing any scripting based on
> > this to continue to work, and will not cause issues with uniqueness
> >
> > e.g.
> > This will allow :
> >
> > cat cti_cpu0/label
> >
> > to extract the additional hardware context information that you need.
> >
> > Thanks
> >
> > Mike
>
> Hi Mike,
>
> I tried to get the label in the driver code. But I don't find any
> function for it. Do you know the function to get the label of the device
> tree node ?
>
> label: node_name@node_address
>
> Thanks
> Jinlong Mao
>
> >
> >
> > On Wed, 3 Jul 2024 at 13:24, Mao Jinlong <quic_jinlmao@quicinc.com> wrote:
> >>
> >> With current design, the name of the non-cpu bounded coresight
> >> component is the device type with the number. And with 'ls' command
> >> we can get the register address of the component. But from these
> >> information, we can't know what the HW or system the component belongs
> >> to. Add device-name in DT to support it.
> >>
> >> cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
> >> cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
> >> tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
> >> tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
> >> tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2
> >>
> >> Change since V3:
> >> 1. Change device-name to arm,cs-dev-name.
> >> 2. Add arm,cs-dev-name to only CTI and sources' dt-binding.
> >>
> >> Change since V2:
> >> 1. Fix the error in coresight core.
> >> drivers/hwtracing/coresight/coresight-core.c:1775:7: error: assigning to 'char *' from 'const char *' discards qualifiers
> >>
> >> 2. Fix the warning when run dtbinding check.
> >> Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml: device-name: missing type definition
> >>
> >> Change since V1:
> >> 1. Change coresight-name to device name.
> >> 2. Add the device-name in coresight dt bindings.
> >>
> >>
> >> Mao Jinlong (2):
> >>    coresight: core: Add device name support
> >>    dt-bindings: arm: Add device-name in the coresight components
> >>
> >>   .../bindings/arm/arm,coresight-catu.yaml      |  6 +++
> >>   .../bindings/arm/arm,coresight-cpu-debug.yaml |  6 +++
> >>   .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
> >>   .../arm/arm,coresight-dummy-sink.yaml         |  6 +++
> >>   .../arm/arm,coresight-dummy-source.yaml       |  6 +++
> >>   .../arm/arm,coresight-dynamic-funnel.yaml     |  6 +++
> >>   .../arm/arm,coresight-dynamic-replicator.yaml |  6 +++
> >>   .../bindings/arm/arm,coresight-etb10.yaml     |  6 +++
> >>   .../bindings/arm/arm,coresight-etm.yaml       |  6 +++
> >>   .../arm/arm,coresight-static-funnel.yaml      |  6 +++
> >>   .../arm/arm,coresight-static-replicator.yaml  |  6 +++
> >>   .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
> >>   .../bindings/arm/arm,coresight-tmc.yaml       |  6 +++
> >>   .../bindings/arm/arm,coresight-tpiu.yaml      |  6 +++
> >>   .../bindings/arm/qcom,coresight-tpda.yaml     |  6 +++
> >>   .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
> >>   drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
> >>   .../hwtracing/coresight/coresight-platform.c  | 31 ++++++++++++++++
> >>   include/linux/coresight.h                     |  3 +-
> >>   19 files changed, 149 insertions(+), 18 deletions(-)
> >>
> >> Mao Jinlong (2):
> >>    dt-bindings: arm: Add device-name in the coresight components
> >>    coresight: core: Add device name support
> >>
> >>   .../bindings/arm/arm,coresight-cti.yaml       |  6 +++
> >>   .../arm/arm,coresight-dummy-source.yaml       |  6 +++
> >>   .../bindings/arm/arm,coresight-stm.yaml       |  6 +++
> >>   .../bindings/arm/qcom,coresight-tpdm.yaml     |  6 +++
> >>   drivers/hwtracing/coresight/coresight-core.c  | 37 ++++++++++---------
> >>   .../hwtracing/coresight/coresight-platform.c  | 30 +++++++++++++++
> >>   include/linux/coresight.h                     |  3 +-
> >>   7 files changed, 76 insertions(+), 18 deletions(-)
> >>
> >> --
> >> 2.41.0
> >>
> >
> >
> > --
> > Mike Leach
> > Principal Engineer, ARM Ltd.
> > Manchester Design Centre. UK
>