mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/3] soc: qcom: ubwc: Fix link error
@ 2026-08-12 15:19 Daniel Baluta
  2026-08-12 15:19 ` [PATCH v4 1/3] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Daniel Baluta @ 2026-08-12 15:19 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: robin.clark, dmitry.baryshkov, linux-arm-msm, linux-kernel,
	nathan, imx, Daniel Baluta

Fix link error caused by the fact that drivers/soc/qcom/ubwc_config.c
enabled via QCOM_UBWC_CONFIG uses unconditionally symbols from
drivers/soc/qcom/smem.c enabled via CONFIG_QCOM_SMEM.

Changes since v3:
- fix issues pointed by sashiko https://sashiko.dev/#/patchset/20260812130421.670527-1-daniel.baluta%40nxp.com
 - add new patches 2/3 in order to fix unmet dependcy for VIDEO_QCOM_IRIS
 - Use IS_REACHABLE instead of IS_ENABLED to avoid the situation we use
   some symbols in builtin kernel but their definitions sits in a
module.

Remark for Dmitry, at this point I think v1 would have been a better
option.
Link to v1:
-	https://lore.kernel.org/imx/1521da8e-18df-4d7b-a255-5ca133bd5ccc@oss.nxp.com/T/#t



Daniel Baluta (3):
  soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
  media: iris: Fix unmet dependency when QCOM_SMEM=n
  soc: qcom: ubwc: Use IS_REACHABLE() instead of IS_ENABLED()

 drivers/gpu/drm/msm/Kconfig              | 2 +-
 drivers/media/platform/qcom/iris/Kconfig | 2 +-
 drivers/soc/qcom/Kconfig                 | 1 +
 include/linux/soc/qcom/ubwc.h            | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 1/3] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
  2026-08-12 15:19 [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Daniel Baluta
@ 2026-08-12 15:19 ` Daniel Baluta
  2026-08-12 15:19 ` [PATCH v4 2/3] media: iris: Fix unmet dependency " Daniel Baluta
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Baluta @ 2026-08-12 15:19 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: robin.clark, dmitry.baryshkov, linux-arm-msm, linux-kernel,
	nathan, imx, Daniel Baluta

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.

Fixes: 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 drivers/gpu/drm/msm/Kconfig | 2 +-
 drivers/soc/qcom/Kconfig    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 09469d56513b0..1670dbc9464c6 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -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
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index fd4d4ecd2df0f..e0629e9328c87 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -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
-- 
2.45.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 2/3] media: iris: Fix unmet dependency when QCOM_SMEM=n
  2026-08-12 15:19 [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Daniel Baluta
  2026-08-12 15:19 ` [PATCH v4 1/3] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
