Add a number of structures and ioctls definitions used by the ARM
SCMI Telemetry protocol.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
MAINTAINERS | 1 +
include/uapi/linux/scmi.h | 286 ++++++++++++++++++++++++++++++++++++++
2 files changed, 287 insertions(+)
create mode 100644 include/uapi/linux/scmi.h
diff --git a/MAINTAINERS b/MAINTAINERS
index f6206963efbf..5c10e096e638 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -24552,6 +24552,7 @@ F: drivers/regulator/scmi-regulator.c
F: drivers/reset/reset-scmi.c
F: include/linux/sc[mp]i_protocol.h
F: include/trace/events/scmi.h
+F: include/uapi/linux/scmi.h
F: include/uapi/linux/virtio_scmi.h
SYSTEM CONTROL MANAGEMENT INTERFACE (SCMI) i.MX Extension Message Protocol drivers
diff --git a/include/uapi/linux/scmi.h b/include/uapi/linux/scmi.h
new file mode 100644
index 000000000000..b1a6d34fee4a
--- /dev/null
+++ b/include/uapi/linux/scmi.h
@@ -0,0 +1,286 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Copyright (C) 2025 ARM Ltd.
+ */
+#ifndef _UAPI_LINUX_SCMI_H
+#define _UAPI_LINUX_SCMI_H
+
+/*
+ * Userspace interface SCMI Telemetry
+ */
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define SCMI_TLM_DE_IMPL_MAX_DWORDS 4
+
+#define SCMI_TLM_GRP_INVALID 0xFFFFFFFF
+
+/**
+ * scmi_tlm_base_info - Basic info about an instance
+ *
+ * @version: SCMI Telemetry protocol version
+ * @de_impl_version: SCMI Telemetry DE implementation revision
+ * @num_de: Number of defined DEs
+ * @num_groups Number of defined DEs groups
+ * @num_intervals: Number of update intervals available (instance-level)
+ * @flags: Instance specific feature-support bitmap
+ *
+ * Used by:
+ * RO - SCMI_TLM_GET_INFO
+ *
+ * Supported by:
+ * control/
+ */
+struct scmi_tlm_base_info {
+ __u32 version;
+ __u32 de_impl_version[SCMI_TLM_DE_IMPL_MAX_DWORDS];
+ __u32 num_des;
+ __u32 num_groups;
+ __u32 num_intervals;
+ __u32 flags;
+#define SCMI_TLM_CAN_RESET (1 << 0)
+///TODO more flags
+};
+
+/**
+ * scmi_tlm_config - Whole instance or group configuration
+ *
+ * @enable: Enable/Disable Telemetry for the whole instance or the group
+ * @t_enable: Enable/Disable timestamping for all the DEs belonging to a group.
+ * @current_update_interval: Get/Set currently active update interval for the
+ * whole instance or a group.
+ *
+ * Used by:
+ * RO - SCMI_TLM_GET_CFG
+ * WO - SCMI_TLM_SET_CFG
+ *
+ * Supported by:
+ * control/
+ * groups/<N>/control
+ */
+struct scmi_tlm_config {
+ __u8 enable;
+ __u8 t_enable;
+ __u8 reserved[2];
+ __u32 current_update_interval;
+};
+
+/**
+ * scmi_tlm_intervals - Update intervals descriptor
+ *
+ * @discrete: Flag to indicate the nature of the intervals described in
+ * @update_intervals.
+ * When 'false' @update_intervals is a triplet: min/max/step
+ * @num: Number of entries of @available
+ * @update_intervals: A variably-sized array containing the update intervals
+ *
+ * Used by:
+ * RW - SCMI_TLM_GET_INTRVS
+ *
+ * Supported by:
+ * control/
+ * groups/<N>/control
+ */
+struct scmi_tlm_intervals {
+ __u8 discrete;
+ __u8 reserved[3];
+ __u32 num;
+#define SCMI_TLM_UPDATE_INTVL_SEGMENT_LOW 0
+#define SCMI_TLM_UPDATE_INTVL_SEGMENT_HIGH 1
+#define SCMI_TLM_UPDATE_INTVL_SEGMENT_STEP 2
+ __u32 update_intervals[];
+};
+
+/**
+ * scmi_tlm_de_config - DE configuration
+ *
+ * @id: Identifier of the DE to act upon (ignored by SCMI_TLM_SET_ALL_CFG)
+ * @enable: A boolean to enable/disable the DE
+ * @t_enable: A boolean to enable/disable the timestamp for this DE
+ * (if supported)
+ *
+ * Used by:
+ * RW - SCMI_TLM_GET_DE_CFG
+ * RW - SCMI_TLM_SET_DE_CFG
+ * WO - SCMI_TLM_SET_ALL_CFG
+ *
+ * Supported by:
+ * control/
+ */
+struct scmi_tlm_de_config {
+ __u32 id;
+ __u32 enable;
+ __u32 t_enable;
+};
+
+/**
+ * scmi_tlm_de_info - DE Descriptor
+ *
+ * @id: DE identifier
+ * @grp_id: Identifier of the group which this DE belongs to; reported as
+ * SCMI_TLM_GRP_INVALID when not part of any group
+ * @data_sz: DE data size in bytes
+ * @type: DE type
+ * @unit: DE unit of measurements
+ * @unit_exp: Power-of-10 multiplier for DE unit
+ * @tstamp_exp: Power-of-10 multiplier for DE timestamp (if supported)
+ * @instance_id: DE instance ID
+ * @compo_instance_id: DE component instance ID
+ * @compo_type: Type of component which is associated to this DE
+ * @peristent: Data value for this DE survives reboot (non-cold ones)
+ * @name: Optional name of this DE
+ *
+ * Used to get the full description of a DE: it reflects DE Descriptors
+ * definitions in 3.12.4.6.
+ *
+ * Used by:
+ * RW - SCMI_TLM_GET_DE_INFO
+ *
+ * Supported by:
+ * control/
+ */
+struct scmi_tlm_de_info {
+ __u32 id;
+ __u32 grp_id;
+ __u32 data_sz;
+ __u32 type;
+ __u32 unit;
+ __s32 unit_exp;
+ __s32 tstamp_exp;
+ __u32 instance_id;
+ __u32 compo_instance_id;
+ __u32 compo_type;
+ __u32 persistent;
+ __u8 name[16];
+};
+
+/**
+ * scmi_tlm_des_list - List of all defined DEs
+ *
+ * @num_des: Number of entries in @des
+ * @des: An array containing descriptors for all defined DEs
+ *
+ * Used by:
+ * RW - SCMI_TLM_GET_DE_LIST
+ *
+ * Supported by:
+ * control/
+ */
+struct scmi_tlm_des_list {
+ __u32 num_des;
+ struct scmi_tlm_de_info des[];
+};
+
+/**
+ * scmi_tlm_de_sample - A DE reading
+ *
+ * @id: DE identifier
+ * @tstamp: DE reading timestamp (equal 0 is NOT supported)
+ * @val: Reading of the DE data value
+ *
+ * Used by:
+ * RW - SCMI_TLM_GET_DE_VALUE
+ *
+ * Supported by:
+ * control/
+ */
+struct scmi_tlm_de_sample {
+ __u32 id;
+ __u64 tstamp;
+ __u64 val;
+};
+
+/**
+ * scmi_tlm_data_read - Bulk read of multiple DEs
+ *
+ * @num_samples: Number of entries returned in @samples
+ * @samples: An array of samples containing an entry for each DE that was
+ * enabled when the single sample read request was issued.
+ *
+ * Used by:
+ * RW - SCMI_TLM_SINGLE_SAMPLE
+ * RW - SCMI_TLM_BULK_READ
+ *
+ * Supported by:
+ * control/
+ * groups/<N>/control
+ */
+struct scmi_tlm_data_read {
+ __u32 num_samples;
+ struct scmi_tlm_de_sample samples[];
+};
+
+/**
+ * scmi_tlm_grp_info - DE-group descriptor
+ *
+ * @id: Group ID number
+ * @num_des: Number of DEs part of this group
+ * @num_intervals: Number of update intervals supported. Zero if group does not
+ * support per-group update interval configuration.
+ *
+ * Used by:
+ * RO - SCMI_TLM_GET_GRP_INFO
+ *
+ * Supported by:
+ * groups/<N>control/
+ */
+struct scmi_tlm_grp_info {
+ __u32 id;
+ __u32 num_des;
+ __u32 num_intervals;
+};
+
+/**
+ * scmi_tlm_grps_list - DE-groups List
+ *
+ * @num_grps: Number of entries returned in @grps
+ * @grps: An array containing descriptors for all defined DE Groups
+ *
+ * Used by:
+ * RW - SCMI_TLM_GET_GRP_LIST
+ *
+ * Supported by:
+ * control/
+ */
+struct scmi_tlm_grps_list {
+ __u32 num_grps;
+ struct scmi_tlm_grp_info grps[];
+};
+
+/**
+ * scmi_tlm_grp_desc - Group descriptor
+ *
+ * @num_des: Number of DEs part of this group
+ * @composing_des: An array containing the DE IDs that belongs to this group.
+ *
+ * Used by:
+ * RW - SCMI_TLM_GET_GRP_DESC
+ *
+ * Supported by:
+ * groups/<N>control/
+ */
+struct scmi_tlm_grp_desc {
+ __u32 num_des;
+ __u32 composing_des[];
+};
+
+#define SCMI 0xF1
+
+#define SCMI_TLM_GET_INFO _IOR(SCMI, 0x00, struct scmi_tlm_base_info)
+#define SCMI_TLM_GET_CFG _IOR(SCMI, 0x01, struct scmi_tlm_config)
+#define SCMI_TLM_SET_CFG _IOW(SCMI, 0x02, struct scmi_tlm_config)
+#define SCMI_TLM_GET_INTRVS _IOWR(SCMI, 0x03, struct scmi_tlm_intervals)
+#define SCMI_TLM_GET_DE_CFG _IOWR(SCMI, 0x04, struct scmi_tlm_de_config)
+#define SCMI_TLM_SET_DE_CFG _IOWR(SCMI, 0x05, struct scmi_tlm_de_config)
+#define SCMI_TLM_GET_DE_INFO _IOWR(SCMI, 0x06, struct scmi_tlm_de_info)
+#define SCMI_TLM_GET_DE_LIST _IOWR(SCMI, 0x07, struct scmi_tlm_des_list)
+#define SCMI_TLM_GET_DE_VALUE _IOWR(SCMI, 0x08, struct scmi_tlm_de_sample)
+#define SCMI_TLM_SET_ALL_CFG _IOW(SCMI, 0x09, struct scmi_tlm_de_config)
+#define SCMI_TLM_GET_GRP_LIST _IOWR(SCMI, 0x0A, struct scmi_tlm_grps_list)
+#define SCMI_TLM_GET_GRP_INFO _IOR(SCMI, 0x0B, struct scmi_tlm_grp_info)
+#define SCMI_TLM_GET_GRP_DESC _IOWR(SCMI, 0x0C, struct scmi_tlm_grp_desc)
+#define SCMI_TLM_SINGLE_SAMPLE _IOWR(SCMI, 0x0D, struct scmi_tlm_data_read)
+#define SCMI_TLM_BULK_READ _IOWR(SCMI, 0x0E, struct scmi_tlm_data_read)
+
+#endif /* _UAPI_LINUX_SCMI_H */
--
2.51.0
On Thu, 25 Sep 2025 21:35:48 +0100
Cristian Marussi <cristian.marussi@arm.com> wrote:
> Add a number of structures and ioctls definitions used by the ARM
> SCMI Telemetry protocol.
>
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Hi Cristian,
Main thing in here is request to add __counted_by markings for the flexible array members.
> SYSTEM CONTROL MANAGEMENT INTERFACE (SCMI) i.MX Extension Message Protocol drivers
> diff --git a/include/uapi/linux/scmi.h b/include/uapi/linux/scmi.h
> new file mode 100644
> index 000000000000..b1a6d34fee4a
> --- /dev/null
> +++ b/include/uapi/linux/scmi.h
> @@ -0,0 +1,286 @@
> +
> +/**
> + * scmi_tlm_config - Whole instance or group configuration
> + *
> + * @enable: Enable/Disable Telemetry for the whole instance or the group
> + * @t_enable: Enable/Disable timestamping for all the DEs belonging to a group.
I'm fairly sure that even for reserved the kernel-doc script will complain if no
documentation. (I haven't checked if it special cases that though!)
> + * @current_update_interval: Get/Set currently active update interval for the
> + * whole instance or a group.
> + *
> + * Used by:
> + * RO - SCMI_TLM_GET_CFG
> + * WO - SCMI_TLM_SET_CFG
> + *
> + * Supported by:
> + * control/
> + * groups/<N>/control
> + */
> +struct scmi_tlm_config {
> + __u8 enable;
> + __u8 t_enable;
> + __u8 reserved[2];
> + __u32 current_update_interval;
> +};
> +/**
> + * scmi_tlm_grps_list - DE-groups List
> + *
> + * @num_grps: Number of entries returned in @grps
> + * @grps: An array containing descriptors for all defined DE Groups
> + *
> + * Used by:
> + * RW - SCMI_TLM_GET_GRP_LIST
> + *
> + * Supported by:
> + * control/
> + */
> +struct scmi_tlm_grps_list {
> + __u32 num_grps;
> + struct scmi_tlm_grp_info grps[];
As below on __counted_by
> +};
> +
> +/**
> + * scmi_tlm_grp_desc - Group descriptor
> + *
> + * @num_des: Number of DEs part of this group
> + * @composing_des: An array containing the DE IDs that belongs to this group.
> + *
> + * Used by:
> + * RW - SCMI_TLM_GET_GRP_DESC
> + *
> + * Supported by:
> + * groups/<N>control/
> + */
> +struct scmi_tlm_grp_desc {
> + __u32 num_des;
> + __u32 composing_des[];
If we can give this a __counted_by marking please do.
> +};
On Fri, Oct 17, 2025 at 04:14:01PM +0100, Jonathan Cameron wrote:
> On Thu, 25 Sep 2025 21:35:48 +0100
> Cristian Marussi <cristian.marussi@arm.com> wrote:
>
> > Add a number of structures and ioctls definitions used by the ARM
> > SCMI Telemetry protocol.
> >
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> Hi Cristian,
>
Hi,
> Main thing in here is request to add __counted_by markings for the flexible array members.
...right...missed that completely...
>
> > SYSTEM CONTROL MANAGEMENT INTERFACE (SCMI) i.MX Extension Message Protocol drivers
> > diff --git a/include/uapi/linux/scmi.h b/include/uapi/linux/scmi.h
> > new file mode 100644
> > index 000000000000..b1a6d34fee4a
> > --- /dev/null
> > +++ b/include/uapi/linux/scmi.h
> > @@ -0,0 +1,286 @@
>
> > +
> > +/**
> > + * scmi_tlm_config - Whole instance or group configuration
> > + *
> > + * @enable: Enable/Disable Telemetry for the whole instance or the group
> > + * @t_enable: Enable/Disable timestamping for all the DEs belonging to a group.
> I'm fairly sure that even for reserved the kernel-doc script will complain if no
> documentation. (I haven't checked if it special cases that though!)
Right..
> > + * @current_update_interval: Get/Set currently active update interval for the
> > + * whole instance or a group.
> > + *
> > + * Used by:
> > + * RO - SCMI_TLM_GET_CFG
> > + * WO - SCMI_TLM_SET_CFG
> > + *
> > + * Supported by:
> > + * control/
> > + * groups/<N>/control
> > + */
> > +struct scmi_tlm_config {
> > + __u8 enable;
> > + __u8 t_enable;
> > + __u8 reserved[2];
> > + __u32 current_update_interval;
> > +};
>
> > +/**
> > + * scmi_tlm_grps_list - DE-groups List
> > + *
> > + * @num_grps: Number of entries returned in @grps
> > + * @grps: An array containing descriptors for all defined DE Groups
> > + *
> > + * Used by:
> > + * RW - SCMI_TLM_GET_GRP_LIST
> > + *
> > + * Supported by:
> > + * control/
> > + */
> > +struct scmi_tlm_grps_list {
> > + __u32 num_grps;
> > + struct scmi_tlm_grp_info grps[];
>
> As below on __counted_by
I will add.
>
> > +};
> > +
> > +/**
> > + * scmi_tlm_grp_desc - Group descriptor
> > + *
> > + * @num_des: Number of DEs part of this group
> > + * @composing_des: An array containing the DE IDs that belongs to this group.
> > + *
> > + * Used by:
> > + * RW - SCMI_TLM_GET_GRP_DESC
> > + *
> > + * Supported by:
> > + * groups/<N>control/
> > + */
> > +struct scmi_tlm_grp_desc {
> > + __u32 num_des;
> > + __u32 composing_des[];
>
> If we can give this a __counted_by marking please do.
>
I will.
Thanks,
Cristian
Hi Cristian,
kernel test robot noticed the following build errors:
[auto build test ERROR on soc/for-next]
[also build test ERROR on trace/for-next linus/master v6.17-rc7 next-20250925]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Cristian-Marussi/firmware-arm_scmi-Define-a-common-SCMI_MAX_PROTOCOLS-value/20250926-044350
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link: https://lore.kernel.org/r/20250925203554.482371-5-cristian.marussi%40arm.com
patch subject: [PATCH 04/10] uapi: Add ARM SCMI definitions
config: x86_64-buildonly-randconfig-005-20250926 (https://download.01.org/0day-ci/archive/20250926/202509262227.VZVSICFi-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250926/202509262227.VZVSICFi-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509262227.VZVSICFi-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from <command-line>:
>> ./usr/include/linux/scmi.h:43:1: error: C++ style comments are not allowed in ISO C90
43 | ///TODO more flags
| ^
./usr/include/linux/scmi.h:43:1: note: (this will be reported only once per input file)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.