mbox series

[v2,0/9] Add support to configure TPDM DSB subunit

Message ID 1674114105-16651-1-git-send-email-quic_taozha@quicinc.com
Headers show
Series Add support to configure TPDM DSB subunit | expand

Message

Tao Zhang Jan. 19, 2023, 7:41 a.m. UTC
From: Tao Zhang <taozha@qti.qualcomm.com>

Introduction of TPDM DSB subunit
DSB subunit is responsible for creating a dataset element, and is also
optionally responsible for packing it to fit multiple elements on a
single ATB transfer if possible in the configuration. The TPDM Core
Datapath requests timestamps be stored by the TPDA and then delivering
ATB sized data (depending on ATB width and element size, this could
be smaller or larger than a dataset element) to the ATB Mast FSM.

The DSB subunit must be configured prior to enablement. This series
adds support for TPDM to configure the configure DSB subunit.

Once this series patches are applied properly, the new tpdm nodes for
should be observed at the tpdm path /sys/bus/coresight/devices/tpdm*
which supports DSB subunit.
e.g.
/sys/devices/platform/soc@0/69d0000.tpdm/tpdm0#ls -l | grep dsb
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_edge_ctrl
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_edge_ctrl_mask
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_mode
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_patt_mask
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_patt_ts
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_patt_type
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_patt_val
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_trig_patt_mask
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_trig_patt_val
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_trig_ts
-rw-r--r--    1 root     root      4096 Jan  1 00:01 dsb_trig_type

We can use the commands are similar to the below to configure the
TPDMs which support DSB subunit. Enable coresight sink first.
echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
echo 1 > /sys/bus/coresight/devices/tpdm0/reset
echo 0x3 0x3 0x1 > /sys/bus/coresight/devices/tpdm0/dsb_edge_ctrl_mask
echo 0x6d 0x6d 0 > /sys/bus/coresight/devices/tpdm0/dsb_edge_ctrl
echo 1 > /sys/bus/coresight/devices/tpdm0/dsb_patt_ts
echo 1 > /sys/bus/coresight/devices/tpdm0/dsb_patt_type
echo 0 > /sys/bus/coresight/devices/tpdm0/dsb_trig_ts
echo 0 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/dsb_patt_mask
echo 0 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/dsb_trig_patt_val

This patch series depends on patch series "[v17,0/9] Coresight: Add
support for TPDM and TPDA"
https://patchwork.kernel.org/project/linux-arm-msm/cover/20230117145708.16739-1-quic_jinlmao@quicinc.com/

TPDM_DSB commit tree:
https://git.codelinaro.org/clo/linux-kernel/coresight/-/tree/tpdm-dsb-v2
https://git.codelinaro.org/clo/linux-kernel/coresight/-/commits/tpdm-dsb-v2

Changes in V2:
1. Change the name of the property "qcom,dsb-elem-size" to
"qcom,dsb-element-size" -- Suzuki K Poulose
2. Update the TPDA yaml file for the item "qcom,dsb-elem-size".
-- Krzysztof Kozlowski
3. Add the full name of DSB in the description of the item
"qcom,dsb-elem-size". -- Rob Herring

Changes in V1:
1. Change the definition of the property "qcom,dsb-elem-size" from
"uint32-array" to "uint32-matrix". -- Krzysztof Kozlowski
2. Add the full name of DSB. -- Rob Herring
3. Deal with 2 entries in an iteration in TPDA driver. -- Suzuki K Poulose
4. Divide the function "tpdm_datasets_alloc" into two functions,
"tpdm_datasets_setup" and "tpdm_datasets_alloc".
5. Detecte the input string with the conventional semantics automatically,
and constrain the size of the input value. -- Suzuki K Poulose
6. Use the hook function "is_visible()" to hide the DSB related knobs if
the data sets are missing. -- Suzuki K Poulose
7. Use the macros "FIELD_GET" and "FIELD_PREP" to set the values.
-- Suzuki K Poulose
8. Update the definition of the macros in TPDM driver.
9. Update the comments of the values for the nodes which are for DSB
element creation and onfigure pattern match output. -- Suzuki K Poulose
10. Use API "sysfs_emit" to "replace scnprintf". -- Suzuki K Poulose

Tao Zhang (9):
  dt-bindings: arm: Add support for DSB element
  coresight-tpda: Add DSB dataset support
  coresight-tpdm: Initialize DSB subunit configuration
  coresight-tpdm: Add reset node to TPDM node
  coresight-tpdm: Add nodes to set trigger timestamp and type
  coresight-tpdm: Add node to set dsb programming mode
  coresight-tpdm: Add nodes for dsb element creation
  coresight-tpdm: Add nodes to configure pattern match output
  coresight-tpdm: Add nodes for timestamp request

 .../bindings/arm/qcom,coresight-tpda.yaml          |  22 +
 drivers/hwtracing/coresight/coresight-tpda.c       |  62 ++
 drivers/hwtracing/coresight/coresight-tpda.h       |   4 +
 drivers/hwtracing/coresight/coresight-tpdm.c       | 630 ++++++++++++++++++++-
 drivers/hwtracing/coresight/coresight-tpdm.h       |  65 +++
 5 files changed, 778 insertions(+), 5 deletions(-)

Comments

