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,
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>
Subject: [PATCH v12 10/25] firmware: arm_scmi: Add support for Telemetry reset
Date: Sun, 20 Sep 2026 10:19:13 +0100 [thread overview]
Message-ID: <20260920091928.2014972-11-cristian.marussi@arm.com> (raw)
In-Reply-To: <20260920091928.2014972-1-cristian.marussi@arm.com>
Add support for Telemetry operations needed to request platform to
reset telemetry current configuration and data events values.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
v11 --> v12
- using config_mtx to sync with ongoing configurations
- use proper helpers to update cache state
v10 --> v11
- protect TDE updates on reset
- use des_enable mutex when clearing des cache
- zero also active_update_interval
v8 --> v9
- add a commment on why NOT unlinking UUID
v6 --> v7
- add proper cleanup of sid/offs/uuids and caches on RESET
v5 --> v6
- added missing reset of global state
v3 --> v4
- reset tracked Telemetry DE state
v2 --> v3
- split from monolithic Telemetry patch
- use scmi_telemetry_de_unlink
---
drivers/firmware/arm_scmi/telemetry.c | 80 +++++++++++++++++++++++++++
include/linux/scmi_protocol.h | 2 +
2 files changed, 82 insertions(+)
diff --git a/drivers/firmware/arm_scmi/telemetry.c b/drivers/firmware/arm_scmi/telemetry.c
index c4981d3f5457..3e0c3c42e5a7 100644
--- a/drivers/firmware/arm_scmi/telemetry.c
+++ b/drivers/firmware/arm_scmi/telemetry.c
@@ -3138,6 +3138,85 @@ static int scmi_telemetry_des_sample_get(const struct scmi_protocol_handle *ph,
return ret;
}
+static void scmi_telemetry_local_resources_reset(struct telemetry_info *ti)
+{
+ struct scmi_telemetry_res_info *rinfo;
+
+ /* Stall concurrent configuration request */
+ guard(mutex)(&ti->config_mtx);
+
+ ti->info.enabled = false;
+ ti->info.notif_enabled = false;
+ ti->info.current_mode = SCMI_TLM_ONDEMAND;
+ ti->info.active_update_interval = 0;
+
+ /* Get rinfo as it is...without triggering an enumeration */
+ rinfo = __scmi_telemetry_resources_get(ti);
+
+ /* Clear all local state...*/
+ for (int i = 0; i < rinfo->num_des; i++) {
+ struct telemetry_de *tde = to_tde(rinfo->des[i]);
+
+ scoped_guard(mutex, &tde->mtx) {
+ tde->last_ts = 0;
+ tde->last_val = 0;
+ tde->last_magic = 0;
+ if (!tde->de.fc_support) {
+ tde->sid = SHMTI_ID_INVALID;
+ tde->base = NULL;
+ tde->offset = 0;
+ tde->eplg = NULL;
+ }
+
+ scmi_telemetry_de_state_update(ti, ENA_STATE,
+ &tde->de.enabled, false);
+
+ if (tde->de.tstamp_support)
+ scmi_telemetry_de_state_update(ti, ENA_TSTAMP,
+ &tde->de.tstamp_enabled,
+ false);
+ }
+
+ /*
+ * Unlinking ONLY BLK_TS lines since, per the SCMI spec, the
+ * UUID/DE associations are permanent within the same session
+ * boot: after a reset has cleared the server-side configuration
+ * the next time SHMTIs will be re-populated, these same UUID/DE
+ * associations will be re-instated.
+ */
+ scmi_telemetry_blkts_unlink(tde);
+ }
+
+ for (int i = 0; i < rinfo->num_groups; i++) {
+ rinfo->grps[i].enabled = false;
+ rinfo->grps[i].tstamp_enabled = false;
+ rinfo->grps[i].current_mode = SCMI_TLM_ONDEMAND;
+ rinfo->grps[i].active_update_interval = 0;
+ }
+}
+
+static int scmi_telemetry_reset(const struct scmi_protocol_handle *ph)
+{
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = ph->xops->xfer_get_init(ph, TELEMETRY_RESET, sizeof(u32), 0, &t);
+ if (ret)
+ return ret;
+
+ put_unaligned_le32(0, t->tx.buf);
+ ret = ph->xops->do_xfer(ph, t);
+ if (!ret) {
+ struct telemetry_info *ti = ph->get_priv(ph);
+
+ scmi_telemetry_local_resources_reset(ti);
+ }
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
static const struct scmi_telemetry_proto_ops tlm_proto_ops = {
.info_get = scmi_telemetry_info_get,
.de_lookup = scmi_telemetry_de_lookup,
@@ -3148,6 +3227,7 @@ static const struct scmi_telemetry_proto_ops tlm_proto_ops = {
.de_data_read = scmi_telemetry_de_data_read,
.des_bulk_read = scmi_telemetry_des_bulk_read,
.des_sample_get = scmi_telemetry_des_sample_get,
+ .reset = scmi_telemetry_reset,
};
/**
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index c401d04758c5..5a2787b30120 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -1016,6 +1016,7 @@ struct scmi_telemetry_de_sample {
* the ones belonging to a specific group when provided.
* This causes an immediate update platform-side of all the
* enabled DEs.
+ * @reset: reset configuration and telemetry data.
*/
struct scmi_telemetry_proto_ops {
const struct scmi_telemetry_info __must_check *(*info_get)
@@ -1043,6 +1044,7 @@ struct scmi_telemetry_proto_ops {
int __must_check (*des_sample_get)(const struct scmi_protocol_handle *ph,
int grp_id, int *num_samples,
struct scmi_telemetry_de_sample *samples);
+ int (*reset)(const struct scmi_protocol_handle *ph);
};
/**
--
2.54.0
next prev parent reply other threads:[~2026-09-20 9:20 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 9:19 [PATCH v12 00/25] Introduce SCMI Telemetry support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 01/25] firmware: arm_scmi: Add new SCMIv4.0 error codes definitions Cristian Marussi
2026-09-22 12:20 ` David Hildenbrand (Arm)
2026-09-22 17:32 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 02/25] firmware: arm_scmi: Allow registration of unknown-size events/reports Cristian Marussi
2026-09-22 13:15 ` David Hildenbrand (Arm)
2026-09-23 10:55 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 03/25] firmware: arm_scmi: Introduce protocol instance notifiers Cristian Marussi
2026-09-22 13:44 ` David Hildenbrand (Arm)
2026-09-23 15:03 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 04/25] dt-bindings: firmware: arm,scmi: Add support for telemetry protocol Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 05/25] include: trace: Add Telemetry trace events Cristian Marussi
2026-09-22 13:48 ` David Hildenbrand (Arm)
2026-09-23 12:02 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 06/25] firmware: arm_scmi: Add basic Telemetry support Cristian Marussi
2026-09-22 14:42 ` David Hildenbrand (Arm)
2026-09-23 14:43 ` Cristian Marussi
2026-09-28 20:01 ` Jonathan Cameron
2026-09-29 16:10 ` Jonathan Cameron
2026-10-04 8:28 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 07/25] firmware: arm_scmi: Add support to parse SHMTIs areas Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 08/25] firmware: arm_scmi: Add Telemetry configuration operations Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 09/25] firmware: arm_scmi: Add Telemetry DataEvent read capabilities Cristian Marussi
2026-09-20 9:19 ` Cristian Marussi [this message]
2026-09-20 9:19 ` [PATCH v12 11/25] firmware: arm_scmi: Add Telemetry notification support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 12/25] firmware: arm_scmi: Add support for boot-on Telemetry Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 13/25] firmware: arm-scmi: Add telemetry generic event support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 14/25] firmware: arm_scmi: Add Telemetry generation counter event Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 15/25] firmware: arm_scmi: Add common per-protocol debugfs support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 16/25] firmware: arm_scmi: Add Telemetry debugfs SHMTI dump support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 17/25] firmware: arm_scmi: Add Telemetry debugfs ABI documentation Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 18/25] firmware: arm_scmi: Expose per-instance identifier Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 19/25] firmware: arm_scmi: Add un-managed methods to get/put protocols operations Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 20/25] uapi: Add ARM SCMI Telemetry definitions Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 21/25] firmware: arm_scmi: Add System Telemetry driver Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 22/25] docs: ioctl-number: Add SCMI Ioctls Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 23/25] [RFC] Documentation: Add SCMI System Telemetry documentation Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 24/25] [RFC] tools/scmi: Add SCMI Telemetry testing tool Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 25/25] [RFC] kselftest/arm64: Add SCMI Telemetry UAPI compliance testcases 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=20260920091928.2014972-11-cristian.marussi@arm.com \
--to=cristian.marussi@arm.com \
--cc=arm-scmi@vger.kernel.org \
--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=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