Skip to contentSkip to conversation

soc: qcom: ubwc: Fix link error when QCOM_SMEM=n

PATCH Superseded Daniel Baluta 4 participants 10 messages Aug 14 – Aug 17

Subsystems (8)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover soc: qcom: ubwc: Fix link error when QCOM_SMEM=n

DRM_MSM and VIDEO_QCOM_IRIS select QCOM_UBWC_CONFIG, whose ubwc_config.c calls QCOM_SMEM APIs unconditionally. On configs without QCOM_SMEM this fails to link, e.g. on SOC_IMX5:

arm-linux-gnueabihf-ld: ubwc_config.c:(.text+0x2c): undefined
reference to 'qcom_smem_is_available'

Fix it by making the QCOM_SMEM requirement explicit in Kconfig.

Changes since v4: (fixed coments from sashiko bot)
- Dropped the IS_REACHABLE() patch. As pointed out in review, it did not fix the case where DRM_MSM=y and QCOM_SMEM=m. it only masked the mismatch at build time and turned it into a guaranteed runtime probe failure, since all callers abort when qcom_ubwc_config_get_data() returns an error. Instead the mismatch is now made unconfigurable with 'depends on QCOM_SMEM || QCOM_SMEM=n' on both drivers, so the header keeps the plain IS_ENABLED() test.
- Reordered so the selects are guarded first and the QCOM_SMEM dependency is added to QCOM_UBWC_CONFIG last so that we dont break bisection as pointed by Nathan

Link to v4:
- https://lore.kernel.org/imx/[email protected]/

Daniel Baluta (3):
drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM
media: iris: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM
soc: qcom: ubwc: Fix link error when QCOM_SMEM=n

 drivers/gpu/drm/msm/Kconfig              | 3 ++-
 drivers/media/platform/qcom/iris/Kconfig | 3 ++-
 drivers/soc/qcom/Kconfig                 | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH v5 1/3 drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

QCOM_UBWC_CONFIG is about to depend on QCOM_SMEM. Guard the DRM_MSM select with 'if ARCH_QCOM && QCOM_SMEM', and add 'depends on QCOM_SMEM || QCOM_SMEM=n' so a built-in driver is never selected against a missing or modular SMEM.

Fixes 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")
---
 drivers/gpu/drm/msm/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/Kconfig +2 -1
index 09469d56513b0..ed1c4775d1e92 100644
@@ -11,6 +11,7 @@ config DRM_MSM
 	depends on QCOM_OCMEM || QCOM_OCMEM=n
 	depends on QCOM_LLCC || QCOM_LLCC=n
 	depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
+	depends on QCOM_SMEM || QCOM_SMEM=n
 	depends on PM
 	select IOMMU_IO_PGTABLE
 	select QCOM_MDT_LOADER if ARCH_QCOM
@@ -22,7 +23,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
Signature · 1 line
2.45.2
#2 lore raw

Re: [PATCH v5 1/3] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Incomplete Kconfig dependency preparation: VIDEO_QCOM_IRIS also selects QCOM_UBWC_CONFIG without a…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incomplete Kconfig dependency preparation: VIDEO_QCOM_IRIS also selects QCOM_UBWC_CONFIG without a QCOM_SMEM guard. --

--- Patch [1]: [PATCH v5 1/3] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM --- commit 720508af65c7d5604eab7fac5015d0cc98c646e0
Author: Daniel Baluta <[email protected]>

drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

This commit prepares DRM_MSM for an upcoming change where QCOM_UBWC_CONFIG will depend on QCOM_SMEM. It guards the select statement and adds a dependency to prevent a built-in DRM_MSM from selecting against a modular SMEM.

Fixes 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")
Quoted 4 lines
drivers/gpu/drm/msm/Kconfig +0 -0
index 09469d56513b0..ed1c4775d1e92 100644

[ ... ]

drivers/gpu/drm/msm/Kconfig config DRM_MSM · line 26

Quoted 6 lines
drivers/gpu/drm/msm/Kconfig +1 -1
@@ -22,7 +23,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: Low]
Will the upcoming change to make QCOM_UBWC_CONFIG depend on QCOM_SMEM trigger Kconfig unmet direct dependency warnings elsewhere?

It looks like VIDEO_QCOM_IRIS also unconditionally selects QCOM_UBWC_CONFIG:

drivers/media/platform/qcom/iris/Kconfig:
config VIDEO_QCOM_IRIS

	...
	select QCOM_UBWC_CONFIG

If the SMEM dependency lands before the iris driver is updated, could this cause a build breakage when compiling with VIDEO_QCOM_IRIS=y and QCOM_SMEM=n?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v5 1/3
#3 lore raw

Re: [PATCH v5 1/3] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

In reply to Daniel Baluta
Quoted 11 lines · Daniel Baluta

