Re: [PATCH] firmware: qcom: Build the TrustZone memory allocator into qcom-scm
From: Bartosz Golaszewski
Date: Mon Nov 23 2026 - 09:18:28 EST
On Sun, Nov 22, 2026 at 10:28:43AM -0500, Sasha Levin wrote:
> With QCOM_TZMEM_MODE_SHMBRIDGE=y, qcom_tzmem.ko calls
> qcom_scm_shm_bridge_enable(), qcom_scm_shm_bridge_create() and
> qcom_scm_shm_bridge_delete() in qcom-scm.ko, and qcom-scm.ko calls
> qcom_tzmem_alloc() and friends. With QCOM_SCM=m the two modules depend
> on each other, neither can be loaded first, and modules_install fails:
>
> depmod: ERROR: Cycle detected: qcom_scm -> qcom_tzmem -> qcom_scm
> depmod: ERROR: Found 2 modules in dependency cycles!
>
> This has been possible since SHM Bridge mode was added. Since commit
> 35abc3cd8ab6 ("tee: remove TZMEM_MODE_GENERIC") it also happens for
> every QCOMTEE=m build with QCOM_SCM=m, because QCOMTEE's select of
> QCOM_TZMEM_MODE_SHMBRIDGE now takes effect.
>
> QCOM_TZMEM is selected only by QCOM_SCM, so the two always have the
> same value. Build qcom_tzmem.o into qcom-scm.ko, and drop the
> MODULE_DESCRIPTION() and MODULE_LICENSE() that qcom-scm already has.
>
> Fixes: f86c61498a57 ("firmware: qcom: tzmem: enable SHM Bridge support")
> Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/20261122051636.GA2630332@ax162/
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>