mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yuvaraj Ranganathan <yuvaraj.ranganathan@oss.qualcomm.com>
To: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: kernel@oss.qualcomm.com, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	Yuvaraj Ranganathan <yuvaraj.ranganathan@oss.qualcomm.com>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: [PATCH v2 0/2] firmware: qcom: scm: add tracepoints for the SMC call interface
Date: Fri, 22 May 2026 12:08:58 +0530	[thread overview]
Message-ID: <20260522-scm-tracepoints-v2-0-e27cdbe0c585@oss.qualcomm.com> (raw)

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@oss.qualcomm.com>
---
Changes in v2:
- Remove tabs before assignments as suggested in review.
- Link to v1: https://patch.msgid.link/20260506-scm-tracepoints-v1-0-4bc983264014@oss.qualcomm.com

---
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@oss.qualcomm.com>


             reply	other threads:[~2026-05-22  6:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  6:38 Yuvaraj Ranganathan [this message]
2026-05-22  6:38 ` [PATCH v2 1/2] firmware: qcom: scm: add trace events " Yuvaraj Ranganathan
2026-05-22  6:39 ` [PATCH v2 2/2] firmware: qcom: scm: instrument SMC call path with tracepoints Yuvaraj Ranganathan
2026-07-11 16:40 ` [PATCH v2 0/2] firmware: qcom: scm: add tracepoints for the SMC call interface Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260522-scm-tracepoints-v2-0-e27cdbe0c585@oss.qualcomm.com \
    --to=yuvaraj.ranganathan@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=kernel@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®