RE: [PATCH v2 6/8] firmware: arm_scmi: Make OPTEE transport a standalone driver

From: Peng Fan
Date: Thu Jul 11 2024 - 08:58:11 EST


> Subject: [PATCH v2 6/8] firmware: arm_scmi: Make OPTEE transport a
> standalone driver
>
> Make SCMI OPTEE transport a standalone driver that can be optionally
> loaded as a module.
>
> CC: Etienne Carriere <etienne.carriere@xxxxxxxxxxx>
> Signed-off-by: Cristian Marussi <cristian.marussi@xxxxxxx>
> ---
> v1 --> v2
> - handle platform_driver_register() failures
> ---
> drivers/firmware/arm_scmi/Kconfig | 6 +-
> drivers/firmware/arm_scmi/Makefile | 2 +-
> drivers/firmware/arm_scmi/common.h | 3 -
> drivers/firmware/arm_scmi/driver.c | 3 -
> .../{optee.c => scmi_transport_optee.c} | 91 ++++++++++---------
> 5 files changed, 52 insertions(+), 53 deletions(-) rename
> drivers/firmware/arm_scmi/{optee.c => scmi_transport_optee.c} (90%)
>
> diff --git a/drivers/firmware/arm_scmi/Kconfig
> b/drivers/firmware/arm_scmi/Kconfig
> index a4d44ef8bf45..def7e3f09356 100644
> --- a/drivers/firmware/arm_scmi/Kconfig
> +++ b/drivers/firmware/arm_scmi/Kconfig
> @@ -89,8 +89,8 @@ config ARM_SCMI_TRANSPORT_MAILBOX
> will be called scmi_transport_mailbox.
>
> config ARM_SCMI_TRANSPORT_OPTEE
> - bool "SCMI transport based on OP-TEE service"
> - depends on OPTEE=y || OPTEE=ARM_SCMI_PROTOCOL
> + tristate "SCMI transport based on OP-TEE service"
> + depends on OPTEE
> select ARM_SCMI_HAVE_TRANSPORT
> select ARM_SCMI_HAVE_SHMEM
> select ARM_SCMI_HAVE_MSG
> @@ -100,6 +100,8 @@ config ARM_SCMI_TRANSPORT_OPTEE
>
> If you want the ARM SCMI PROTOCOL stack to include
> support for a
> transport based on OP-TEE SCMI service, answer Y.
> + This driver can also be built as a module. If so, the module
> + will be called scmi_transport_optee.
>
> config ARM_SCMI_TRANSPORT_SMC
> tristate "SCMI transport based on SMC"
> diff --git a/drivers/firmware/arm_scmi/Makefile
> b/drivers/firmware/arm_scmi/Makefile
> index 6868a47fa4ab..b04119ce972f 100644
> --- a/drivers/firmware/arm_scmi/Makefile
> +++ b/drivers/firmware/arm_scmi/Makefile
> @@ -7,13 +7,13 @@ scmi-driver-
> $(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT) += raw_mode.o
> scmi-transport-$(CONFIG_ARM_SCMI_HAVE_SHMEM) = shmem.o
> scmi-transport-$(CONFIG_ARM_SCMI_HAVE_MSG) += msg.o
> scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_VIRTIO) += virtio.o
> -scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) += optee.o
> scmi-protocols-y := base.o clock.o perf.o power.o reset.o sensors.o
> system.o voltage.o powercap.o scmi-protocols-y += pinctrl.o scmi-
> module-objs := $(scmi-driver-y) $(scmi-protocols-y) $(scmi-transport-y)
>
> obj-$(CONFIG_ARM_SCMI_TRANSPORT_SMC) +=
> scmi_transport_smc.o
> obj-$(CONFIG_ARM_SCMI_TRANSPORT_MAILBOX) +=
> scmi_transport_mailbox.o
> +obj-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) +=
> scmi_transport_optee.o
>
> obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o
> obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-module.o diff --git
> a/drivers/firmware/arm_scmi/common.h
> b/drivers/firmware/arm_scmi/common.h
> index edb786cde25c..0ce1d804b3fc 100644
> --- a/drivers/firmware/arm_scmi/common.h
> +++ b/drivers/firmware/arm_scmi/common.h
> @@ -289,9 +289,6 @@ int
> scmi_xfer_raw_wait_for_message_response(struct scmi_chan_info
> *cinfo, #ifdef CONFIG_ARM_SCMI_TRANSPORT_VIRTIO extern const
> struct scmi_desc scmi_virtio_desc; #endif -#ifdef
> CONFIG_ARM_SCMI_TRANSPORT_OPTEE -extern const struct
> scmi_desc scmi_optee_desc; -#endif
>
> void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr,
> void *priv);
>
> diff --git a/drivers/firmware/arm_scmi/driver.c
> b/drivers/firmware/arm_scmi/driver.c
> index b14c5326930a..67b416c7f2f5 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -3251,9 +3251,6 @@ ATTRIBUTE_GROUPS(versions);
>
> /* Each compatible listed below must have descriptor associated with
> it */ static const struct of_device_id scmi_of_match[] = { -#ifdef
> CONFIG_ARM_SCMI_TRANSPORT_OPTEE
> - { .compatible = "linaro,scmi-optee", .data =
> &scmi_optee_desc },
> -#endif
> #ifdef CONFIG_ARM_SCMI_TRANSPORT_VIRTIO
> { .compatible = "arm,scmi-virtio", .data = &scmi_virtio_desc},
> #endif diff --git a/drivers/firmware/arm_scmi/optee.c
> b/drivers/firmware/arm_scmi/scmi_transport_optee.c
> similarity index 90%
> rename from drivers/firmware/arm_scmi/optee.c rename to
> drivers/firmware/arm_scmi/scmi_transport_optee.c
> index 99f3b0bfb956..7a16c8d3e213 100644
> --- a/drivers/firmware/arm_scmi/optee.c
> +++ b/drivers/firmware/arm_scmi/scmi_transport_optee.c
> @@ -1,6 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> /*
> - * Copyright (C) 2019-2021 Linaro Ltd.
> + * Copyright (C) 2019-2024 Linaro Ltd.

This should be kept unchanged?

Regards,
Peng.