Re: [PATCH] firmware: qcom: scm: fold tzmem into the qcom-scm module

From: Sumit Garg

Date: Mon Jul 13 2026 - 07:38:56 EST


On Mon, Jul 13, 2026 at 4:07 PM Konrad Dybcio
<konrad.dybcio@xxxxxxxxxxxxxxxx> wrote:
>
> On 7/13/26 6:58 AM, Sumit Garg wrote:
> > From: Sumit Garg <sumit.garg@xxxxxxxxxxxxxxxx>
> >
> > qcom_scm and qcom_tzmem have a mutual symbol dependency: qcom_tzmem
> > calls qcom_scm_shm_bridge_{enable,create,delete}() while qcom_scm
> > calls qcom_tzmem_{alloc,free,to_phys}() and qcom_scm_get_tzmem_pool().
> > When both are built as modules this results in a circular module
> > dependency and depmod fails:
> >
> > depmod: ERROR: Cycle detected: qcom_scm -> qcom_tzmem -> qcom_scm
> >
> > QCOM_TZMEM is an invisible tristate that is only ever selected by
> > QCOM_SCM, so the two are always enabled together. Build qcom_tzmem.o
> > as part of the qcom-scm composite module instead of as a separate
> > module. This breaks the cycle since the mutual symbol references
> > become intra-module.
> >
> > With tzmem now internal to qcom-scm, the shm_bridge helpers are no
> > longer used outside the module, so drop their EXPORT_SYMBOL_GPL() and
> > move the declarations from the public header to the private one,
> > alongside qcom_scm_shm_bridge_enable().
> >
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202607122327.3zkZCUaB-lkp@xxxxxxxxx/
> > Assisted-by: Copilot:claude-opus-4.8
> > Signed-off-by: Sumit Garg <sumit.garg@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/firmware/qcom/Makefile | 2 +-
> > drivers/firmware/qcom/qcom_scm.c | 3 ---
> > drivers/firmware/qcom/qcom_scm.h | 4 ++++
> > include/linux/firmware/qcom/qcom_scm.h | 5 -----
> > 4 files changed, 5 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/firmware/qcom/Makefile b/drivers/firmware/qcom/Makefile
> > index 48801d18f37b..55751d282689 100644
> > --- a/drivers/firmware/qcom/Makefile
> > +++ b/drivers/firmware/qcom/Makefile
> > @@ -5,7 +5,7 @@
> >
> > obj-$(CONFIG_QCOM_SCM) += qcom-scm.o
> > qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
> > -obj-$(CONFIG_QCOM_TZMEM) += qcom_tzmem.o
> > +qcom-scm-$(CONFIG_QCOM_TZMEM) += qcom_tzmem.o
>
> Does it make sense to squash the kconfig entries too now?
>

Sounds reasonable to me, I can do that for v2.

-Sumit