@ 2026-08-12 15:19 ` Daniel Baluta
  2026-08-12 15:19 ` [PATCH v4 3/3] soc: qcom: ubwc: Use IS_REACHABLE() instead of IS_ENABLED() Daniel Baluta
  2026-08-13 23:23 ` [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Nathan Chancellor
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Baluta @ 2026-08-12 15:19 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: robin.clark, dmitry.baryshkov, linux-arm-msm, linux-kernel,
	nathan, imx, Daniel Baluta

VIDEO_QCOM_IRIS unconditionally selects QCOM_UBWC_CONFIG, violating the
Kconfig rule that a selecting symbol must carry all dependencies of the
selected one.  QCOM_UBWC_CONFIG now depends on QCOM_SMEM, so with
COMPILE_TEST and QCOM_SMEM=n Kconfig forces QCOM_UBWC_CONFIG=y and the
build fails with an undefined reference to qcom_smem_is_available.

Guard the select the same way DRM_MSM already does.

Fixes: c43207553867 ("media: iris: retrieve UBWC platform configuration")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 drivers/media/platform/qcom/iris/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/iris/Kconfig b/drivers/media/platform/qcom/iris/Kconfig
index 388c9bbc81365..04a4440a2dd51 100644
--- a/drivers/media/platform/qcom/iris/Kconfig
+++ b/drivers/media/platform/qcom/iris/Kconfig
@@ -6,7 +6,7 @@ config VIDEO_QCOM_IRIS
 	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
-- 
2.45.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 3/3] soc: qcom: ubwc: Use IS_REACHABLE() instead of IS_ENABLED()
  2026-08-12 15:19 [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Daniel Baluta
  2026-08-12 15:19 ` [PATCH v4 1/3] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
  2026-08-12 15:19 ` [PATCH v4 2/3] media: iris: Fix unmet dependency " Daniel Baluta
@ 2026-08-12 15:19 ` Daniel Baluta
  2026-08-13 23:23 ` [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Nathan Chancellor
  3 siblings, 0 replies; 7+ messages in thread
From: Daniel Baluta @ 2026-08-12 15:19 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: robin.clark, dmitry.baryshkov, linux-arm-msm, linux-kernel,
	nathan, imx, Daniel Baluta

When DRM_MSM=y and QCOM_SMEM=m, the conditional select evaluates to 'm'
so QCOM_UBWC_CONFIG=m.  IS_ENABLED() is true for both =y and =m, so the
real qcom_ubwc_config_get_data() declaration is exposed to built-in
callers, which cannot resolve it at vmlinux link time.

IS_REACHABLE() is false when the caller is built-in and the dependency is
only a module, causing the inline stub to be used instead.

Fixes: 1b445022d1d0 ("soc: qcom: ubwc: Get HBB from SMEM")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 include/linux/soc/qcom/ubwc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/soc/qcom/ubwc.h b/include/linux/soc/qcom/ubwc.h
index a7372d9c25fbc..1a61238f6d4d5 100644
--- a/include/linux/soc/qcom/ubwc.h
+++ b/include/linux/soc/qcom/ubwc.h
@@ -36,7 +36,7 @@ struct qcom_ubwc_cfg_data {
 #define UBWC_5_0 0x50000000
 #define UBWC_6_0 0x60000000
 
-#if IS_ENABLED(CONFIG_QCOM_UBWC_CONFIG)
+#if IS_REACHABLE(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)
-- 
2.45.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/3] soc: qcom: ubwc: Fix link error
  2026-08-12 15:19 [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Daniel Baluta
                   ` (2 preceding siblings ...)
  2026-08-12 15:19 ` [PATCH v4 3/3] soc: qcom: ubwc: Use IS_REACHABLE() instead of IS_ENABLED() Daniel Baluta
@ 2026-08-13 23:23 ` Nathan Chancellor
  2026-08-14  6:42   ` Daniel Baluta
  3 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2026-08-13 23:23 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: andersson, konradybcio, robin.clark, dmitry.baryshkov,
	linux-arm-msm, linux-kernel, imx

Hi Daniel,

On Wed, Aug 12, 2026 at 06:19:31PM +0300, Daniel Baluta wrote:
> Fix link error caused by the fact that drivers/soc/qcom/ubwc_config.c
> enabled via QCOM_UBWC_CONFIG uses unconditionally symbols from
> drivers/soc/qcom/smem.c enabled via CONFIG_QCOM_SMEM.
> 
> Changes since v3:
> - fix issues pointed by sashiko https://sashiko.dev/#/patchset/20260812130421.670527-1-daniel.baluta%40nxp.com
>  - add new patches 2/3 in order to fix unmet dependcy for VIDEO_QCOM_IRIS
>  - Use IS_REACHABLE instead of IS_ENABLED to avoid the situation we use
>    some symbols in builtin kernel but their definitions sits in a
> module.
> 
> Remark for Dmitry, at this point I think v1 would have been a better
> option.
> Link to v1:
> -	https://lore.kernel.org/imx/1521da8e-18df-4d7b-a255-5ca133bd5ccc@oss.nxp.com/T/#t
> 
> 
> 
> Daniel Baluta (3):
>   soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
>   media: iris: Fix unmet dependency when QCOM_SMEM=n

I think this patch should come first since you introduce the QCOM_SMEM
dependency that requires this change in the first patch, which could
mess with bisects. I would personally add the 'if' condition to the
'select QCOM_UBWC_CONFIG' statements in one patch then add the QCOM_SMEM
dependency to QCOM_UBWC_CONFIG in a separate patch.

>   soc: qcom: ubwc: Use IS_REACHABLE() instead of IS_ENABLED()

Even with this series applied, I see

  $ cat allno.config
  CONFIG_ARCH_MULTI_V7=y
  CONFIG_ARCH_QCOM=y
  CONFIG_DRM=y
  CONFIG_DRM_MSM=y
  CONFIG_DRM_MSM_DPU=y
  CONFIG_IOMMU_SUPPORT=y
  CONFIG_MAILBOX=y
  CONFIG_MMU=y
  CONFIG_PM=y
  CONFIG_QCOM_AOSS_QMP=y
  CONFIG_QCOM_LLCC=y
  CONFIG_QCOM_OCMEM=y

  $ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- KCONFIG_ALLCONFIG=1 allnoconfig drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.o
  In file included from drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:7:
  include/linux/soc/qcom/ubwc.h: In function 'qcom_ubwc_config_get_data':
  include/linux/soc/qcom/ubwc.h:45:16: error: implicit declaration of function 'ERR_PTR' [-Wimplicit-function-declaration]
     45 |         return ERR_PTR(-EOPNOTSUPP);
        |                ^~~~~~~
  include/linux/soc/qcom/ubwc.h:45:25: error: 'EOPNOTSUPP' undeclared (first use in this function)
     45 |         return ERR_PTR(-EOPNOTSUPP);
        |                         ^~~~~~~~~~
  include/linux/soc/qcom/ubwc.h:45:25: note: each undeclared identifier is reported only once for each function it appears in
  In file included from include/linux/cleanup.h:6,
                   from include/linux/irqflags.h:17,
                   from arch/arm/include/asm/bitops.h:28,
                   from include/linux/bitops.h:67,
                   from include/linux/kernel.h:23,
                   from drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h:10,
                   from drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h:8,
                   from drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:9:
  include/linux/err.h: At top level:
  include/linux/err.h:39:44: error: conflicting types for 'ERR_PTR'; have 'void *(long int)'
     39 | static __always_inline void * __must_check ERR_PTR(long error)
        |                                            ^~~~~~~
  include/linux/soc/qcom/ubwc.h:45:16: note: previous implicit declaration of 'ERR_PTR' with type 'int()'
     45 |         return ERR_PTR(-EOPNOTSUPP);
        |                ^~~~~~~

Adding '#include <linux/err.h>' to include/linux/soc/qcom/ubwc.h appears
to resolve that for me.

-- 
Cheers,
Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/3] soc: qcom: ubwc: Fix link error
  2026-08-13 23:23 ` [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Nathan Chancellor
@ 2026-08-14  6:42   ` Daniel Baluta
  2026-08-14 17:06     ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Baluta @ 2026-08-14  6:42 UTC (permalink / raw)
  To: Nathan Chancellor, Daniel Baluta
  Cc: andersson, konradybcio, robin.clark, dmitry.baryshkov,
	linux-arm-msm, linux-kernel, imx

On 8/14/26 02:23, Nathan Chancellor wrote:
> [You don't often get email from nathan@kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> Hi Daniel,
> 
> On Wed, Aug 12, 2026 at 06:19:31PM +0300, Daniel Baluta wrote:
>> Fix link error caused by the fact that drivers/soc/qcom/ubwc_config.c
>> enabled via QCOM_UBWC_CONFIG uses unconditionally symbols from
>> drivers/soc/qcom/smem.c enabled via CONFIG_QCOM_SMEM.
>>
>> Changes since v3:
>> - fix issues pointed by sashiko https://sashiko.dev/#/patchset/20260812130421.670527-1-daniel.baluta%40nxp.com
>>  - add new patches 2/3 in order to fix unmet dependcy for VIDEO_QCOM_IRIS
>>  - Use IS_REACHABLE instead of IS_ENABLED to avoid the situation we use
>>    some symbols in builtin kernel but their definitions sits in a
>> module.
>>
>> Remark for Dmitry, at this point I think v1 would have been a better
>> option.
>> Link to v1:
>> -     https://lore.kernel.org/imx/1521da8e-18df-4d7b-a255-5ca133bd5ccc@oss.nxp.com/T/#t
>>
>>
>>
>> Daniel Baluta (3):
>>   soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
>>   media: iris: Fix unmet dependency when QCOM_SMEM=n
> 
> I think this patch should come first since you introduce the QCOM_SMEM
> dependency that requires this change in the first patch, which could
> mess with bisects. I would personally add the 'if' condition to the
> 'select QCOM_UBWC_CONFIG' statements in one patch then add the QCOM_SMEM
> dependency to QCOM_UBWC_CONFIG in a separate patch.
> 
>>   soc: qcom: ubwc: Use IS_REACHABLE() instead of IS_ENABLED()
> 
> Even with this series applied, I see
> 
>   $ cat allno.config
>   CONFIG_ARCH_MULTI_V7=y
>   CONFIG_ARCH_QCOM=y
>   CONFIG_DRM=y
>   CONFIG_DRM_MSM=y
>   CONFIG_DRM_MSM_DPU=y
>   CONFIG_IOMMU_SUPPORT=y
>   CONFIG_MAILBOX=y
>   CONFIG_MMU=y
>   CONFIG_PM=y
>   CONFIG_QCOM_AOSS_QMP=y
>   CONFIG_QCOM_LLCC=y
>   CONFIG_QCOM_OCMEM=y
> 
>   $ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- KCONFIG_ALLCONFIG=1 allnoconfig drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.o
>   In file included from drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:7:
>   include/linux/soc/qcom/ubwc.h: In function 'qcom_ubwc_config_get_data':
>   include/linux/soc/qcom/ubwc.h:45:16: error: implicit declaration of function 'ERR_PTR' [-Wimplicit-function-declaration]
>      45 |         return ERR_PTR(-EOPNOTSUPP);
>         |                ^~~~~~~
>   include/linux/soc/qcom/ubwc.h:45:25: error: 'EOPNOTSUPP' undeclared (first use in this function)

Hi Nathan,

This issue is pre-existing and I've sent a separate fix for it:

https://lore.kernel.org/all/5fy7l6o5nfzclsmhsqys562xwoilbo4xv3af65kcqugtitgltd@3fw2w443pw2g/#r


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/3] soc: qcom: ubwc: Fix link error
  2026-08-14  6:42   ` Daniel Baluta
@ 2026-08-14 17:06     ` Nathan Chancellor
  0 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2026-08-14 17:06 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Daniel Baluta, andersson, konradybcio, robin.clark,
	dmitry.baryshkov, linux-arm-msm, linux-kernel, imx

On Fri, Aug 14, 2026 at 09:42:52AM +0300, Daniel Baluta wrote:
> On 8/14/26 02:23, Nathan Chancellor wrote:
> >   In file included from drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:7:
> >   include/linux/soc/qcom/ubwc.h: In function 'qcom_ubwc_config_get_data':
> >   include/linux/soc/qcom/ubwc.h:45:16: error: implicit declaration of function 'ERR_PTR' [-Wimplicit-function-declaration]
> >      45 |         return ERR_PTR(-EOPNOTSUPP);
> >         |                ^~~~~~~
> >   include/linux/soc/qcom/ubwc.h:45:25: error: 'EOPNOTSUPP' undeclared (first use in this function)
> 
> Hi Nathan,
> 
> This issue is pre-existing and I've sent a separate fix for it:
> 
> https://lore.kernel.org/all/5fy7l6o5nfzclsmhsqys562xwoilbo4xv3af65kcqugtitgltd@3fw2w443pw2g/#r

Sure, it is a pre-existing issue but it is only exposed by making
CONFIG_QCOM_UBWC_CONFIG an optional selection for these drivers, so I
think that patch should be a part of this series. Otherwise, I don't see
how you could actually trigger such an error.

-- 
Cheers,
Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-14 17:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-12 15:19 [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Daniel Baluta
2026-08-12 15:19 ` [PATCH v4 1/3] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
2026-08-12 15:19 ` [PATCH v4 2/3] media: iris: Fix unmet dependency " Daniel Baluta
2026-08-12 15:19 ` [PATCH v4 3/3] soc: qcom: ubwc: Use IS_REACHABLE() instead of IS_ENABLED() Daniel Baluta
2026-08-13 23:23 ` [PATCH v4 0/3] soc: qcom: ubwc: Fix link error Nathan Chancellor
2026-08-14  6:42   ` Daniel Baluta
2026-08-14 17:06     ` Nathan Chancellor

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®