Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
	linux-doc@vger.kernel.org
Cc: sudeep.holla@kernel.org, james.quinlan@broadcom.com,
	f.fainelli@gmail.com, vincent.guittot@linaro.org,
	etienne.carriere@st.com, peng.fan@oss.nxp.com,
	michal.simek@amd.com, d-gole@ti.com, jic23@kernel.org,
	elif.topuz@arm.com, lukasz.luba@arm.com, philip.radford@arm.com,
	brauner@kernel.org, david@kernel.org, souvik.chakravarty@arm.com,
	leitao@kernel.org, kas@kernel.org, puranjay@kernel.org,
	usama.arif@linux.dev, kernel-team@meta.com,
	Cristian Marussi <cristian.marussi@arm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: [PATCH v5 22/23] Documentation: Add SCMI System Telemetry documentation
Date: Fri,  3 Jul 2026 13:36:00 +0100	[thread overview]
Message-ID: <20260703123601.381275-23-cristian.marussi@arm.com> (raw)
In-Reply-To: <20260703123601.381275-1-cristian.marussi@arm.com>

Document ARM SCMI Telemetry IOCTLs interface.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 Documentation/userspace-api/index.rst |   1 +
 Documentation/userspace-api/stlm.rst  | 143 ++++++++++++++++++++++++++
 2 files changed, 144 insertions(+)
 create mode 100644 Documentation/userspace-api/stlm.rst

diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
index a68b1bea57a8..22daa7ebf78e 100644
--- a/Documentation/userspace-api/index.rst
+++ b/Documentation/userspace-api/index.rst
@@ -54,6 +54,7 @@ Devices and I/O
    dcdbas
    vduse
    isapnp
+   stlm
 
 Everything else
 ===============