QCOM_UBWC_CONFIG is about to depend on QCOM_SMEM. Guard the DRM_MSM select with 'if ARCH_QCOM && QCOM_SMEM', and add 'depends on QCOM_SMEM || QCOM_SMEM=n' so a built-in driver is never selected against a missing or modular SMEM.

Fixes 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")
---
 drivers/gpu/drm/msm/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
Acked-by on v5 1/3
#4 lore raw

Re: [PATCH v5 1/3] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

In reply to Daniel Baluta
Quoted 11 lines · Daniel Baluta

QCOM_UBWC_CONFIG is about to depend on QCOM_SMEM. Guard the DRM_MSM select with 'if ARCH_QCOM && QCOM_SMEM', and add 'depends on QCOM_SMEM || QCOM_SMEM=n' so a built-in driver is never selected against a missing or modular SMEM.

Fixes 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")
---
 drivers/gpu/drm/msm/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

FWIW, for taking it through soc tree:

(Rob was also fine with that in private communication)

Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v5 1/3
#5 lore raw

Re: [PATCH v5 1/3] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

In reply to Daniel Baluta
Quoted 8 lines · Daniel Baluta

QCOM_UBWC_CONFIG is about to depend on QCOM_SMEM. Guard the DRM_MSM select with 'if ARCH_QCOM && QCOM_SMEM', and add 'depends on QCOM_SMEM || QCOM_SMEM=n' so a built-in driver is never selected against a missing or modular SMEM.

Fixes 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")

---

Konrad

#6 lore raw

PATCH v5 2/3 media: iris: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

In reply to Daniel Baluta

QCOM_UBWC_CONFIG is about to depend on QCOM_SMEM. Guard the VIDEO_QCOM_IRIS select with 'if ARCH_QCOM && QCOM_SMEM', and add 'depends on QCOM_SMEM || QCOM_SMEM=n' so a built-in driver is never selected against a missing or modular SMEM.

Fixes c43207553867 ("media: iris: retrieve UBWC platform configuration")
---
 drivers/media/platform/qcom/iris/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/Kconfig +2 -1
index 388c9bbc81365..0996213e71e7a 100644
@@ -2,11 +2,12 @@ config VIDEO_QCOM_IRIS
 	tristate "Qualcomm iris V4L2 decoder driver"
 	depends on VIDEO_DEV
 	depends on ARCH_QCOM || COMPILE_TEST
+	depends on QCOM_SMEM || QCOM_SMEM=n
 	select V4L2_MEM2MEM_DEV
 	select QCOM_MDT_LOADER
 	select QCOM_SCM
 	select QCOM_PAS
-	select QCOM_UBWC_CONFIG
+	select QCOM_UBWC_CONFIG if ARCH_QCOM && QCOM_SMEM
 	select VIDEOBUF2_DMA_CONTIG
 	help
 	  This is a V4L2 driver for Qualcomm iris video accelerator
Signature · 1 line
2.45.2
Reviewed-by on v5 2/3
#7 lore raw

Re: [PATCH v5 2/3] media: iris: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

Quoted 8 lines · Daniel Baluta

QCOM_UBWC_CONFIG is about to depend on QCOM_SMEM. Guard the VIDEO_QCOM_IRIS select with 'if ARCH_QCOM && QCOM_SMEM', and add 'depends on QCOM_SMEM || QCOM_SMEM=n' so a built-in driver is never selected against a missing or modular SMEM.

Fixes c43207553867 ("media: iris: retrieve UBWC platform configuration")

---

Konrad

#8 lore raw

PATCH v5 3/3 soc: qcom: ubwc: Fix link error when QCOM_SMEM=n

In reply to Daniel Baluta

ubwc_config.c calls qcom_smem_is_available() and qcom_smem_dram_get_hbb() unconditionally, so QCOM_UBWC_CONFIG=y with QCOM_SMEM=n fails to link:

arm-linux-gnueabihf-ld: ubwc_config.c:(.text+0x2c): undefined
reference to 'qcom_smem_is_available'

Add the missing 'depends on QCOM_SMEM'.

Fixes 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")
---
 drivers/soc/qcom/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/soc/qcom/Kconfig +1 -0
index fd4d4ecd2df0f..e0629e9328c87 100644
@@ -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
Reviewed-by on v5 3/3
#9 lore raw
Quoted 11 lines · Daniel Baluta

ubwc_config.c calls qcom_smem_is_available() and qcom_smem_dram_get_hbb() unconditionally, so QCOM_UBWC_CONFIG=y with QCOM_SMEM=n fails to link:

arm-linux-gnueabihf-ld: ubwc_config.c:(.text+0x2c): undefined
reference to 'qcom_smem_is_available'

Add the missing 'depends on QCOM_SMEM'.

Fixes 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")

---

Konrad