Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Cristian Marussi <cristian.marussi@arm.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
	linux-doc@vger.kernel.org, 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,
	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
Subject: Re: [PATCH v14 07/32] firmware: arm_scmi: Add Telemetry basic attributes enumeration
Date: Mon, 19 Oct 2026 14:27:19 -0700	[thread overview]
Message-ID: <20261019142719.00003b78@oss.qualcomm.com> (raw)
In-Reply-To: <20261016185553.2794459-8-cristian.marussi@arm.com>

On Fri, 16 Oct 2026 19:55:28 +0100
Cristian Marussi <cristian.marussi@arm.com> wrote:

> Add SCMIv4.0 Telemetry basic support for minimal initialization and
> protocol attributes enumeration: expose telemetry instance descriptor
> via a simple information retrieval protocol operation.
> 
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

A few minor comments but nothing I care strongly about.
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

>  #endif /* _SCMI_PROTOCOLS_H */
> diff --git a/drivers/firmware/arm_scmi/telemetry.c b/drivers/firmware/arm_scmi/telemetry.c
> new file mode 100644
> index 000000000000..32f6f8d1106d
> --- /dev/null
> +++ b/drivers/firmware/arm_scmi/telemetry.c
> @@ -0,0 +1,148 @@

> +
> +enum scmi_telemetry_protocol_cmd {

Perhaps add a comment on enum scmi_common_cmd containing additional values
that apply to telemetry.

> +	TELEMETRY_LIST_SHMTI = 0x3,

> +
> +struct telemetry_info {
> +	bool streaming_mode;

I'd bring fields of internal tracking structures in only when
they are used (even if that is just setting them).

> +	unsigned int num_shmti;
> +	unsigned int num_des_tstamp;
> +	unsigned int default_blk_ts_rate;
> +	const struct scmi_protocol_handle *ph;
> +	struct scmi_telemetry_info info;
> +};
> +
> +static int
> +scmi_telemetry_protocol_attributes_get(struct telemetry_info *ti)
> +{
> +	struct scmi_msg_resp_telemetry_protocol_attributes *resp;
> +	const struct scmi_protocol_handle *ph = ti->ph;
> +	struct scmi_xfer *t;
> +	int ret;
> +
> +	ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0,
> +				      sizeof(*resp), &t);
> +	if (ret)
> +		return ret;
> +
> +	resp = t->rx.buf;
> +	ret = ph->xops->do_xfer(ph, t);
> +	if (!ret) {
> +		__le32 attr = resp->attributes_1;
> +		__be32 de_impl_version[SCMI_TLM_DE_IMPL_NUM_DWORDS];
> +

> +		for (int i = 0; i < SCMI_TLM_DE_IMPL_NUM_DWORDS; i++)
> +			de_impl_version[i] =
> +				cpu_to_be32(le32_to_cpu(resp->de_implem_rev_dword[i]));

That dance is a swap as data is stored le but UUID fields are be.
Maybe going via cpu endian is fine as would be silly to have le32_to_be32()
so it perhaps has documentation value.  Fair enough - I argued myself around
with agreeing with how you did it here, but left the discussion for anyone
else who has similar thoughts.

> +		import_uuid(&ti->info.base.primary_revision, (const __u8 *)&de_impl_version);
> +		ti->info.single_read_support = SUPPORTS_SINGLE_READ(attr);
> +		ti->info.continuous_update_support = SUPPORTS_CONTINUOS_UPDATE(attr);
> +		ti->info.per_group_config_support = SUPPORTS_PER_GROUP_CONFIG(attr);
> +		ti->info.reset_support = SUPPORTS_RESET(attr);
> +		ti->info.fc_support = SUPPORTS_FC(attr);
> +		ti->num_shmti = le32_get_bits(attr, GENMASK(15, 0));
> +		ti->default_blk_ts_rate = le32_to_cpu(resp->default_blk_ts_rate);
> +	}
> +
> +	ph->xops->xfer_put(ph, t);
> +
> +	return ret;
> +}

> diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
> index 5ab73b1ab9aa..121c83e1c6d8 100644
> --- a/include/linux/scmi_protocol.h
> +++ b/include/linux/scmi_protocol.h

...


> +/**
> + * struct scmi_telemetry_proto_ops - represents the various operations provided
> + *	by SCMI Telemetry Protocol
> + *
> + * @info_get: get the general Telemetry information.
> + */
> +struct scmi_telemetry_proto_ops {
info> +	const struct scmi_telemetry_info __must_check *(*info_get)
> +		(const struct scmi_protocol_handle *ph);

Why __must_check?  Be a bit crazy if no one did anything with the
info they just requested, so that seems overkill and doesn't help with
the long line.

> +};
> +



  reply	other threads:[~2026-10-19 21:27 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 18:55 [PATCH v14 00/32] Introduce SCMI Telemetry support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 01/32] firmware: arm_scmi: Add new SCMIv4.0 error codes definitions Cristian Marussi
2026-10-19 20:34   ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 02/32] firmware: arm_scmi: Allow registration of unknown-size events/reports Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 03/32] firmware: arm_scmi: Refactor __scmi_event_handler_get_ops helper Cristian Marussi
2026-10-19 20:46   ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 04/32] firmware: arm_scmi: Introduce protocol instance notifiers Cristian Marussi
2026-10-19 21:02   ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 05/32] dt-bindings: firmware: arm,scmi: Add support for telemetry protocol Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 06/32] include: trace: Add Telemetry trace events Cristian Marussi
2026-10-19 21:03   ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 07/32] firmware: arm_scmi: Add Telemetry basic attributes enumeration Cristian Marussi
2026-10-19 21:27   ` Jonathan Cameron [this message]
2026-10-16 18:55 ` [PATCH v14 08/32] firmware: arm_scmi: Add Telemetry resources enumeration Cristian Marussi
2026-10-19 23:28   ` Jonathan Cameron
2026-10-16 18:55 ` [PATCH v14 09/32] firmware: arm_scmi: Add Telemetry groups initialization Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 10/32] firmware: arm_scmi: Add Telemetry update intervals enumeration Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 11/32] firmware: arm_scmi: Add Telemetry SHMTI areas enumeration Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 12/32] firmware: arm_scmi: Add Telemetry TDCF areas parsing support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 13/32] firmware: arm_scmi: Add Telemetry TDCF parsing for BLK_TS lines Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 14/32] firmware: arm_scmi: Add Telemetry TDCF parsing for UUID lines Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 15/32] firmware: arm_scmi: Add Telemetry configuration operations Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 16/32] firmware: arm_scmi: Add Telemetry DataEvent read capabilities Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 17/32] firmware: arm_scmi: Add Telemetry reset logic Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 18/32] firmware: arm_scmi: Add Telemetry notification support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 19/32] firmware: arm_scmi: Add Telemetry boot-on support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 20/32] firmware: arm-scmi: Add Telemetry generic event support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 21/32] firmware: arm_scmi: Add Telemetry generation counter event Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 22/32] firmware: arm_scmi: Add common per-protocol debugfs support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 23/32] firmware: arm_scmi: Add Telemetry debugfs SHMTI dump support Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 24/32] firmware: arm_scmi: Add Telemetry debugfs ABI documentation Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 25/32] firmware: arm_scmi: Expose per-instance identifier Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 26/32] firmware: arm_scmi: Add un-managed methods to get/put protocols operations Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 27/32] uapi: Add ARM SCMI Telemetry definitions Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 28/32] firmware: arm_scmi: Add System Telemetry driver Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 29/32] docs: ioctl-number: Add SCMI Ioctls Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 30/32] [RFC] Documentation: Add SCMI System Telemetry documentation Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 31/32] [RFC] tools/testing/scmi: Add SCMI Telemetry testing tool Cristian Marussi
2026-10-16 18:55 ` [PATCH v14 32/32] 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=20261019142719.00003b78@oss.qualcomm.com \
    --to=jonathan.cameron@oss.qualcomm.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=cristian.marussi@arm.com \
    --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=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