diff --git a/Documentation/userspace-api/stlm.rst b/Documentation/userspace-api/stlm.rst
new file mode 100644
index 000000000000..ca02281dfa2f
--- /dev/null
+++ b/Documentation/userspace-api/stlm.rst
@@ -0,0 +1,143 @@
+.. SPDX-License-Identifier: GPL-2.0
+.. stlm:
+
+=======================================
+STLM - ARM SCMI Telemetry Userspace API
+=======================================
+
+.. contents::
+
+Overview
+========
+
+ARM SCMI is a System and Configuration Management protocol, based on a
+client-server model, that defines a number of messages that allows a
+client/agent like Linux to discover, configure and make use of services
+provided by the server/platform firmware.
+
+SCMI v4.0 [1] introduced support for System Telemetry, through which an
+agent can dynamically enumerate, configure and collect Telemetry Data
+Events (DE) exposed by the platform.
+
+The SCMI System Telemetry driver expose one or more dedicated devices,
+named as tlm_<N>, grouped under /dev/scmi/, one for each discovered SCMI
+instance.
+
+A IOCTL based interface is defined in order to enumerate, configure and
+read telemetry data, as succinctly described in the following.
+
+For more details on the uAPI, please see include/uapi/linux/scmi.h
+
+Resources Enumeration
+=====================
+
+ - SCMI_TLM_GET_INFO: Gather basic Telemetry features like number of
+   resources and versioning information.
+
+ - SCMI_TLM_GET_INTRVS: Enumerate available update intervals.
+
+ - SCMI_TLM_GET_DE_INFO: Retrieve DataEvent description.
+
+ - SCMI_TLM_GET_DE_LIST: Retrieve the list of all the existent DataEvent
+   dwscriptors.
+
+ - SCMI_TLM_GET_GRP_LIST: Gather a list of descriptors for all defined Groups.
+
+ - SCMI_TLM_GET_GRP_INFO: Gather information for a specific Group.
+
+ - SCMI_TLM_GET_GRP_DESC: Gather detailed group composition information for
+   the specified Group.
+
+
+Configuration
+=============
+
+ - SCMI_TLM_GET_CFG / SCMI_TLM_SET_CFG: Get or set the whole istance, or a
+   specific group, configuration.
+
+ - SCMI_TLM_GET_DE_CFG / SCMI_TLM_SET_DE_CFG: Get or set the configuration
+   of a specific DataEvent.
+
+ - SCMI_TLM_GET_ALL_CFG / SCMI_TLM_SET_ALL_CFG: Get or set the cumulative
+   configuration of ALL the DataEvents defined on the platform.
+
+Data Collection
+===============
+
+ - SCMI_TLM_GET_DE_VALUE: Report the last udpated sample for the specified
+   DataEvent.
+
+ - SCMI_TLM_BULK_READ: Report the last samples for all the currently enabled
+   DataEvents.
+
+ - SCMI_TLM_BATCH_READ: Report the last samples for the DataEvents IDs
+   specified within the samples input params.
+
+ - SCMI_TLM_SINGLE_SAMPLE: Trigger an immediate platform-side DataEvent
+   update andc report the collected samples.
+
+Memory Mapped Raw Access
+------------------------
+
+ - SCMI_TLM_GET_SHMTI_LIST: Gather a list of open file descriptors, one for
+   each SHMTI memory areas defined for this instance, that can be used to
+   memory-map such areas in the calling process address space so as to be
+   able to directly access the SCMI Telemetry SHMTI areas shared by the
+   platform firmware, and parse the TDCF format.
+   The SCMI Telemetry TDCF format is defined in the specification at [1].
+
+
+Example
+=======
+
+.. code-block:: c
+
+	int main(int argc, char **argv)
+	{
+		struct scmi_tlm_de_config des_cfg = {};
+		struct scmi_tlm_config cfg = {};
+		struct scmi_tlm_de_sample samples[3] = {};
+		struct scmi_tlm_data_read data = {};
+		int fd, ret;
+
+		fd = open("/dev/scmi/tlm_0", O_RDWR);
+		if (fd < 0)
+			return fd;
+
+		/* Enable ALL Data Events with timestamps*/
+		des_cfg.enable = 1;
+		des_cfg.t_enable = 1;
+		ret = ioctl(fd, SCMI_TLM_SET_ALL_CFG, &des_cfg);
+		if (ret)
+			return ret;
+
+		/* Enable Telemetry as a whole, set a 400ms update interval */
+		cfg.enable = 1;
+		cfg.active.secs = 400;
+		cfg.active.exp = -3;
+
+		ret = ioctl(fd, SCMI_TLM_SET_CFG, &cfg);
+		if (ret)
+			return ret;
+
+		/* Read a selection of DEs */
+		samples[0].id = 0xA001;
+		samples[1].id = 0x0002;
+		samples[2].id = 0x1010;
+		data.num_samples = 3;
+		data.samples = (__u64)samples;
+
+		ret = ioctl(fd, SCMI_TLM_BATCH_READ, &data);
+		if (ret)
+			return ret;
+
+		for (int i = 0; i < 3; i++)
+			fprintf(stdout, "%llu: 0x%08X -> %llu\n",
+					samples[i].tstamp, samples[i].id, samples[i].val);
+
+		return 0;
+	}
+
+References
+==========
+[1]: https://developer.arm.com/documentation/den0056/latest/
-- 
2.54.0



  parent reply	other threads:[~2026-07-03 12:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 12:35 [PATCH v5 00/23] Introduce SCMI Telemetry support Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 01/23] firmware: arm_scmi: Add new SCMIv4.0 error codes definitions Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 02/23] firmware: arm_scmi: Reduce the scope of protocols mutex Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 03/23] firmware: arm_scmi: Allow registration of unknown-size events/reports Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 04/23] firmware: arm_scmi: Allow protocols to register for notifications Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 05/23] dt-bindings: firmware: arm,scmi: Add support for telemetry protocol Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 06/23] include: trace: Add Telemetry trace events Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 07/23] firmware: arm_scmi: Add basic Telemetry support Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 08/23] firmware: arm_scmi: Add support to parse SHMTIs areas Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 09/23] firmware: arm_scmi: Add Telemetry configuration operations Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 10/23] firmware: arm_scmi: Add Telemetry DataEvent read capabilities Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 11/23] firmware: arm_scmi: Add support for Telemetry reset Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 12/23] firmware: arm_scmi: Add Telemetry notification support Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 13/23] firmware: arm_scmi: Add support for boot-on Telemetry Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 14/23] firmware: arm_scmi: Add Telemetry generation counter Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 15/23] firmware: arm_scmi: Add common per-protocol debugfs support Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 16/23] firmware: arm_scmi: Add Telemetry debugfs SHMTI dump support Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 17/23] firmware: arm_scmi: Add Telemetry debugfs ABI documentation Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 18/23] firmware: arm_scmi: Expose per-instance identifier Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 19/23] uapi: Add ARM SCMI Telemetry definitions Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 20/23] firmware: arm_scmi: Add System Telemetry driver Cristian Marussi
2026-07-03 12:35 ` [PATCH v5 21/23] docs: ioctl-number: Add SCMI Ioctls Cristian Marussi
2026-07-03 12:36 ` Cristian Marussi [this message]
2026-07-03 12:36 ` [PATCH v5 23/23] [RFC] tools/scmi: Add SCMI Telemetry testing tool Cristian Marussi
2026-07-07  6:31 ` [PATCH v5 00/23] Introduce SCMI Telemetry support Subrahmanya Lingappa
2026-07-08 20:05   ` David Hildenbrand (Arm)
2026-07-10  8:32   ` Cristian Marussi

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=20260703123601.381275-23-cristian.marussi@arm.com \
    --to=cristian.marussi@arm.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=d-gole@ti.com \
    --cc=david@kernel.org \
    --cc=elif.topuz@arm.com \
    --cc=etienne.carriere@st.com \
    --cc=f.fainelli@gmail.com \
    --cc=james.quinlan@broadcom.com \
    --cc=jic23@kernel.org \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=michal.simek@amd.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=philip.radford@arm.com \
    --cc=puranjay@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=souvik.chakravarty@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=vincent.guittot@linaro.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