[PATCH v4 3/4] firmware: imx: Add SC APIs required for secvio module
Krzysztof Kozlowski
krzk at kernel.org
Thu Dec 5 01:15:51 PST 2024
On Thu, Dec 05, 2024 at 05:56:34AM +0100, Vabhav Sharma wrote:
> The Security Violation module requires below System Controller
> Security controller API to interact with SNVS block via SCFW
> - imx_sc_seco_build_info
> - imx_sc_seco_secvio_enable
> - imx_sc_seco_secvio_config
> - imx_sc_seco_secvio_dgo_config
>
> Signed-off-by: Franck LENORMAND <franck.lenormand at nxp.com>
> Reviewed-by: Iuliana Prodan <iuliana.prodan at nxp.com>
> Reviewed-by: Horia Geanta<horia.geanta at nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong at nxp.com>
> Signed-off-by: Vabhav Sharma <vabhav.sharma at nxp.com>
> ---
> drivers/firmware/imx/Makefile | 2 +-
> drivers/firmware/imx/imx-scu.c | 4 +-
> drivers/firmware/imx/seco.c | 216 ++++++++++++++++++++++++++++++++++
> include/linux/firmware/imx/ipc.h | 1 +
> include/linux/firmware/imx/sci.h | 4 +
> include/linux/firmware/imx/svc/seco.h | 69 +++++++++++
> 6 files changed, 294 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile
> index 8d046c341be8..7aaecf570c56 100644
> --- a/drivers/firmware/imx/Makefile
> +++ b/drivers/firmware/imx/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0
> obj-$(CONFIG_IMX_DSP) += imx-dsp.o
> -obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
> +obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o seco.o
> obj-${CONFIG_IMX_SCMI_MISC_DRV} += sm-misc.o
> diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c
> index 1dd4362ef9a3..c96dc73689a8 100644
> --- a/drivers/firmware/imx/imx-scu.c
> +++ b/drivers/firmware/imx/imx-scu.c
> @@ -242,9 +242,11 @@ int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp)
> * APIs are defined as void function in SCU firmware, so they
> * should be treated as return success always.
> */
> - if ((saved_svc == IMX_SC_RPC_SVC_MISC) &&
> + if (((saved_svc == IMX_SC_RPC_SVC_MISC) &&
> (saved_func == IMX_SC_MISC_FUNC_UNIQUE_ID ||
> saved_func == IMX_SC_MISC_FUNC_GET_BUTTON_STATUS))
> + || (saved_svc == IMX_SC_RPC_SVC_SECO &&
> + saved_func == IMX_SC_SECO_FUNC_BUILD_INFO))
> ret = 0;
> }
>
> diff --git a/drivers/firmware/imx/seco.c b/drivers/firmware/imx/seco.c
> new file mode 100644
> index 000000000000..2d6bf301ac87
> --- /dev/null
> +++ b/drivers/firmware/imx/seco.c
> @@ -0,0 +1,216 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2020, 2024 NXP
> + *
> + * File containing client-side RPC functions for the SECO service. These
> + * function are ported to clients that communicate to the SC.
> + */
> +
> +#include <linux/firmware/imx/sci.h>
> +
> +struct imx_sc_msg_seco_get_build_id {
> + struct imx_sc_rpc_msg hdr;
> + u32 version;
> + u32 commit;
> +} __packed __aligned(4);
> +
> +int imx_sc_seco_build_info(struct imx_sc_ipc *ipc, uint32_t *version,
> + uint32_t *commit)
> +{
> + struct imx_sc_msg_seco_get_build_id msg;
> + struct imx_sc_rpc_msg *hdr = &msg.hdr;
> + int ret;
> +
> + hdr->ver = IMX_SC_RPC_VERSION;
> + hdr->svc = IMX_SC_RPC_SVC_SECO;
> + hdr->func = IMX_SC_SECO_FUNC_BUILD_INFO;
> + hdr->size = 1;
> +
> + ret = imx_scu_call_rpc(ipc, &msg, true);
> + if (ret)
> + return ret;
> +
> + if (version)
> + *version = msg.version;
> + if (commit)
> + *commit = msg.commit;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(imx_sc_seco_build_info);
NAK for all your exports: no users. Stop adding exports for your
downstream drivers.
Best regards,
Krzysztof
More information about the linux-arm-kernel
mailing list