mbox series

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

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

Message

Mao Jinlong Nov. 7, 2023, 6:09 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

Mao Jinlong (2):
  coresight: Add remote etm support
  dt-bindings: arm: Add remote etm driver

 .../arm/qcom,coresight-remote-etm.yaml        |  59 ++++
 drivers/hwtracing/coresight/Kconfig           |   9 +
 drivers/hwtracing/coresight/Makefile          |   1 +
 drivers/hwtracing/coresight/coresight-core.c  |   3 +
 drivers/hwtracing/coresight/coresight-qmi.h   | 109 ++++++
 .../coresight/coresight-remote-etm.c          | 325 ++++++++++++++++++
 include/linux/coresight.h                     |   1 +
 7 files changed, 507 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-remote-etm.yaml
 create mode 100644 drivers/hwtracing/coresight/coresight-qmi.h
 create mode 100644 drivers/hwtracing/coresight/coresight-remote-etm.c

Comments

Mao Jinlong Nov. 9, 2023, 6:17 a.m. UTC | #1
On 11/7/2023 11:26 PM, Krzysztof Kozlowski wrote:
> On 07/11/2023 07:09, Mao Jinlong wrote:
>> Add support for ETM trace collection on remote processor using
>> coreSight framework.
>>
>> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
>> ---
>>   drivers/hwtracing/coresight/Kconfig           |   9 +
>>   drivers/hwtracing/coresight/Makefile          |   1 +
>>   drivers/hwtracing/coresight/coresight-core.c  |   3 +
>>   drivers/hwtracing/coresight/coresight-qmi.h   | 109 ++++++
>>   .../coresight/coresight-remote-etm.c          | 325 ++++++++++++++++++
>>   include/linux/coresight.h                     |   1 +
>>   6 files changed, 448 insertions(+)
>>   create mode 100644 drivers/hwtracing/coresight/coresight-qmi.h
>>   create mode 100644 drivers/hwtracing/coresight/coresight-remote-etm.c
>>
>> diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig
>> index 06f0a7594169..425886ab7401 100644
>> --- a/drivers/hwtracing/coresight/Kconfig
>> +++ b/drivers/hwtracing/coresight/Kconfig
>> @@ -247,4 +247,13 @@ config CORESIGHT_DUMMY
>>   
>>   	  To compile this driver as a module, choose M here: the module will be
>>   	  called coresight-dummy.
>> +
>> +config CORESIGHT_REMOTE_ETM
>> +	tristate "Remote processor ETM trace support"
>> +	select QCOM_QMI_HELPERS
>> +	help
>> +	  Enables support for ETM trace collection on remote processor using
>> +	  CoreSight framework. Enabling this will allow turning on ETM
>> +	  tracing on remote processor via sysfs by configuring the required
>> +	  CoreSight components.
>>   endif
.....
>> +}
>> +
>> +static const struct of_device_id remote_etm_match[] = {
>> +	{.compatible = "qcom,coresight-remote-etm"},
> Please order your patches correctly, so binding is documented before the
> users.
>
>> +	{}
>> +};
>> +
>> +static struct platform_driver remote_etm_driver = {
>> +	.probe          = remote_etm_probe,
>> +	.remove         = remote_etm_remove,
>> +	.driver         = {
>> +		.name   = "coresight-remote-etm",
>> +		.of_match_table = remote_etm_match,
>> +	},
>> +};
>> +
>> +int __init remote_etm_init(void)
>> +{
>> +	return platform_driver_register(&remote_etm_driver);
>> +}
>> +module_init(remote_etm_init);
>> +
>> +void __exit remote_etm_exit(void)
>> +{
>> +	platform_driver_unregister(&remote_etm_driver);
>> +}
>> +module_exit(remote_etm_exit);
> Why aren't you using module platform driver?
>
> Best regards,
> Krzysztof

Thanks for the review. I will check and address your comments.

Thanks
Jinlong Mao

>