soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
Subsystems (5)
PATCH v3 1/1 soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
DRM_MSM unconditionally selects QCOM_UBWC_CONFIG, which calls SMEM APIs, causing a link error on non-Qcom platforms (e.g. SOC_IMX5):
arm-linux-gnueabihf-ld: ubwc_config.c:(.text+0x2c): undefined
reference to 'qcom_smem_is_available'
arm-linux-gnueabihf-ld: ubwc_config.c:(.text+0x4c): undefined
reference to 'qcom_smem_dram_get_hbb'
Make QCOM_UBWC_CONFIG depend on QCOM_SMEM to make the requirement explicit, and guard the select in DRM_MSM with ARCH_QCOM && QCOM_SMEM so it is only selected when its dependency is met.
---
Changes since v2:
- guard QCOM_UBWC_CONFIG both with ARCH_QCOM and QCOM_SMEM otherwise
we could force QCOM_SMEM=n and still have QCOM_UBWC_CONFIG=m as reported by Nathan Chancellor
- Link to v2: https://lore.kernel.org/imx/20260811223622.GA934543@ax162/T/#t
Changes since v1:
- (addressed feedback from Dmitry) replace adding static inline stubs with preparing a better config dependecies so that we use the qcom_smem symbols only on QCOM platforms.
- Link to v1: https://lore.kernel.org/imx/sy2ulk536ryakhy6fdnqr4asvzvufqk3dlo2awdrfomulyf4n4@qtp4qoazqmhj/T/#t
drivers/gpu/drm/msm/Kconfig | 2 +- drivers/soc/qcom/Kconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/Kconfig +1 -1
@@ -22,7 +22,7 @@ config DRM_MSM select TMPFS select QCOM_SCM select QCOM_PAS - select QCOM_UBWC_CONFIG + select QCOM_UBWC_CONFIG if ARCH_QCOM && QCOM_SMEM select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC select SYNC_FILE
drivers/soc/qcom/Kconfig +1 -0
@@ -321,6 +321,7 @@ config QCOM_QMI_HELPERS config QCOM_UBWC_CONFIG tristate + depends on QCOM_SMEM help Most Qualcomm SoCs feature a number of Universal Bandwidth Compression (UBWC) engines across various IP blocks, which need to be initialized
Signature · 1 line
2.45.2
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The patch adds `depends on QCOM_SMEM` to `QCOM_UBWC_CONFIG` but fails to update `VIDEO_QCOM_IRIS`…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The patch adds depends on QCOM_SMEM to QCOM_UBWC_CONFIG but fails to update VIDEO_QCOM_IRIS which unconditionally selects it, leading to a Kconfig unmet dependency warning and a link error when QCOM_SMEM=n.
- [High] When DRM_MSM is built-in (y) and QCOM_SMEM is a module (m), the new conditional select forces QCOM_UBWC_CONFIG to m, resulting in undefined references to qcom_ubwc_config_get_data during vmlinux linkage. --
--- Patch [1]: [PATCH v3] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n --- commit dd72552ce5111faee423365870490e3e7c98c8db
Author: Daniel Baluta <[email protected]>
soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
DRM_MSM unconditionally selects QCOM_UBWC_CONFIG, which calls SMEM APIs, causing a link error on non-Qcom platforms. Make QCOM_UBWC_CONFIG depend on QCOM_SMEM to make the requirement explicit, and guard the select in DRM_MSM with ARCH_QCOM && QCOM_SMEM.
Quoted 4 lines
drivers/gpu/drm/msm/Kconfig +0
-0
[ ... ]
drivers/gpu/drm/msm/Kconfig config DRM_MSM · line 25
Quoted 6 lines
drivers/gpu/drm/msm/Kconfig +1
-1@@ -22,7 +22,7 @@ config DRM_MSM select TMPFS select QCOM_SCM select QCOM_PAS - select QCOM_UBWC_CONFIG + select QCOM_UBWC_CONFIG if ARCH_QCOM && QCOM_SMEM
[Severity: High]
If DRM_MSM is built-in (=y) and QCOM_SMEM is a module (=m), this conditional select expression evaluates to 'm'. This leaves QCOM_UBWC_CONFIG configured as a module (=m) while DRM_MSM is built-in.
Because include/linux/soc/qcom/ubwc.h uses IS_ENABLED(CONFIG_QCOM_UBWC_CONFIG), which evaluates to true for both built-in and modules:
#if IS_ENABLED(CONFIG_QCOM_UBWC_CONFIG)
const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void); #else
static inline const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void)
...
Doesn't this result in an undefined reference to qcom_ubwc_config_get_data when linking vmlinux, since the static inline stub is not provided? Should IS_REACHABLE() be used in the header instead, or should the dependency be adjusted?
Quoted 7 lines
drivers/gpu/drm/msm/Kconfig +0
-0select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC select SYNC_FILEdrivers/soc/qcom/Kconfig +0
-0
[ ... ]
drivers/soc/qcom/Kconfig config QCOM_QMI_HELPERS · line 324
Quoted 5 lines
drivers/soc/qcom/Kconfig +1
-0@@ -321,6 +321,7 @@ config QCOM_QMI_HELPERS config QCOM_UBWC_CONFIG tristate + depends on QCOM_SMEM
[Severity: High]
By adding this dependency, doesn't this create an unmet dependency for VIDEO_QCOM_IRIS which also selects QCOM_UBWC_CONFIG?
In drivers/media/platform/qcom/iris/Kconfig:
config VIDEO_QCOM_IRIS
...
select QCOM_UBWC_CONFIGWhen a config symbol uses select, it must have dependencies at least as restrictive as the selected symbol. Since VIDEO_QCOM_IRIS unconditionally selects QCOM_UBWC_CONFIG, if it is enabled while QCOM_SMEM=n, it bypasses this new dependency.
Will this cause Kconfig to force QCOM_UBWC_CONFIG to be built, generating an unmet dependency warning, and failing with the exact same undefined reference to qcom_smem_is_available that this patch intends to fix?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1