From: Nathan Chancellor <nathan@kernel.org>
To: Sasha Levin <sashal@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Abel Vesa <abelvesa@kernel.org>,
Julian Braha <julianbraha@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
Sumit Garg <sumit.garg@oss.qualcomm.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware: qcom: Build the TrustZone memory allocator into qcom-scm
Date: Mon, 23 Nov 2026 20:06:41 -0700 [thread overview]
Message-ID: <20261124030641.GA2738970@ax162> (raw)
In-Reply-To: <20261122152843.1113882-1-sashal@kernel.org>
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@kernel.org>
> Closes: https://lore.kernel.org/all/20261122051636.GA2630332@ax162/
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>
> Tested on arm64 with allnoconfig plus: Nathan's fragment; ARCH_QCOM=y
> QCOM_SCM=m SHMBRIDGE=y; ARCH_QCOM=y QCOM_SCM=m QCOMTEE=m; QCOM_SCM=y
> QCOMTEE=m; QCOM_SCM=m SHMBRIDGE=n. All build without warnings and pass
> modules_install. Without the patch, Nathan's fragment and the QCOMTEE=m
> QCOM_SCM=m config fail depmod with the cycle above.
>
> drivers/firmware/qcom/Makefile | 3 +--
> drivers/firmware/qcom/qcom_tzmem.c | 2 --
> 2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/qcom/Makefile b/drivers/firmware/qcom/Makefile
> index 88ce74d74c3e2..74c655856b0c2 100644
> --- a/drivers/firmware/qcom/Makefile
> +++ b/drivers/firmware/qcom/Makefile
> @@ -4,9 +4,8 @@
> #
>
> obj-$(CONFIG_QCOM_SCM) += qcom-scm.o
> -qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
> +qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o qcom_tzmem.o
> CFLAGS_qcom_scm-smc.o := -I$(src)
> -obj-$(CONFIG_QCOM_TZMEM) += qcom_tzmem.o
This basically makes CONFIG_QCOM_TZMEM pointless, it should probably
just be collapsed into CONFIG_QCOM_SCM formally.
diff --git a/drivers/firmware/qcom/Kconfig b/drivers/firmware/qcom/Kconfig
index 3ad22f8fc3e5..54b9abfb6aad 100644
--- a/drivers/firmware/qcom/Kconfig
+++ b/drivers/firmware/qcom/Kconfig
@@ -28,16 +28,12 @@ config QCOM_PAS_TEE
config QCOM_SCM
tristate "Qualcomm PAS SCM interface driver" if ARCH_QCOM || COMPILE_TEST
select QCOM_PAS
- select QCOM_TZMEM
- default y if ARCH_QCOM
-
-config QCOM_TZMEM
- tristate
select GENERIC_ALLOCATOR
+ default y if ARCH_QCOM
config QCOM_TZMEM_MODE_SHMBRIDGE
bool "TrustZone interface memory allocator: SHM Bridge"
- depends on QCOM_TZMEM
+ depends on QCOM_SCM
help
Use Qualcomm Shared Memory Bridge as memory allocator. The memory has the
same alignment as in the 'Generic' allocator, which is used when this option
--
Cheers,
Nathan
prev parent reply other threads:[~2026-11-24 3:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 15:28 Sasha Levin
2026-11-23 14:18 ` Bartosz Golaszewski
2026-11-24 3:06 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124030641.GA2738970@ax162 \
--to=nathan@kernel.org \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=arnd@arndb.de \
--cc=brgl@kernel.org \
--cc=geert+renesas@glider.be \
--cc=julianbraha@gmail.com \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=sumit.garg@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®