Re: [PATCH v15 24/35] firmware: arm_scmi: Add common per-protocol debugfs support
From: Jonathan Cameron
Date: Tue Nov 10 2026 - 17:51:05 EST
On Mon, 9 Nov 2026 09:12:10 +0000
Cristian Marussi <cristian.marussi@xxxxxxx> wrote:
> Allow interested SCMI protocols to register their own specific debugfs
> entries under a common per-instance and per-protocol subtree rooted
> at /sys/kernel/debug/scmi/<N>/protocols/<PROTO_ID>/
>
> Expose a helper to enable protocol initialization code to get access to
> such per-protocol/per-instance dentries in order to be able to install
> their own dedicated debugfs entries.
>
> Per-protocol debugfs support is configurable and default off.
>
> Signed-off-by: Cristian Marussi <cristian.marussi@xxxxxxx>
> ---
> v14 --> v15
> - fix debugfs_remove_recursive call-site...was too early
> v8 --> v9
> - avoid NULL deref on DBG cleanup path
> v5 --> v6
> - bail out of dentry_get helper when SCMI debug susbsytem failed to init
> - remove stale SCMI protocol operations
> - add a preoper clean up of debugfs when protocol init fails
> ---
> drivers/firmware/arm_scmi/Kconfig | 14 +++++++++
> drivers/firmware/arm_scmi/common.h | 2 ++
> drivers/firmware/arm_scmi/driver.c | 42 +++++++++++++++++++++++++--
> drivers/firmware/arm_scmi/protocols.h | 6 ++++
> include/linux/scmi_protocol.h | 1 -
> 5 files changed, 62 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/Kconfig
> index 783c24a20e29..f506c4d1d96a 100644
> --- a/drivers/firmware/arm_scmi/Kconfig
> +++ b/drivers/firmware/arm_scmi/Kconfig
> @@ -69,6 +69,20 @@ config ARM_SCMI_DEBUG_COUNTERS
> such useful debug counters. This can be helpful for debugging and
> SCMI monitoring.
>
> +config ARM_SCMI_DEBUG_PROTOCOLS
> + bool "Enable SCMI protocols debug"
> + select ARM_SCMI_NEED_DEBUGFS
> + depends on DEBUG_FS
> + default n
default of default is n, so no need. By all means add some text
to discourage distros from enabling it.
> + help
> + Enables per-protocol specific debug features, where available.
> + When provided, such per-protocol debugfs entries are grouped
> + inside a common a subtree named by the protocol number and rooted
> + under a per-instance 'protocols' directory.
> +
> + Such per-protocol entries subtree structure is freely defined
> + within the related protocol code.
> +
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index c1f503c6e72c..8a4664165a64 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
> index 585eb3a4684e..ed3eaa1482a3 100644
> --- a/include/linux/scmi_protocol.h
> +++ b/include/linux/scmi_protocol.h
> @@ -1164,7 +1164,6 @@ struct scmi_handle {
> void (*devm_protocol_put)(struct scmi_device *sdev, u8 proto);
> bool (*is_transport_atomic)(const struct scmi_handle *handle,
> unsigned int *atomic_threshold);
> -
Unrelated. Scrub for this stuff before sending new versions. Saves time
all round for a minute or two sanity checking.
> const struct scmi_notify_ops *notify_ops;
> };
>