firmware: qcom: scm: Hide QCOM_SCM instead of depending on ARCH_QCOM
Subsystems (2)
PATCH 1/1 firmware: qcom: scm: Hide QCOM_SCM instead of depending on ARCH_QCOM
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.
--- drivers/firmware/qcom/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/firmware/qcom/Kconfig +1 -2
@@ -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
Signature · 1 line
2.53.0
Hi Sasha,
Quoted 25 lines · Sasha Levin
imx_v6_v7_defconfigfails 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 toqcom_tzmem_alloc' qcom_scm.c:(.text+0x2b0): undefined reference toqcom_tzmem_free' qcom_scm.c:(.text+0x1514): undefined reference to `qcom_tzmem_to_phys'
QCOM_SCMgained a "depends onARCH_QCOM||COMPILE_TEST", but it is selected from 20 places in the tree and several of those are reachable withoutARCH_QCOM.DRM_MSMis one of them, viaSOC_IMX5, which is howimx_v6_v7_defconfigends 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_TZMEMis left unset,qcom_tzmem.cis not built, and the unconditional qcom_tzmem_*() calls inqcom_scm.candqcom_scm-smc.chave nothing to bind to.
Quoted 7 lines
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.
linux-next
Quoted 6 lines
Fixes 8fecd3194de3 ("firmware: QCOM interfaces should depend on ARCH_QCOM")Reported-by kernel test robot <[email protected]>Assisted-by LLMSigned-off-by Sasha Levin <[email protected]>
Thanks for your patch!
drivers/firmware/qcom/Kconfig config QCOM_PAS_TEE · line 32
Quoted 12 lines
drivers/firmware/qcom/Kconfig +1
-2@@ -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
LGTM for now, so
As the MSM driver is used on non-QCOM platforms, too, in the long run, the "select QCOM_SCM" and "select QCOM_PAS" for DRM_MSM should probably gain dependencies on ARCH_QCOM (like "select QCOM_UBWC_CONFIG if ARCH_QCOM" already has), and the various qcom_*() should gain dummies.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 9 lines · Sasha Levin
imx_v6_v7_defconfigfails 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 toqcom_tzmem_alloc' qcom_scm.c:(.text+0x2b0): undefined reference toqcom_tzmem_free' qcom_scm.c:(.text+0x1514): undefined reference to `qcom_tzmem_to_phys'[...]
Applied, thanks!
[1/1] firmware: qcom: scm: Hide QCOM_SCM instead of depending on ARCH_QCOM
commit: 99fda744d8ae70c1bd34064496b80a6f7591e4e5
Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>
Hi Sasha and qcom folks,
Quoted 47 lines · Sasha Levin
imx_v6_v7_defconfigfails 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 toqcom_tzmem_alloc' qcom_scm.c:(.text+0x2b0): undefined reference toqcom_tzmem_free' qcom_scm.c:(.text+0x1514): undefined reference to `qcom_tzmem_to_phys'
QCOM_SCMgained a "depends onARCH_QCOM||COMPILE_TEST", but it is selected from 20 places in the tree and several of those are reachable withoutARCH_QCOM.DRM_MSMis one of them, viaSOC_IMX5, which is howimx_v6_v7_defconfigends 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_TZMEMis left unset,qcom_tzmem.cis not built, and the unconditional qcom_tzmem_*() calls inqcom_scm.candqcom_scm-smc.chave 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 <[email protected]>Assisted-by LLMSigned-off-by Sasha Levin <[email protected]>--- drivers/firmware/qcom/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/firmware/qcom/Kconfig +0
-0
drivers/firmware/qcom/Kconfig config QCOM_PAS_TEE · line 32
Quoted 9 lines
drivers/firmware/qcom/Kconfig +1
-2@@ -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.
Signature · 2 lines
Cheers, Nathan
Quoted 10 lines · Nathan Chancellor
This now allows
#
CONFIG_ARCH_QCOMis not set
CONFIG_QCOM_SCM=m
CONFIG_QCOM_TZMEM=m
#CONFIG_QCOM_TZMEM_MODE_GENERICis not set
CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE=ywhich breaks the build (or install if depmod is postponed until then) for me.
This is older than this patch. v7.3 gives the same config from your allno.config and depmod fails the same way.
With SHM Bridge enabled, qcom_scm and qcom_tzmem call each other, so they can't be two separate modules. That goes back to f86c61498a57 ("firmware: qcom: tzmem: enable SHM Bridge support"), and it happens with ARCH_QCOM=y too.
I sent a patch that builds qcom_tzmem into the qcom-scm module:
[PATCH] firmware: qcom: Build the TrustZone memory allocator into qcom-scm
Signature · 2 lines
Thanks, Sasha