From patchwork Thu Nov 28 08:42:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Pouliquen X-Patchwork-Id: 13887796 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD6B1D690ED for ; Thu, 28 Nov 2024 08:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=f0OxH3wtdemYyz01Yb+Te/k2HhBq/Vf5wfmG702w8ds=; b=AcIXTkZndb4MvBGYh4Q0dNtlDt emRFIi1FsY/mHRLP74wOSuQaAk0hTKHsmtoCpUT/SvtNcAyzWS2g4fBsM8UnrdydUFnNHSPWkugxL W6hXiWgvfvRokrzUn/VoghMhfCjzEQ7bF/ZiOQd1XpDL2gdsu612raaF+2VMau3aK81fkKHlfgV/y iXXALEHXKyuMEckeM4EL71kObpDwY99ZUXENy8Kq0KcxGjkGkdpR3nD+35CO1bvQcPUI8DWq5IHDL SIL4q/qm6w8aX5kxCiE6LIrULTNj36Ae207HLo5qjaU1zbaGnqUoxjyLlS3P/rBrmKHEvh1sHiBnw IXNav5hQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tGaJg-0000000F53I-2MIi; Thu, 28 Nov 2024 08:56:04 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tGaDO-0000000F3oJ-0giw; Thu, 28 Nov 2024 08:49:35 +0000 Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AS20fp6032587; Thu, 28 Nov 2024 09:49:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= f0OxH3wtdemYyz01Yb+Te/k2HhBq/Vf5wfmG702w8ds=; b=lenFKO0cjBOcKClN 3jZQ8Xva9eGXdMPgxgvNBwicqik6OpsLQoGvA3oJPyskO+Cp+pc/o/vG+yPuYceh /a4+2jsMWRKbIzcyTYejBna410M46nvm1MiaqZCUGCj9XdGBg9ZuDS4tS222icL7 y3AmgjT4oSyj8dzdnnQ/cD7RZzUjcu9IAvNb/KnybAaVgC96DDwje9O30SJQf3gi muzGBrubh3NNTS22Sp0CPeBQjPuxOh4evjk3KqrFmuvr/dwhwsAgwbmY4FbKeBz5 /MEoSBYP9yeCzq2m73CBnkRYiq4yDu/K3AcCMhp0bm0kH153UKO0LPSC1e3UJB2i DUqfpg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 436713k67r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Nov 2024 09:49:19 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 42D234005E; Thu, 28 Nov 2024 09:47:25 +0100 (CET) Received: from Webmail-eu.st.com (eqndag1node5.st.com [10.75.129.134]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BEB49269609; Thu, 28 Nov 2024 09:43:00 +0100 (CET) Received: from SAFDAG1NODE1.st.com (10.75.90.17) by EQNDAG1NODE5.st.com (10.75.129.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:00 +0100 Received: from localhost (10.48.86.121) by SAFDAG1NODE1.st.com (10.75.90.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:00 +0100 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Neil Armstrong , Kevin Hilman , "Jerome Brunet" , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Patrice Chotard , Maxime Coquelin , Alexandre Torgue CC: Arnaud Pouliquen , kernel test robot , , , , , , , , Subject: [PATCH v15 4/8] remoteproc: Rename load() operation to load_segments() in rproc_ops struct Date: Thu, 28 Nov 2024 09:42:11 +0100 Message-ID: <20241128084219.2159197-5-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> References: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.48.86.121] X-ClientProxiedBy: SAFCAS1NODE1.st.com (10.75.90.11) To SAFDAG1NODE1.st.com (10.75.90.17) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241128_004934_505881_54A40F69 X-CRM114-Status: GOOD ( 15.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With the introduction of the load_fw() operation in the rproc_ops structure, we need to clarify the difference in the use of the load() and load_fw() ops. The legacy load() is dedicated to loading the ELF segments into memory. Rename this to a more explicit name: load_segments(). Suggested-by: Mathieu Poirier Signed-off-by: Arnaud Pouliquen --- Update vs version V14: Fix: Rename missing load() to load_segments() in drivers/remoteproc/pru_rproc.c. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202411281332.Ra70nJAW-lkp@intel.com/ --- drivers/remoteproc/imx_dsp_rproc.c | 2 +- drivers/remoteproc/imx_rproc.c | 2 +- drivers/remoteproc/meson_mx_ao_arc.c | 2 +- drivers/remoteproc/mtk_scp.c | 2 +- drivers/remoteproc/pru_rproc.c | 2 +- drivers/remoteproc/qcom_q6v5_adsp.c | 2 +- drivers/remoteproc/qcom_q6v5_mss.c | 2 +- drivers/remoteproc/qcom_q6v5_pas.c | 4 ++-- drivers/remoteproc/qcom_q6v5_wcss.c | 4 ++-- drivers/remoteproc/qcom_wcnss.c | 2 +- drivers/remoteproc/rcar_rproc.c | 2 +- drivers/remoteproc/remoteproc_core.c | 4 ++-- drivers/remoteproc/remoteproc_internal.h | 4 ++-- drivers/remoteproc/st_remoteproc.c | 2 +- drivers/remoteproc/st_slim_rproc.c | 2 +- drivers/remoteproc/stm32_rproc.c | 2 +- drivers/remoteproc/xlnx_r5_remoteproc.c | 2 +- include/linux/remoteproc.h | 4 ++-- 18 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c index 376187ad5754..a4a85fbce907 100644 --- a/drivers/remoteproc/imx_dsp_rproc.c +++ b/drivers/remoteproc/imx_dsp_rproc.c @@ -934,7 +934,7 @@ static const struct rproc_ops imx_dsp_rproc_ops = { .start = imx_dsp_rproc_start, .stop = imx_dsp_rproc_stop, .kick = imx_dsp_rproc_kick, - .load = imx_dsp_rproc_elf_load_segments, + .load_segments = imx_dsp_rproc_elf_load_segments, .parse_fw = imx_dsp_rproc_parse_fw, .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, .sanity_check = rproc_elf_sanity_check, diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 800015ff7ff9..f45b3207f7e9 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -681,7 +681,7 @@ static const struct rproc_ops imx_rproc_ops = { .stop = imx_rproc_stop, .kick = imx_rproc_kick, .da_to_va = imx_rproc_da_to_va, - .load = rproc_elf_load_segments, + .load_segments = rproc_elf_load_segments, .parse_fw = imx_rproc_parse_fw, .find_loaded_rsc_table = imx_rproc_elf_find_loaded_rsc_table, .get_loaded_rsc_table = imx_rproc_get_loaded_rsc_table, diff --git a/drivers/remoteproc/meson_mx_ao_arc.c b/drivers/remoteproc/meson_mx_ao_arc.c index f6744b538323..a1c8c0929ce3 100644 --- a/drivers/remoteproc/meson_mx_ao_arc.c +++ b/drivers/remoteproc/meson_mx_ao_arc.c @@ -137,7 +137,7 @@ static struct rproc_ops meson_mx_ao_arc_rproc_ops = { .stop = meson_mx_ao_arc_rproc_stop, .da_to_va = meson_mx_ao_arc_rproc_da_to_va, .get_boot_addr = rproc_elf_get_boot_addr, - .load = rproc_elf_load_segments, + .load_segments = rproc_elf_load_segments, .sanity_check = rproc_elf_sanity_check, }; diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index e744c07507ee..4e9a8bf3bc6e 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -924,7 +924,7 @@ static int scp_stop(struct rproc *rproc) static const struct rproc_ops scp_ops = { .start = scp_start, .stop = scp_stop, - .load = scp_load, + .load_segments = scp_load, .da_to_va = scp_da_to_va, .parse_fw = scp_parse_fw, .sanity_check = rproc_elf_sanity_check, diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 327f0c7ee3d6..0b2bf2574f74 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -1015,7 +1015,7 @@ static int pru_rproc_probe(struct platform_device *pdev) return -ENOMEM; } /* use a custom load function to deal with PRU-specific quirks */ - rproc->ops->load = pru_rproc_load_elf_segments; + rproc->ops->load_segments = pru_rproc_load_elf_segments; /* use a custom parse function to deal with PRU-specific resources */ rproc->ops->parse_fw = pru_rproc_parse_fw; diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 572dcb0f055b..aa9896930bcf 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -527,7 +527,7 @@ static const struct rproc_ops adsp_ops = { .stop = adsp_stop, .da_to_va = adsp_da_to_va, .parse_fw = adsp_parse_firmware, - .load = adsp_load, + .load_segments = adsp_load, .panic = adsp_panic, }; diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 2a42215ce8e0..a8beac1deabe 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -1687,7 +1687,7 @@ static const struct rproc_ops q6v5_ops = { .start = q6v5_start, .stop = q6v5_stop, .parse_fw = qcom_q6v5_register_dump_segments, - .load = q6v5_load, + .load_segments = q6v5_load, .panic = q6v5_panic, }; diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index ef82835e98a4..9b269ce390c1 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -436,7 +436,7 @@ static const struct rproc_ops adsp_ops = { .stop = adsp_stop, .da_to_va = adsp_da_to_va, .parse_fw = qcom_register_dump_segments, - .load = adsp_load, + .load_segments = adsp_load, .panic = adsp_panic, }; @@ -446,7 +446,7 @@ static const struct rproc_ops adsp_minidump_ops = { .stop = adsp_stop, .da_to_va = adsp_da_to_va, .parse_fw = qcom_register_dump_segments, - .load = adsp_load, + .load_segments = adsp_load, .panic = adsp_panic, .coredump = adsp_minidump, }; diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c index e913dabae992..44b5736dc8b9 100644 --- a/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c @@ -771,7 +771,7 @@ static const struct rproc_ops q6v5_wcss_ipq8074_ops = { .start = q6v5_wcss_start, .stop = q6v5_wcss_stop, .da_to_va = q6v5_wcss_da_to_va, - .load = q6v5_wcss_load, + .load_segments = q6v5_wcss_load, .get_boot_addr = rproc_elf_get_boot_addr, }; @@ -779,7 +779,7 @@ static const struct rproc_ops q6v5_wcss_qcs404_ops = { .start = q6v5_qcs404_wcss_start, .stop = q6v5_wcss_stop, .da_to_va = q6v5_wcss_da_to_va, - .load = q6v5_wcss_load, + .load_segments = q6v5_wcss_load, .get_boot_addr = rproc_elf_get_boot_addr, .parse_fw = qcom_register_dump_segments, }; diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index a7bb9da27029..42102bc4c458 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -335,7 +335,7 @@ static const struct rproc_ops wcnss_ops = { .stop = wcnss_stop, .da_to_va = wcnss_da_to_va, .parse_fw = qcom_register_dump_segments, - .load = wcnss_load, + .load_segments = wcnss_load, }; static irqreturn_t wcnss_wdog_interrupt(int irq, void *dev) diff --git a/drivers/remoteproc/rcar_rproc.c b/drivers/remoteproc/rcar_rproc.c index cc17e8421f65..e36778fec072 100644 --- a/drivers/remoteproc/rcar_rproc.c +++ b/drivers/remoteproc/rcar_rproc.c @@ -142,7 +142,7 @@ static struct rproc_ops rcar_rproc_ops = { .prepare = rcar_rproc_prepare, .start = rcar_rproc_start, .stop = rcar_rproc_stop, - .load = rproc_elf_load_segments, + .load_segments = rproc_elf_load_segments, .parse_fw = rcar_rproc_parse_fw, .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, .sanity_check = rproc_elf_sanity_check, diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 8df4b2c59bb6..e4ad024efcda 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2485,11 +2485,11 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops) if (!rproc->ops->coredump) rproc->ops->coredump = rproc_coredump; - if (rproc->ops->load || rproc->ops->load_fw) + if (rproc->ops->load_segments || rproc->ops->load_fw) return 0; /* Default to ELF loader if no load function is specified */ - rproc->ops->load = rproc_elf_load_segments; + rproc->ops->load_segments = rproc_elf_load_segments; rproc->ops->parse_fw = rproc_elf_load_rsc_table; rproc->ops->find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table; rproc->ops->sanity_check = rproc_elf_sanity_check; diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 2104ca449178..b898494600cf 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -167,8 +167,8 @@ u64 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw) static inline int rproc_load_segments(struct rproc *rproc, const struct firmware *fw) { - if (rproc->ops->load) - return rproc->ops->load(rproc, fw); + if (rproc->ops->load_segments) + return rproc->ops->load_segments(rproc, fw); return -EINVAL; } diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c index 1340be9d0110..8d6b75e91531 100644 --- a/drivers/remoteproc/st_remoteproc.c +++ b/drivers/remoteproc/st_remoteproc.c @@ -233,7 +233,7 @@ static const struct rproc_ops st_rproc_ops = { .start = st_rproc_start, .stop = st_rproc_stop, .parse_fw = st_rproc_parse_fw, - .load = rproc_elf_load_segments, + .load_segments = rproc_elf_load_segments, .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, .sanity_check = rproc_elf_sanity_check, .get_boot_addr = rproc_elf_get_boot_addr, diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c index 5412beb0a692..0f91d8f1e7c7 100644 --- a/drivers/remoteproc/st_slim_rproc.c +++ b/drivers/remoteproc/st_slim_rproc.c @@ -201,7 +201,7 @@ static const struct rproc_ops slim_rproc_ops = { .stop = slim_rproc_stop, .da_to_va = slim_rproc_da_to_va, .get_boot_addr = rproc_elf_get_boot_addr, - .load = rproc_elf_load_segments, + .load_segments = rproc_elf_load_segments, .sanity_check = rproc_elf_sanity_check, }; diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 8c7f7950b80e..7e8ffd9fcc57 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -667,7 +667,7 @@ static const struct rproc_ops st_rproc_ops = { .attach = stm32_rproc_attach, .detach = stm32_rproc_detach, .kick = stm32_rproc_kick, - .load = rproc_elf_load_segments, + .load_segments = rproc_elf_load_segments, .parse_fw = stm32_rproc_parse_fw, .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, .get_loaded_rsc_table = stm32_rproc_get_loaded_rsc_table, diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index 5aeedeaf3c41..59cfba0a02e7 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -864,7 +864,7 @@ static const struct rproc_ops zynqmp_r5_rproc_ops = { .unprepare = zynqmp_r5_rproc_unprepare, .start = zynqmp_r5_rproc_start, .stop = zynqmp_r5_rproc_stop, - .load = rproc_elf_load_segments, + .load_segments = rproc_elf_load_segments, .parse_fw = zynqmp_r5_parse_fw, .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, .sanity_check = rproc_elf_sanity_check, diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index ba6fd560f7ba..55c20424a99f 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -374,7 +374,7 @@ enum rsc_handling_status { * @find_loaded_rsc_table: find the loaded resource table from firmware image * @get_loaded_rsc_table: get resource table installed in memory * by external entity - * @load: load firmware to memory, where the remote processor + * @load_segments: load firmware ELF segment to memory, where the remote processor * expects to find it * @sanity_check: sanity check the fw image * @get_boot_addr: get boot address to entry point specified in firmware @@ -402,7 +402,7 @@ struct rproc_ops { struct rproc *rproc, const struct firmware *fw); struct resource_table *(*get_loaded_rsc_table)( struct rproc *rproc, size_t *size); - int (*load)(struct rproc *rproc, const struct firmware *fw); + int (*load_segments)(struct rproc *rproc, const struct firmware *fw); int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); unsigned long (*panic)(struct rproc *rproc); From patchwork Thu Nov 28 08:42:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Pouliquen X-Patchwork-Id: 13887794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EE83D690EC for ; Thu, 28 Nov 2024 08:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gaYYKQhdt5+WppBYnImCivL9U494+2hjcdM9oi2RwHw=; b=B+1nToEPfBB53lcaEWu1jNyida heklrjqYkEWtL38jedeOmZ2AhbKikye746QGrWtM3FQVGS15DEmbeAzXNHMZhFPQCuNSOQCXBbG5H /smwp+sXAMHyW9N8e8WY9a5e7xpTC9CszG06SRpuLwTGjQYZElSWNGZuRpbOjVk/eyWMpOMMfrWGJ yNh2mM0+1Pctlhw6ja7iTDFB/rnyi3s6Pfxt3VxNoys5VrOfWXvpzMwGahbnSe5fKs1K5Cs9CCBze cpWWtMOSejGEYYdgzN1+d8A+3uaxZBEWazEiqA94FGVFnPxItZt/ulPgEVUYwleHGZ3wxhDbqjmlL Lpen10Iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tGaHm-0000000F4kK-3scg; Thu, 28 Nov 2024 08:54:06 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tGaCy-0000000F3fj-1R9K for linux-arm-kernel@lists.infradead.org; Thu, 28 Nov 2024 08:49:10 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AS20jC9019703; Thu, 28 Nov 2024 09:48:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= gaYYKQhdt5+WppBYnImCivL9U494+2hjcdM9oi2RwHw=; b=QhXefRvTaR6SBLhl pS03nor0+q7uoKg9CXu+w6Uca8+3YPw/PdAhFMcGdQZuz9OqiixOaRNiBXBvYmOW Z2WqdEIN25CBOn/q4R3YtvZfwDzMlm+WornqkRFCqvNUoxNfWw1LO/sQEY74g6Ky K0cN6c1HurtPAnNFL2RpYNDBTU8IGnGEPJk1nw6MgOQkE2mHbfqxACIT0gE04fDu KeR5NBrpMIS0gb7dp1EHJi12Q/peFmGmjihYBKyQgh/NLsp5PM943UmewL+CeuFU 8CsmmgpX6unETI6t3NFGlPRTA0der3EI+2+2sNYgxdg+F+2r97zJV8npRzap6YPl ZvqDLQ== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 43671au5k3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Nov 2024 09:48:58 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C697740063; Thu, 28 Nov 2024 09:47:27 +0100 (CET) Received: from Webmail-eu.st.com (eqndag1node6.st.com [10.75.129.135]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 556AE2698E6; Thu, 28 Nov 2024 09:43:05 +0100 (CET) Received: from SAFDAG1NODE1.st.com (10.75.90.17) by EQNDAG1NODE6.st.com (10.75.129.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:05 +0100 Received: from localhost (10.48.86.121) by SAFDAG1NODE1.st.com (10.75.90.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:04 +0100 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Maxime Coquelin" , Alexandre Torgue , Fabien Dessenne , Arnaud Pouliquen CC: , , , , Subject: [PATCH v15 6/8] dt-bindings: remoteproc: Add compatibility for TEE support Date: Thu, 28 Nov 2024 09:42:13 +0100 Message-ID: <20241128084219.2159197-7-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> References: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.48.86.121] X-ClientProxiedBy: SAFCAS1NODE1.st.com (10.75.90.11) To SAFDAG1NODE1.st.com (10.75.90.17) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241128_004908_848863_0CA4443A X-CRM114-Status: GOOD ( 17.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The "st,stm32mp1-m4-tee" compatible is utilized in a system configuration where the Cortex-M4 firmware is loaded by the Trusted Execution Environment (TEE). For instance, this compatible is used in both the Linux and OP-TEE device trees: - In OP-TEE, a node is defined in the device tree with the "st,stm32mp1-m4-tee" compatible to support signed remoteproc firmware. Based on DT properties, the OP-TEE remoteproc framework is initiated to expose a trusted application service to authenticate and load the remote processor firmware provided by the Linux remoteproc framework, as well as to start and stop the remote processor. - In Linux, when the compatibility is set, the Cortex-M resets should not be declared in the device tree. In such a configuration, the reset is managed by the OP-TEE remoteproc driver and is no longer accessible from the Linux kernel. Associated with this new compatible, add the "st,proc-id" property to identify the remote processor. This ID is used to define a unique ID, common between Linux, U-Boot, and OP-TEE, to identify a coprocessor. This ID will be used in requests to the OP-TEE remoteproc Trusted Application to specify the remote processor. Signed-off-by: Arnaud Pouliquen Reviewed-by: Rob Herring (Arm) --- .../bindings/remoteproc/st,stm32-rproc.yaml | 58 ++++++++++++++++--- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/st,stm32-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/st,stm32-rproc.yaml index 370af61d8f28..409123cd4667 100644 --- a/Documentation/devicetree/bindings/remoteproc/st,stm32-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/st,stm32-rproc.yaml @@ -16,7 +16,12 @@ maintainers: properties: compatible: - const: st,stm32mp1-m4 + enum: + - st,stm32mp1-m4 + - st,stm32mp1-m4-tee + description: + Use "st,stm32mp1-m4" for the Cortex-M4 coprocessor management by non-secure context + Use "st,stm32mp1-m4-tee" for the Cortex-M4 coprocessor management by secure context reg: description: @@ -43,6 +48,10 @@ properties: - description: The offset of the hold boot setting register - description: The field mask of the hold boot + st,proc-id: + description: remote processor identifier + $ref: /schemas/types.yaml#/definitions/uint32 + st,syscfg-tz: deprecated: true description: @@ -142,21 +151,43 @@ properties: required: - compatible - reg - - resets allOf: - if: properties: - reset-names: - not: - contains: - const: hold_boot + compatible: + contains: + const: st,stm32mp1-m4 then: + if: + properties: + reset-names: + not: + contains: + const: hold_boot + then: + required: + - st,syscfg-holdboot + else: + properties: + st,syscfg-holdboot: false + required: + - reset-names required: - - st,syscfg-holdboot - else: + - resets + + - if: + properties: + compatible: + contains: + const: st,stm32mp1-m4-tee + then: properties: st,syscfg-holdboot: false + reset-names: false + resets: false + required: + - st,proc-id additionalProperties: false @@ -188,5 +219,16 @@ examples: st,syscfg-rsc-tbl = <&tamp 0x144 0xFFFFFFFF>; st,syscfg-m4-state = <&tamp 0x148 0xFFFFFFFF>; }; + - | + #include + m4@10000000 { + compatible = "st,stm32mp1-m4-tee"; + reg = <0x10000000 0x40000>, + <0x30000000 0x40000>, + <0x38000000 0x10000>; + st,proc-id = <0>; + st,syscfg-rsc-tbl = <&tamp 0x144 0xFFFFFFFF>; + st,syscfg-m4-state = <&tamp 0x148 0xFFFFFFFF>; + }; ... From patchwork Thu Nov 28 08:42:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Pouliquen X-Patchwork-Id: 13887795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8938AD690EC for ; Thu, 28 Nov 2024 08:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fhFYWPWRu1fKy+2nIifEQQLFbsyaAYIzY0cZaLes9RI=; b=vQqeijhH7irKQ3PzUMxbCdnlgF qRqbI4IUGGGiIgjo8qeu9B0dRXM73BARQ8hseknH87iQYf/+hvovUyP53HN7oiBaDq3R47LHJ+9g1 6W+0A/8YcNiDU6EoryyUDlqitHg4WAXEn3wqCkt1xpoqGlIb3TDQfUpQ89cjjgyqIaxFm5gT5sYoM XAc4WyhgqbDENQrHwcNwtkCztdj0wCNYZVbjtpyxY8u/zZgfr2leXUhQ7DjnyzOYMrVpp7ZvNsPH7 DdYsI8GBGkQuzl18FZ+v5SW9z8AyBMF12k4KBdlAklbwEXG3DseKpiygaAbBuDUk1ezXzD9bhSion t1Mz8ScA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tGaIj-0000000F4wC-2dhJ; Thu, 28 Nov 2024 08:55:05 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tGaD0-0000000F3fy-2lBi for linux-arm-kernel@lists.infradead.org; Thu, 28 Nov 2024 08:49:12 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AS20jWK019700; Thu, 28 Nov 2024 09:49:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= fhFYWPWRu1fKy+2nIifEQQLFbsyaAYIzY0cZaLes9RI=; b=w2BzjJpUPe2y75bP rh7KZSvPm7FhI8DckwKJ5ZjmrNphWXsP3b1cvy71XZ8C7XsYeUPDvkQRzsRb2mUw Blgfa7DSWB5QguQrByAbgvocDOr4KVzd4j5R775M8UAt0AokCUD+iqxEvfKXw4PA TenSLk6++EZGXus9y+M2mSP5j1VsJP7S7vcQpOWEtcyaSwzzL/W7DtBLxgy0RSZs xM2NxmSmgkuJqkE5MgUe6fSjGSiqm3VtRlgjUCaRoRIfIAw595phUqtc+LbhmAjT 9Atz3JQVP6dRWDTD2Q6Ndwuu7V6Ud5DjjBNBdaoR5HJLmnMiGL3dotBqCur2DeUO 8NxMKg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 43671au5ke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Nov 2024 09:49:02 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id E9DA640045; Thu, 28 Nov 2024 09:47:59 +0100 (CET) Received: from Webmail-eu.st.com (eqndag1node5.st.com [10.75.129.134]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9754E269901; Thu, 28 Nov 2024 09:43:07 +0100 (CET) Received: from SAFDAG1NODE1.st.com (10.75.90.17) by EQNDAG1NODE5.st.com (10.75.129.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:07 +0100 Received: from localhost (10.48.86.121) by SAFDAG1NODE1.st.com (10.75.90.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:07 +0100 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier , Maxime Coquelin , Alexandre Torgue CC: Arnaud Pouliquen , , , , Subject: [PATCH v15 7/8] remoteproc: stm32: Create sub-functions to request shutdown and release Date: Thu, 28 Nov 2024 09:42:14 +0100 Message-ID: <20241128084219.2159197-8-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> References: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.48.86.121] X-ClientProxiedBy: SAFCAS1NODE1.st.com (10.75.90.11) To SAFDAG1NODE1.st.com (10.75.90.17) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241128_004910_996242_C3286AF4 X-CRM114-Status: GOOD ( 16.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To prepare for the support of TEE remoteproc, create sub-functions that can be used in both cases, with and without remoteproc TEE support. Signed-off-by: Arnaud Pouliquen --- drivers/remoteproc/stm32_rproc.c | 82 +++++++++++++++++++------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 7e8ffd9fcc57..1586978c5757 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -209,6 +209,52 @@ static int stm32_rproc_mbox_idx(struct rproc *rproc, const unsigned char *name) return -EINVAL; } +static void stm32_rproc_request_shutdown(struct rproc *rproc) +{ + struct stm32_rproc *ddata = rproc->priv; + int err, idx; + + /* Request shutdown of the remote processor */ + if (rproc->state != RPROC_OFFLINE && rproc->state != RPROC_CRASHED) { + idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_SHUTDOWN); + if (idx >= 0 && ddata->mb[idx].chan) { + err = mbox_send_message(ddata->mb[idx].chan, "detach"); + if (err < 0) + dev_warn(&rproc->dev, "warning: remote FW shutdown without ack\n"); + } + } +} + +static int stm32_rproc_release(struct rproc *rproc) +{ + struct stm32_rproc *ddata = rproc->priv; + unsigned int err = 0; + + /* To allow platform Standby power mode, set remote proc Deep Sleep */ + if (ddata->pdds.map) { + err = regmap_update_bits(ddata->pdds.map, ddata->pdds.reg, + ddata->pdds.mask, 1); + if (err) { + dev_err(&rproc->dev, "failed to set pdds\n"); + return err; + } + } + + /* Update coprocessor state to OFF if available */ + if (ddata->m4_state.map) { + err = regmap_update_bits(ddata->m4_state.map, + ddata->m4_state.reg, + ddata->m4_state.mask, + M4_STATE_OFF); + if (err) { + dev_err(&rproc->dev, "failed to set copro state\n"); + return err; + } + } + + return 0; +} + static int stm32_rproc_prepare(struct rproc *rproc) { struct device *dev = rproc->dev.parent; @@ -519,17 +565,9 @@ static int stm32_rproc_detach(struct rproc *rproc) static int stm32_rproc_stop(struct rproc *rproc) { struct stm32_rproc *ddata = rproc->priv; - int err, idx; + int err; - /* request shutdown of the remote processor */ - if (rproc->state != RPROC_OFFLINE && rproc->state != RPROC_CRASHED) { - idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_SHUTDOWN); - if (idx >= 0 && ddata->mb[idx].chan) { - err = mbox_send_message(ddata->mb[idx].chan, "detach"); - if (err < 0) - dev_warn(&rproc->dev, "warning: remote FW shutdown without ack\n"); - } - } + stm32_rproc_request_shutdown(rproc); err = stm32_rproc_set_hold_boot(rproc, true); if (err) @@ -541,29 +579,7 @@ static int stm32_rproc_stop(struct rproc *rproc) return err; } - /* to allow platform Standby power mode, set remote proc Deep Sleep */ - if (ddata->pdds.map) { - err = regmap_update_bits(ddata->pdds.map, ddata->pdds.reg, - ddata->pdds.mask, 1); - if (err) { - dev_err(&rproc->dev, "failed to set pdds\n"); - return err; - } - } - - /* update coprocessor state to OFF if available */ - if (ddata->m4_state.map) { - err = regmap_update_bits(ddata->m4_state.map, - ddata->m4_state.reg, - ddata->m4_state.mask, - M4_STATE_OFF); - if (err) { - dev_err(&rproc->dev, "failed to set copro state\n"); - return err; - } - } - - return 0; + return stm32_rproc_release(rproc); } static void stm32_rproc_kick(struct rproc *rproc, int vqid) From patchwork Thu Nov 28 08:42:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Pouliquen X-Patchwork-Id: 13887781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D50DD690ED for ; Thu, 28 Nov 2024 08:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SAfvJ3TEs0/PCnOeD3h2G0c1LftVV4b4PpZbNQaqv2s=; b=K2eC+AnU0hCheXlakUMnjxAcWS TqA9LbTJdhf77riUp9b2O+NcOLHi3QJIG9PPEHBzaXeG6B5aWTumUIRYNTy9StDr1SXey3CYc4SUq z6AM6PMS3F8/SaRlIQbg4GciydkRBGPUX1wP1THsKy/33kMhV/jB2HqlcOX96eK9l9Nugi548sFOy z7aCyaXTh809PuLH66e2bRSE4eda/2TB2mf/MIzDnrB141dr47bi+j3/T2nLmqYooJNFILmB3vppj RBknyeCboNOM1FLT/5zKAYR2tOhbWV7mHuuTZgsO+pNsiAlI1PrUOaxNO1382M2+0NLgX+GOOS8oS aO4Kb+UQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tGaGq-0000000F4e5-1WjH; Thu, 28 Nov 2024 08:53:08 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tGaCy-0000000F3fs-2Jbm for linux-arm-kernel@lists.infradead.org; Thu, 28 Nov 2024 08:49:10 +0000 Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AS20ga6032593; Thu, 28 Nov 2024 09:48:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= SAfvJ3TEs0/PCnOeD3h2G0c1LftVV4b4PpZbNQaqv2s=; b=CkrdQkYhhZKw0WRi ImF9n7YPOPpwdh0B/YQ7kzioWdqjXyf7WBhIpjL8zE2EleJV9LnZo8AXoMwVIcGK rNIS/HDQ9iwNSKXNuXUsO+Rl//ujxyr0LEOauRyIVlxdFIiV8qrnPQDplqWKgB2T nweCF/o4u9v4Pz4kA9YdGWzjrS+FE/b1XC0JKdk52kFTZRA1bQiPM6JLGZFBa6vp Y9XN2nIbAn9WzjmPDRs6PI8GCGdPJuu6udqWzkvaZ7b82nLhkRuBNHXLfhncSzPR tqZ8s8FIMrW+Q49P66HLVF2+XWE6IUu34a7Lz8dOVIrzOYwb65JMIMW1jcvl+Stt Agte+A== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 436713k662-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Nov 2024 09:48:59 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id E555F40069; Thu, 28 Nov 2024 09:47:33 +0100 (CET) Received: from Webmail-eu.st.com (eqndag1node4.st.com [10.75.129.133]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C7277269E10; Thu, 28 Nov 2024 09:43:09 +0100 (CET) Received: from SAFDAG1NODE1.st.com (10.75.90.17) by EQNDAG1NODE4.st.com (10.75.129.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:09 +0100 Received: from localhost (10.48.86.121) by SAFDAG1NODE1.st.com (10.75.90.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 28 Nov 2024 09:43:09 +0100 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier , Maxime Coquelin , Alexandre Torgue CC: Arnaud Pouliquen , , , , Subject: [PATCH v15 8/8] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware Date: Thu, 28 Nov 2024 09:42:15 +0100 Message-ID: <20241128084219.2159197-9-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> References: <20241128084219.2159197-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.48.86.121] X-ClientProxiedBy: SAFCAS1NODE1.st.com (10.75.90.11) To SAFDAG1NODE1.st.com (10.75.90.17) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241128_004908_894553_7BE11AAB X-CRM114-Status: GOOD ( 18.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The new TEE remoteproc driver is used to manage remote firmware in a secure, trusted context. The 'st,stm32mp1-m4-tee' compatibility is introduced to delegate the loading of the firmware to the trusted execution context. In such cases, the firmware should be signed and adhere to the image format defined by the TEE. Signed-off-by: Arnaud Pouliquen --- updates vs version V13: - register load_fw() ops instead of load() to call rproc_tee_load_fw() Signed-off-by: Arnaud Pouliquen --- drivers/remoteproc/stm32_rproc.c | 57 ++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 1586978c5757..c155822324d8 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -255,6 +256,19 @@ static int stm32_rproc_release(struct rproc *rproc) return 0; } +static int stm32_rproc_tee_stop(struct rproc *rproc) +{ + int err; + + stm32_rproc_request_shutdown(rproc); + + err = rproc_tee_stop(rproc); + if (err) + return err; + + return stm32_rproc_release(rproc); +} + static int stm32_rproc_prepare(struct rproc *rproc) { struct device *dev = rproc->dev.parent; @@ -691,8 +705,20 @@ static const struct rproc_ops st_rproc_ops = { .get_boot_addr = rproc_elf_get_boot_addr, }; +static const struct rproc_ops st_rproc_tee_ops = { + .prepare = stm32_rproc_prepare, + .start = rproc_tee_start, + .stop = stm32_rproc_tee_stop, + .kick = stm32_rproc_kick, + .load_fw = rproc_tee_load_fw, + .parse_fw = rproc_tee_parse_fw, + .find_loaded_rsc_table = rproc_tee_find_loaded_rsc_table, + .release_fw = rproc_tee_release_fw, +}; + static const struct of_device_id stm32_rproc_match[] = { { .compatible = "st,stm32mp1-m4" }, + { .compatible = "st,stm32mp1-m4-tee" }, {}, }; MODULE_DEVICE_TABLE(of, stm32_rproc_match); @@ -853,15 +879,36 @@ static int stm32_rproc_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct rproc *rproc; unsigned int state; + u32 proc_id; int ret; ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); if (ret) return ret; - rproc = devm_rproc_alloc(dev, np->name, &st_rproc_ops, NULL, sizeof(*ddata)); - if (!rproc) - return -ENOMEM; + if (of_device_is_compatible(np, "st,stm32mp1-m4-tee")) { + /* + * Delegate the firmware management to the secure context. + * The firmware loaded has to be signed. + */ + ret = of_property_read_u32(np, "st,proc-id", &proc_id); + if (ret) { + dev_err(dev, "failed to read st,rproc-id property\n"); + return ret; + } + + rproc = devm_rproc_alloc(dev, np->name, &st_rproc_tee_ops, NULL, sizeof(*ddata)); + if (!rproc) + return -ENOMEM; + + ret = rproc_tee_register(dev, rproc, proc_id); + if (ret) + return dev_err_probe(dev, ret, "signed firmware not supported by TEE\n"); + } else { + rproc = devm_rproc_alloc(dev, np->name, &st_rproc_ops, NULL, sizeof(*ddata)); + if (!rproc) + return -ENOMEM; + } ddata = rproc->priv; @@ -913,6 +960,8 @@ static int stm32_rproc_probe(struct platform_device *pdev) dev_pm_clear_wake_irq(dev); device_init_wakeup(dev, false); } + rproc_tee_unregister(rproc); + return ret; } @@ -933,6 +982,8 @@ static void stm32_rproc_remove(struct platform_device *pdev) dev_pm_clear_wake_irq(dev); device_init_wakeup(dev, false); } + + rproc_tee_unregister(rproc); } static int stm32_rproc_suspend(struct device *dev)