mbox series

[v2,0/2] coresight: Add remote etm support

Message ID 20240807071054.12742-1-quic_jinlmao@quicinc.com
Headers show
Series coresight: Add remote etm support | expand

Message

Mao Jinlong Aug. 7, 2024, 7:10 a.m. UTC
The system on chip (SoC) consists of main APSS(Applications processor
subsytem) and additional processors like modem, lpass. There is
coresight-etm driver for etm trace of APSS. Coresight remote etm driver
is for enabling and disabling the etm trace of remote processors.
It uses QMI interface to communicate with remote processors' software
and uses coresight framework to configure the connection from remote
etm source to TMC sinks.

Example to capture the remote etm trace:

Enable source:
echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
echo 1 > /sys/bus/coresight/devices/remote_etm0/enable_source

Capture the trace:
cat /dev/tmc_etf0 > /data/remote_etm.bin

Disable source:
echo 0 > /sys/bus/coresight/devices/remote_etm0/enable_source

Changes since V1:
1. Remove unused content
2. Use CORESIGHT_DEV_SUBTYPE_SOURCE_OTHERS as remote etm source type.
3. Use enabled instead of enable in driver data.
4. Validate instance id value where it's read from the DT.

Mao Jinlong (2):
  dt-bindings: arm: Add qcom,inst-id for remote etm
  coresight: Add remote etm support

 .../arm/qcom,coresight-remote-etm.yaml        |  10 +
 drivers/hwtracing/coresight/Kconfig           |  13 +
 drivers/hwtracing/coresight/Makefile          |   1 +
 drivers/hwtracing/coresight/coresight-qmi.h   |  89 +++++
 .../coresight/coresight-remote-etm.c          | 308 ++++++++++++++++++
 5 files changed, 421 insertions(+)
 create mode 100644 drivers/hwtracing/coresight/coresight-qmi.h
 create mode 100644 drivers/hwtracing/coresight/coresight-remote-etm.c

Comments

Suzuki K Poulose Aug. 8, 2024, 10:25 a.m. UTC | #1
On 07/08/2024 08:10, Mao Jinlong wrote:
> qcom,inst-id is the instance id used by qmi API to communicate with
> remote processor.
> 
> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
> ---
>   .../bindings/arm/qcom,coresight-remote-etm.yaml        | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml
> index 4fd5752978cd..a65121505c68 100644
> --- a/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml
> +++ b/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml
> @@ -20,6 +20,13 @@ properties:
>     compatible:
>       const: qcom,coresight-remote-etm

That is a generic name, without any clue of the QMI transport. Are there 
other ways in which an ETM could be connected ? Given how this QMI 
inst-id is added, I wonder if this is an after thought ? Why was the dt
pushed without a proper driver for it ?


Suzuki


>   
> +  qcom,inst-id:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      This id is used by qmi API to communicate with remote processor for
> +      enabling and disabling remote etm. Each processor has its unique instance
> +      id.
> +
>     out-ports:
>       $ref: /schemas/graph.yaml#/properties/ports
>       additionalProperties: false
> @@ -31,6 +38,7 @@ properties:
>   
>   required:
>     - compatible
> +  - qcom,inst-id
>     - out-ports
>   
>   additionalProperties: false
> @@ -40,6 +48,8 @@ examples:
>       etm {
>           compatible = "qcom,coresight-remote-etm";
>   
> +        qcom,inst-id = <5>;
> +
>           out-ports {
>               port {
>                   modem_etm0_out_funnel_modem: endpoint {
Mao Jinlong Aug. 13, 2024, 7:30 a.m. UTC | #2
On 2024/8/8 18:25, Suzuki K Poulose wrote:
> On 07/08/2024 08:10, Mao Jinlong wrote:
>> qcom,inst-id is the instance id used by qmi API to communicate with
>> remote processor.
>>
>> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
>> ---
>>   .../bindings/arm/qcom,coresight-remote-etm.yaml        | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml 
>> b/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml
>> index 4fd5752978cd..a65121505c68 100644
>> --- 
>> a/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml
>> +++ 
>> b/Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml
>> @@ -20,6 +20,13 @@ properties:
>>     compatible:
>>       const: qcom,coresight-remote-etm
> 
> That is a generic name, without any clue of the QMI transport. Are there 
> other ways in which an ETM could be connected ? Given how this QMI 
> inst-id is added, I wonder if this is an after thought ? Why was the dt
> pushed without a proper driver for it ?
> 
> 
> Suzuki

Hi Suzuki,

This driver is to enable/disable ETM of remote processors by QMI 
service. QMI connection is the only way to communicate between kernel 
driver and remote QMI service. Instance id is required. The id is unique
for each remote processor.

The dt is pushed to solve the device tree warning in Qualcomm's devicetree.

https://lore.kernel.org/linux-arm-msm/20231210072633.4243-1-quic_jinlmao@quicinc.com/

https://lore.kernel.org/linux-arm-msm/20231210072633.4243-2-quic_jinlmao@quicinc.com/

Thanks
Jinlong Mao
> 
> 
>> +  qcom,inst-id:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description:
>> +      This id is used by qmi API to communicate with remote processor 
>> for
>> +      enabling and disabling remote etm. Each processor has its 
>> unique instance
>> +      id.
>> +
>>     out-ports:
>>       $ref: /schemas/graph.yaml#/properties/ports
>>       additionalProperties: false
>> @@ -31,6 +38,7 @@ properties:
>>   required:
>>     - compatible
>> +  - qcom,inst-id
>>     - out-ports
>>   additionalProperties: false
>> @@ -40,6 +48,8 @@ examples:
>>       etm {
>>           compatible = "qcom,coresight-remote-etm";
>> +        qcom,inst-id = <5>;
>> +
>>           out-ports {
>>               port {
>>                   modem_etm0_out_funnel_modem: endpoint {
>