Re: [PATCH v1 1/2] coresight: Add remote etm support

From: Jinlong Mao
Date: Thu Nov 09 2023 - 01:18:21 EST



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@xxxxxxxxxxx>
---
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