Krzysztof Kozlowski Jan. 19, 2023, 10:44 a.m. UTC | #1
On 19/01/2023 08:41, Tao Zhang wrote:
> Add property "qcom,dsb-elem-size" to support DSB(Discrete Single
> Bit) element for TPDA. Specifies the DSB element size supported
> by each monitor connected to the aggregator on each port. Should
> be specified in pairs (port, dsb element size).
> 
> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
> Signed-off-by: Tao Zhang <taozha@qti.qualcomm.com>

You are the same person and it is still the same organization
(Qualcomm), right? Only one SoB.

> ---
>  .../bindings/arm/qcom,coresight-tpda.yaml          | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
> index 2ec9b5b..298db7f 100644
> --- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
> +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
> @@ -58,6 +58,26 @@ properties:
>      minItems: 1
>      maxItems: 2
>  
> +  qcom,dsb-element-size:
> +    description: |
> +      Specifies the DSB(Discrete Single Bit) element size supported by
> +      each monitor connected to the aggregator on each port. Should be
> +      specified in pairs <port, dsb element size>.

s/port/port number/

> +
> +      Note: The maximum value of the port number depends on how many
> +      input ports the current TPDA has. DSB element size currently only
> +      supports 32-bit and 64-bit.
> +    $ref: /schemas/types.yaml#/definitions/uint32-matrix
> +    items:

Are some reasonable maxItems known?

> +      items:
> +        - description: |
> +            "port" indicates TPDA input port number

What is "port"? You quoted it like it was some name of variable or
property. Where is then?

> +          minimum: 0
> +        - description: |
> +            "dsb element size" indicates dsb element size

"A" indicates A. This sentence does not make sense.

Also missing units.

s/dsb/DSB/

> +          minimum: 0
> +          maximum: 64
> +
>    clocks:
>      maxItems: 1
>  
> @@ -100,6 +120,8 @@ examples:
>         compatible = "qcom,coresight-tpda", "arm,primecell";
>         reg = <0x6004000 0x1000>;
>  
> +       qcom,dsb-element-size = <0 32>;
> +
>         clocks = <&aoss_qmp>;
>         clock-names = "apb_pclk";
>  

Best regards,
Krzysztof
Tao Zhang Jan. 31, 2023, 3:23 a.m. UTC | #2
Hi Krzysztof,

On 1/19/2023 6:44 PM, Krzysztof Kozlowski wrote:
> On 19/01/2023 08:41, Tao Zhang wrote:
>> Add property "qcom,dsb-elem-size" to support DSB(Discrete Single
>> Bit) element for TPDA. Specifies the DSB element size supported
>> by each monitor connected to the aggregator on each port. Should
>> be specified in pairs (port, dsb element size).
>>
>> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
>> Signed-off-by: Tao Zhang <taozha@qti.qualcomm.com>
> You are the same person and it is still the same organization
> (Qualcomm), right? Only one SoB.
I will change and update this in the next patch series.
>
>> ---
>>   .../bindings/arm/qcom,coresight-tpda.yaml          | 22 ++++++++++++++++++++++
>>   1 file changed, 22 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
>> index 2ec9b5b..298db7f 100644
>> --- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
>> +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
>> @@ -58,6 +58,26 @@ properties:
>>       minItems: 1
>>       maxItems: 2
>>   
>> +  qcom,dsb-element-size:
>> +    description: |
>> +      Specifies the DSB(Discrete Single Bit) element size supported by
>> +      each monitor connected to the aggregator on each port. Should be
>> +      specified in pairs <port, dsb element size>.
> s/port/port number/

It should be "port number" here.

I will change "<port, dsb element size>" to "<port number, DSB element 
size>" in the next patch series.

>> +
>> +      Note: The maximum value of the port number depends on how many
>> +      input ports the current TPDA has. DSB element size currently only
>> +      supports 32-bit and 64-bit.
>> +    $ref: /schemas/types.yaml#/definitions/uint32-matrix
>> +    items:
> Are some reasonable maxItems known?

This is related to hardware design, depending on how many input ports 
the TPDA has.

We cannot limit it to a reasonable maximum value from the software.

According to the existing hardware design, TPDA with the most input 
ports has about 30 input ports.

But there may be TPDA with more input ports.

>
>> +      items:
>> +        - description: |
>> +            "port" indicates TPDA input port number
> What is "port"? You quoted it like it was some name of variable or
> property. Where is then?

The "port" here refers to the port number of other Coresight devices 
connected to the TPDA input port.

I will change and update it in the next patch series.

>> +          minimum: 0
>> +        - description: |
>> +            "dsb element size" indicates dsb element size
> "A" indicates A. This sentence does not make sense.
>
> Also missing units.
>
> s/dsb/DSB/
"DSB element size" indicate the size of the element in DSB. DSB(Discrete 
Single

Bit) is a data collection unit.

I will change and update it in the next patch series.

>
>> +          minimum: 0
>> +          maximum: 64
>> +
>>     clocks:
>>       maxItems: 1
>>   
>> @@ -100,6 +120,8 @@ examples:
>>          compatible = "qcom,coresight-tpda", "arm,primecell";
>>          reg = <0x6004000 0x1000>;
>>   
>> +       qcom,dsb-element-size = <0 32>;
>> +
>>          clocks = <&aoss_qmp>;
>>          clock-names = "apb_pclk";
>>   
> Best regards,
> Krzysztof

Best,

Tao