Message ID | 20241007131620.2090104-8-arnaud.pouliquen@foss.st.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Introduction of a remoteproc tee to load signed firmware | expand |
Hi Arnaud, kernel test robot noticed the following build errors: [auto build test ERROR on 9852d85ec9d492ebef56dc5f229416c925758edc] url: https://github.com/intel-lab-lkp/linux/commits/Arnaud-Pouliquen/remoteproc-core-Introduce-rproc_pa_to_va-helper/20241007-212358 base: 9852d85ec9d492ebef56dc5f229416c925758edc patch link: https://lore.kernel.org/r/20241007131620.2090104-8-arnaud.pouliquen%40foss.st.com patch subject: [PATCH v10 7/7] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware config: parisc-randconfig-001-20241008 (https://download.01.org/0day-ci/archive/20241008/202410081704.Zo2k0SZQ-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241008/202410081704.Zo2k0SZQ-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/202410081704.Zo2k0SZQ-lkp@intel.com/ All errors (new ones prefixed by >>): hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_load_fw': >> (.text+0xa8): undefined reference to `tee_shm_register_kernel_buf' >> hppa-linux-ld: (.text+0x160): undefined reference to `tee_client_invoke_func' >> hppa-linux-ld: (.text+0x178): undefined reference to `tee_shm_free' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_register': >> (.text+0x2f4): undefined reference to `tee_client_open_session' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_unregister': >> (.text+0x3d4): undefined reference to `tee_client_close_session' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_probe': >> (.text+0x478): undefined reference to `tee_client_open_context' >> hppa-linux-ld: (.text+0x4f8): undefined reference to `tee_client_close_context' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_remove': (.text+0x558): undefined reference to `tee_client_close_session' hppa-linux-ld: (.text+0x59c): undefined reference to `tee_client_close_context' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_start': >> (.text+0x68c): undefined reference to `tee_client_invoke_func' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_stop': (.text+0x7c8): undefined reference to `tee_client_invoke_func' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_get_loaded_rsc_table': (.text+0x92c): undefined reference to `tee_client_invoke_func' hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o: in function `tee_rproc_release_fw': (.text+0xb18): undefined reference to `tee_client_invoke_func' >> hppa-linux-ld: drivers/remoteproc/remoteproc_tee.o:(.data+0x8): undefined reference to `tee_bus_type' Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for REMOTEPROC_TEE Depends on [n]: REMOTEPROC [=y] && OPTEE [=n] Selected by [y]: - STM32_RPROC [=y] && (ARCH_STM32 || COMPILE_TEST [=y]) && REMOTEPROC [=y]
Hi Arnaud,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 9852d85ec9d492ebef56dc5f229416c925758edc]
url: https://github.com/intel-lab-lkp/linux/commits/Arnaud-Pouliquen/remoteproc-core-Introduce-rproc_pa_to_va-helper/20241007-212358
base: 9852d85ec9d492ebef56dc5f229416c925758edc
patch link: https://lore.kernel.org/r/20241007131620.2090104-8-arnaud.pouliquen%40foss.st.com
patch subject: [PATCH v10 7/7] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware
config: alpha-kismet-CONFIG_REMOTEPROC_TEE-CONFIG_STM32_RPROC-0-0 (https://download.01.org/0day-ci/archive/20241008/202410081902.TwQcmWjk-lkp@intel.com/config)
reproduce: (https://download.01.org/0day-ci/archive/20241008/202410081902.TwQcmWjk-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/202410081902.TwQcmWjk-lkp@intel.com/
kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for REMOTEPROC_TEE when selected by STM32_RPROC
WARNING: unmet direct dependencies detected for REMOTEPROC_TEE
Depends on [n]: REMOTEPROC [=y] && OPTEE [=n]
Selected by [y]:
- STM32_RPROC [=y] && (ARCH_STM32 || COMPILE_TEST [=y]) && REMOTEPROC [=y]
From hereon and starting with this version, I will not review patchets that don't pass the compilation bots. Mathieu On Tue, Oct 08, 2024 at 07:07:40PM +0800, kernel test robot wrote: > Hi Arnaud, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on 9852d85ec9d492ebef56dc5f229416c925758edc] > > url: https://github.com/intel-lab-lkp/linux/commits/Arnaud-Pouliquen/remoteproc-core-Introduce-rproc_pa_to_va-helper/20241007-212358 > base: 9852d85ec9d492ebef56dc5f229416c925758edc > patch link: https://lore.kernel.org/r/20241007131620.2090104-8-arnaud.pouliquen%40foss.st.com > patch subject: [PATCH v10 7/7] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware > config: alpha-kismet-CONFIG_REMOTEPROC_TEE-CONFIG_STM32_RPROC-0-0 (https://download.01.org/0day-ci/archive/20241008/202410081902.TwQcmWjk-lkp@intel.com/config) > reproduce: (https://download.01.org/0day-ci/archive/20241008/202410081902.TwQcmWjk-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/202410081902.TwQcmWjk-lkp@intel.com/ > > kismet warnings: (new ones prefixed by >>) > >> kismet: WARNING: unmet direct dependencies detected for REMOTEPROC_TEE when selected by STM32_RPROC > WARNING: unmet direct dependencies detected for REMOTEPROC_TEE > Depends on [n]: REMOTEPROC [=y] && OPTEE [=n] > Selected by [y]: > - STM32_RPROC [=y] && (ARCH_STM32 || COMPILE_TEST [=y]) && REMOTEPROC [=y] > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki
Hi Arnaud, kernel test robot noticed the following build errors: [auto build test ERROR on 9852d85ec9d492ebef56dc5f229416c925758edc] url: https://github.com/intel-lab-lkp/linux/commits/Arnaud-Pouliquen/remoteproc-core-Introduce-rproc_pa_to_va-helper/20241007-212358 base: 9852d85ec9d492ebef56dc5f229416c925758edc patch link: https://lore.kernel.org/r/20241007131620.2090104-8-arnaud.pouliquen%40foss.st.com patch subject: [PATCH v10 7/7] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware config: arm-randconfig-r054-20241008 (https://download.01.org/0day-ci/archive/20241009/202410090225.d3bZaaqk-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241009/202410090225.d3bZaaqk-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/202410090225.d3bZaaqk-lkp@intel.com/ All errors (new ones prefixed by >>): >> ld.lld: error: undefined symbol: tee_client_invoke_func >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_release_fw) in archive vmlinux.a >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_load_fw) in archive vmlinux.a >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_parse_fw) in archive vmlinux.a >>> referenced 3 more times -- >> ld.lld: error: undefined symbol: tee_shm_register_kernel_buf >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_load_fw) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: tee_shm_free >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_load_fw) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: tee_client_open_session >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_register) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: tee_client_close_session >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_unregister) in archive vmlinux.a >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_remove) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: tee_client_open_context >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_probe) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: tee_client_close_context >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_probe) in archive vmlinux.a >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_remove) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: tee_bus_type >>> referenced by remoteproc_tee.c >>> drivers/remoteproc/remoteproc_tee.o:(tee_rproc_fw_driver) in archive vmlinux.a Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for REMOTEPROC_TEE Depends on [n]: REMOTEPROC [=y] && OPTEE [=n] Selected by [y]: - STM32_RPROC [=y] && (ARCH_STM32 [=n] || COMPILE_TEST [=y]) && REMOTEPROC [=y]
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index d0284220a194..df9ccbffe48b 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -327,6 +327,7 @@ config STM32_RPROC depends on ARCH_STM32 || COMPILE_TEST depends on REMOTEPROC select MAILBOX + select REMOTEPROC_TEE help Say y here to support STM32 MCU processors via the remote processor framework. diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 288bd70c7861..cb7093de41df 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -18,6 +18,7 @@ #include <linux/pm_wakeirq.h> #include <linux/regmap.h> #include <linux/remoteproc.h> +#include <linux/remoteproc_tee.h> #include <linux/reset.h> #include <linux/slab.h> #include <linux/workqueue.h> @@ -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 = tee_rproc_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 = tee_rproc_start, + .stop = stm32_rproc_tee_stop, + .kick = stm32_rproc_kick, + .load = tee_rproc_load_fw, + .parse_fw = tee_rproc_parse_fw, + .find_loaded_rsc_table = tee_rproc_find_loaded_rsc_table, + .release_fw = tee_rproc_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); @@ -851,17 +877,42 @@ static int stm32_rproc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct stm32_rproc *ddata; struct device_node *np = dev->of_node; + struct tee_rproc *trproc = NULL; 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; + + trproc = tee_rproc_register(dev, rproc, proc_id); + if (IS_ERR(trproc)) { + dev_err_probe(dev, PTR_ERR(trproc), + "signed firmware not supported by TEE\n"); + return PTR_ERR(trproc); + } + } else { + rproc = devm_rproc_alloc(dev, np->name, &st_rproc_ops, NULL, sizeof(*ddata)); + if (!rproc) + return -ENOMEM; + } ddata = rproc->priv; @@ -913,6 +964,9 @@ static int stm32_rproc_probe(struct platform_device *pdev) dev_pm_clear_wake_irq(dev); device_init_wakeup(dev, false); } + if (rproc->tee_rproc_itf) + tee_rproc_unregister(rproc->tee_rproc_itf); + return ret; } @@ -933,6 +987,9 @@ static void stm32_rproc_remove(struct platform_device *pdev) dev_pm_clear_wake_irq(dev); device_init_wakeup(dev, false); } + if (rproc->tee_rproc_itf) + tee_rproc_unregister(rproc->tee_rproc_itf); + } static int stm32_rproc_suspend(struct device *dev)
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 <arnaud.pouliquen@foss.st.com> --- update vs previous version - rename tee_interface to tee_rproc_itf - in stm32_rproc_probe(), test and use rproc->tee_rproc_itf instead of trproc in the tee_rproc_unregister() call - initialize release_fw ops - add select REMOTEPROC_TEE in Kconfig for STM32_RPROC. --- drivers/remoteproc/Kconfig | 1 + drivers/remoteproc/stm32_rproc.c | 63 ++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 3 deletions(-)