mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Sasha Levin <sashal@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: Sumit Garg <sumit.garg@oss.qualcomm.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	kernel test robot <lkp@intel.com>,
	Abel Vesa <abelvesa@kernel.org>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware: qcom: scm: Hide QCOM_SCM instead of depending on ARCH_QCOM
Date: Sat, 21 Nov 2026 22:16:36 -0700	[thread overview]
Message-ID: <20261122051636.GA2630332@ax162> (raw)
In-Reply-To: <20260913173049.1168963-1-sashal@kernel.org>

Hi Sasha and qcom folks,

On Sun, Sep 13, 2026 at 01:30:49PM -0400, Sasha Levin wrote:
> imx_v6_v7_defconfig fails to link:
> 
>   arm-linux-gnueabihf-ld: drivers/firmware/qcom/qcom_scm.o: in function
>   `qcom_scm_pas_init_image':
>   qcom_scm.c:(.text+0xecc): undefined reference to `qcom_tzmem_alloc'
>   qcom_scm.c:(.text+0x2b0): undefined reference to `qcom_tzmem_free'
>   qcom_scm.c:(.text+0x1514): undefined reference to `qcom_tzmem_to_phys'
> 
> QCOM_SCM gained a "depends on ARCH_QCOM || COMPILE_TEST", but it is
> selected from 20 places in the tree and several of those are reachable
> without ARCH_QCOM. DRM_MSM is one of them, via SOC_IMX5, which is how
> imx_v6_v7_defconfig ends up here:
> 
>   WARNING: unmet direct dependencies detected for QCOM_SCM
>     Depends on [n]: ARCH_QCOM [=n] || COMPILE_TEST [=n]
>     Selected by [y]:
>     - DRM_MSM [=y] && ... && (ARCH_QCOM [=n] || SOC_IMX5 [=y] ||
>       COMPILE_TEST [=n]) && ...
> 
> kconfig still honours the select and sets QCOM_SCM=y, but it does not
> propagate the selects of a symbol whose own dependencies are unmet, so
> QCOM_TZMEM is left unset, qcom_tzmem.c is not built, and the
> unconditional qcom_tzmem_*() calls in qcom_scm.c and qcom_scm-smc.c
> have nothing to bind to.
> 
> The point of the dependency was only to stop asking the user about
> Qualcomm firmware interfaces when configuring a non-Qualcomm kernel.
> Express that as a prompt condition, which is what the same commit
> already did for QCOM_PAS: the symbol stays invisible, but it no longer
> carries a dependency that silently drops its selects.
> 
> Found by KernelCI builds of the linus-next tree.
> 
> Fixes: 8fecd3194de3 ("firmware: QCOM interfaces should depend on ARCH_QCOM")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202609120634.g0HMAp3g-lkp@intel.com/
> Assisted-by: LLM
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  drivers/firmware/qcom/Kconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/qcom/Kconfig b/drivers/firmware/qcom/Kconfig
> index 691db0ded8e8c..b50e1309ced5f 100644
> --- a/drivers/firmware/qcom/Kconfig
> +++ b/drivers/firmware/qcom/Kconfig
> @@ -26,8 +26,7 @@ config QCOM_PAS_TEE
>  	  by the firmware TEE implementation as the backend.
>  
>  config QCOM_SCM
> -	tristate "Qualcomm PAS SCM interface driver"
> -	depends on ARCH_QCOM || COMPILE_TEST
> +	tristate "Qualcomm PAS SCM interface driver" if ARCH_QCOM || COMPILE_TEST
>  	select QCOM_PAS
>  	select QCOM_TZMEM
>  	default y if ARCH_QCOM

This now allows

  # CONFIG_ARCH_QCOM is not set
  CONFIG_QCOM_SCM=m
  CONFIG_QCOM_TZMEM=m
  # CONFIG_QCOM_TZMEM_MODE_GENERIC is not set
  CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE=y

which breaks the build (or install if depmod is postponed until then)
for me. I ran into this slimming down platform support from my aarch64
Fedora kernel, as I don't have any Qualcomm platforms.

  $ cat allno.config
  CONFIG_ATH12K=m
  CONFIG_ATH12K_AHB=y
  CONFIG_CFG80211=m
  CONFIG_MAC80211=m
  CONFIG_MODULES=y
  CONFIG_NET=y
  CONFIG_NETDEVICES=y
  CONFIG_PCI=y
  CONFIG_QCOM_TZMEM_MODE_GENERIC=n
  CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE=y
  CONFIG_REMOTEPROC=y
  CONFIG_WLAN=y
  CONFIG_WLAN_VENDOR_ATH=y

  $ make -skj"$(nproc)" \
         ARCH=arm64 \
         CROSS_COMPILE=aarch64-linux-gnu- \
         KCONFIG_ALLCONFIG=1 \
         INSTALL_MOD_PATH=$PWD/rootfs \
         clean allnoconfig all modules_install
  depmod: ERROR: Cycle detected: qcom_scm -> qcom_tzmem -> qcom_scm
  depmod: ERROR: Found 2 modules in dependency cycles!

One way around this is turning CONFIG_QCOM_SCM into a bool but that
would end up building more code into the kernel image that may or may
not run. The proper solution is probably doing what Geert suggested and
only selecting these symbols with ARCH_QCOM but I did not explore this.

-- 
Cheers,
Nathan

      parent reply	other threads:[~2026-11-22  5:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13 17:30 Sasha Levin
2026-09-14  7:36 ` Geert Uytterhoeven
2026-09-25 16:43 ` Bjorn Andersson
2026-11-22  5:16 ` 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=20261122051636.GA2630332@ax162 \
    --to=nathan@kernel.org \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --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®