[PATCH 0/2] firmware: qcom: scm: add tracepoints for the SMC call interface

From: Yuvaraj Ranganathan

Date: Wed May 06 2026 - 06:38:58 EST


The Qualcomm SCM driver is the sole gateway between the kernel and
TrustZone firmware. When firmware issues manifest — unexpected error
codes, calls that never return, or WAITQ sleep/resume cycles that stall
— there is currently no low-overhead way to observe what the driver is
doing without inserting temporary printk statements and rebuilding the
kernel.

This series adds tracepoint coverage for the full SMC call lifecycle.
Once enabled, ftrace or perf can reconstruct the complete sequence of
firmware interactions, correlate service and command identifiers with
firmware return codes, measure per-call latency, and pinpoint the exact
call site responsible for a waitqueue stall — all without modifying
driver source or rebooting.

To capture a trace on a running system:

echo 1 > /sys/kernel/debug/tracing/events/qcom_scm/enable
cat /sys/kernel/debug/tracing/trace

Example output:

kworker/0:1-42 [000] .... 120.614235: scm_smc_request: smc_id:0x42000601 svc_id:0x06 cmd_id:0x01 args_cnt:1 args:{0x2000c1c}
kworker/0:1-42 [000] .... 120.614289: scm_smc_done: smc_id:0x42000601 ret:0 res_to_callee:0 res0:1 res1:0 res2:0
kworker/2:1-87 [002] .... 120.821011: scm_smc_request: smc_id:0x42000603 svc_id:0x01 cmd_id:0x05 args_cnt:1 args:{0xa}
kworker/2:1-87 [002] .... 120.821379: scm_waitq_sleep: wq_ctx:0, smc_call_ctx:1
kworker/2:1-87 [002] .... 120.823104: scm_waitq_resume: smc_call_ctx:1
kworker/2:1-87 [002] .... 120.823551: scm_smc_done: smc_id:0x42000603 ret:0 res_to_callee:0 res0:0 res1:0 res2:0

Tested on sa8797 with CONFIG_QCOM_SCM=y and CONFIG_FTRACE=y.
Compilation verified on arm32 and arm64.

Signed-off-by: Yuvaraj Ranganathan <yuvaraj.ranganathan@xxxxxxxxxxxxxxxx>
---
Yuvaraj Ranganathan (2):
firmware: qcom: scm: add trace events for the SMC call interface
firmware: qcom: scm: instrument SMC call path with tracepoints

drivers/firmware/qcom/Makefile | 1 +
drivers/firmware/qcom/qcom_scm-smc.c | 10 +++
drivers/firmware/qcom/qcom_scm_trace.h | 143 +++++++++++++++++++++++++++++++++
3 files changed, 154 insertions(+)
---
base-commit: 90c7629ccf1277799b025501e5491429ebf7b6cf
change-id: 20260506-scm-tracepoints-cb645232acbe

Best regards,
--
Yuvaraj Ranganathan <yuvaraj.ranganathan@xxxxxxxxxxxxxxxx>