Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
@ 2026-08-17 12:35 Daniel Baluta
  2026-08-17 12:35 ` [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM Daniel Baluta
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Daniel Baluta @ 2026-08-17 12:35 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: dmitry.baryshkov, linux-arm-msm, linux-kernel, imx, nathan,
	Daniel Baluta

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 v5:
 * added patch 4/4 to this series, which was initially sent as a
 standalone patch (addresses review from Nathan)
 * no other change to the series.
 * picked up all R-b and Acked-by tags.

Link to v5: https://lore.kernel.org/imx/20260814141724.1006382-1-daniel.baluta@nxp.com/T/#t

Daniel Baluta (4):
  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
  soc: qcom: ubwc: Fix missing include

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

-- 
2.45.2


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

* [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM
  2026-08-17 12:35 [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
@ 2026-08-17 12:35 ` Daniel Baluta
  2026-08-17 12:41   ` sashiko-bot
  2026-08-17 12:35 ` [PATCH v6 2/4] media: iris: " Daniel Baluta
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Daniel Baluta @ 2026-08-17 12:35 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: dmitry.baryshkov, linux-arm-msm, linux-kernel, imx, nathan,
	Daniel Baluta, Konrad Dybcio

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")
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 drivers/gpu/drm/msm/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 09469d56513b0..ed1c4775d1e92 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -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
-- 
2.45.2


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

* [PATCH v6 2/4] media: iris: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM
  2026-08-17 12:35 [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
  2026-08-17 12:35 ` [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM Daniel Baluta
@ 2026-08-17 12:35 ` Daniel Baluta
  2026-08-17 12:35 ` [PATCH v6 3/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Daniel Baluta @ 2026-08-17 12:35 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: dmitry.baryshkov, linux-arm-msm, linux-kernel, imx, nathan,
	Daniel Baluta, Konrad Dybcio

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")
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 drivers/media/platform/qcom/iris/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/iris/Kconfig b/drivers/media/platform/qcom/iris/Kconfig
index 388c9bbc81365..0996213e71e7a 100644
--- a/drivers/media/platform/qcom/iris/Kconfig
+++ b/drivers/media/platform/qcom/iris/Kconfig
@@ -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
-- 
2.45.2


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

* [PATCH v6 3/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
  2026-08-17 12:35 [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
  2026-08-17 12:35 ` [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM Daniel Baluta
  2026-08-17 12:35 ` [PATCH v6 2/4] media: iris: " Daniel Baluta
@ 2026-08-17 12:35 ` Daniel Baluta
  2026-08-17 12:35 ` [PATCH v6 4/4] soc: qcom: ubwc: Fix missing include Daniel Baluta
  2026-08-17 18:17 ` [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Nathan Chancellor
  4 siblings, 0 replies; 8+ messages in thread
From: Daniel Baluta @ 2026-08-17 12:35 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: dmitry.baryshkov, linux-arm-msm, linux-kernel, imx, nathan,
	Daniel Baluta, Konrad Dybcio

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")
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 drivers/soc/qcom/Kconfig | 1 +
 1 file changed, 1 insertion(+)

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 related	[flat|nested] 8+ messages in thread

* [PATCH v6 4/4] soc: qcom: ubwc: Fix missing include
  2026-08-17 12:35 [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
                   ` (2 preceding siblings ...)
  2026-08-17 12:35 ` [PATCH v6 3/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
@ 2026-08-17 12:35 ` Daniel Baluta
  2026-08-17 12:42   ` sashiko-bot
  2026-08-17 18:17 ` [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Nathan Chancellor
  4 siblings, 1 reply; 8+ messages in thread
From: Daniel Baluta @ 2026-08-17 12:35 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: dmitry.baryshkov, linux-arm-msm, linux-kernel, imx, nathan,
	Daniel Baluta, Konrad Dybcio

When CONFIG_QCOM_UBWC_CONFIG=n, compiler needs to know the definition
of ERR_PTR otherwise there will be a compilation error:

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]

Fix this by including <linux/err.h>

Fixes: 1924272b9ce1 ("soc: qcom: Add UBWC config provider")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 include/linux/soc/qcom/ubwc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/soc/qcom/ubwc.h b/include/linux/soc/qcom/ubwc.h
index a7372d9c25fbc..f3a70360b177b 100644
--- a/include/linux/soc/qcom/ubwc.h
+++ b/include/linux/soc/qcom/ubwc.h
@@ -8,6 +8,7 @@
 #define __QCOM_UBWC_H__
 
 #include <linux/bits.h>
+#include <linux/err.h>
 #include <linux/printk.h>
 #include <linux/types.h>
 
-- 
2.45.2


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

* Re: [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM
  2026-08-17 12:35 ` [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM Daniel Baluta
@ 2026-08-17 12:41   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-08-17 12:41 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: imx, Frank.Li

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Conditionally selecting QCOM_UBWC_CONFIG without adding `depends on QCOM_UBWC_CONFIG || QCOM_UBWC_CONFIG=n` causes an undefined reference linker error when DRM_MSM is built-in (=y) and QCOM_UBWC_CONFIG is a module (=m).
--

--- Patch [1]: [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM ---
commit 353149f56be7035f090eb09914820d684b1f59f4
Author: Daniel Baluta <daniel.baluta@nxp.com>

drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM

This commit guards the DRM_MSM select of QCOM_UBWC_CONFIG with an
architecture and SMEM check. It also adds a dependency to ensure a
built-in driver is never selected against a modular SMEM.

> diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
> index 09469d56513b0..ed1c4775d1e92 100644
> --- a/drivers/gpu/drm/msm/Kconfig
> +++ b/drivers/gpu/drm/msm/Kconfig
[ ... ]
> @@ -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]
Does this conditional select cause an undefined reference linker error when
DRM_MSM is built-in (=y) and QCOM_UBWC_CONFIG is built as a module (=m)?

If the kernel is configured with CONFIG_DRM_MSM=y, CONFIG_COMPILE_TEST=y,
and CONFIG_ARCH_QCOM=n, this conditional select is bypassed. 

If another driver (such as VIDEO_QCOM_IRIS) then selects QCOM_UBWC_CONFIG
as a module, the built-in DRM_MSM driver will fail to link. This happens
because include/linux/soc/qcom/ubwc.h uses IS_ENABLED(CONFIG_QCOM_UBWC_CONFIG)
instead of IS_REACHABLE(), so the header provides an external declaration
rather than a static inline stub.

Should this config also include "depends on QCOM_UBWC_CONFIG ||
QCOM_UBWC_CONFIG=n" to prevent the built-in driver from being selected
against a missing or modular UBWC dependency?

>  	select WANT_DEV_COREDUMP
>  	select SND_SOC_HDMI_CODEC if SND_SOC
>  	select SYNC_FILE

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817123542.48475-1-daniel.baluta@nxp.com?part=1

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

* Re: [PATCH v6 4/4] soc: qcom: ubwc: Fix missing include
  2026-08-17 12:35 ` [PATCH v6 4/4] soc: qcom: ubwc: Fix missing include Daniel Baluta
@ 2026-08-17 12:42   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-08-17 12:42 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: Frank.Li, imx

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing cleanup in `a5xx_gpu_init()` when `qcom_ubwc_config_get_data()` returns an error, leading to a memory and resource leak.
--

--- Patch [4]: [PATCH v6 4/4] soc: qcom: ubwc: Fix missing include ---
commit 8a6d2fb79b4edaad79d216dc3cc985d7cf39e314
Author: Daniel Baluta <daniel.baluta@nxp.com>

soc: qcom: ubwc: Fix missing include

This commit adds the <linux/err.h> include to ubwc.h to resolve a compilation
error regarding the implicit declaration of ERR_PTR when
CONFIG_QCOM_UBWC_CONFIG=n.

Fixes: 1924272b9ce1 ("soc: qcom: Add UBWC config provider")

> diff --git a/include/linux/soc/qcom/ubwc.h b/include/linux/soc/qcom/ubwc.h
> index a7372d9c25fbc..f3a70360b177b 100644
> --- a/include/linux/soc/qcom/ubwc.h
> +++ b/include/linux/soc/qcom/ubwc.h
> @@ -8,6 +8,7 @@
>  #define __QCOM_UBWC_H__
>  
>  #include <linux/bits.h>
> +#include <linux/err.h>

[Severity: High]
This isn't a bug introduced by this patch, but it brings attention to a
potential memory and resource leak in a5xx_gpu_init() when it calls
qcom_ubwc_config_get_data().

If qcom_ubwc_config_get_data() returns -EPROBE_DEFER (when SMEM is unavailable)
or -EOPNOTSUPP (when CONFIG_QCOM_UBWC_CONFIG=n), the function returns the error
directly without tearing down the initialized GPU resources via a5xx_destroy():

drivers/gpu/drm/msm/adreno/a5xx_gpu.c:a5xx_gpu_init() {
    ...
	/* Inherit the common config and make some necessary fixups */
	adreno_gpu->ubwc_config = qcom_ubwc_config_get_data();
	if (IS_ERR(adreno_gpu->ubwc_config))
		return ERR_CAST(adreno_gpu->ubwc_config);
    ...
}

Because qcom_ubwc_config_get_data() actively returns -EPROBE_DEFER when SMEM
isn't ready, this error path will be taken during standard boot sequences where
SMEM probes after the GPU.

Does this code leak the a5xx_gpu structure and ringbuffers initialized by
adreno_gpu_init() on each deferral?

>  #include <linux/printk.h>
>  #include <linux/types.h>
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817123542.48475-1-daniel.baluta@nxp.com?part=4

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

* Re: [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n
  2026-08-17 12:35 [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
                   ` (3 preceding siblings ...)
  2026-08-17 12:35 ` [PATCH v6 4/4] soc: qcom: ubwc: Fix missing include Daniel Baluta
@ 2026-08-17 18:17 ` Nathan Chancellor
  4 siblings, 0 replies; 8+ messages in thread
From: Nathan Chancellor @ 2026-08-17 18:17 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: andersson, konradybcio, dmitry.baryshkov, linux-arm-msm,
	linux-kernel, imx

Hi Daniel,

On Mon, Aug 17, 2026 at 03:35:37PM +0300, Daniel Baluta wrote:
> 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 v5:
>  * added patch 4/4 to this series, which was initially sent as a
>  standalone patch (addresses review from Nathan)
>  * no other change to the series.
>  * picked up all R-b and Acked-by tags.
> 
> Link to v5: https://lore.kernel.org/imx/20260814141724.1006382-1-daniel.baluta@nxp.com/T/#t
> 
> Daniel Baluta (4):
>   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
>   soc: qcom: ubwc: Fix missing include
> 
>  drivers/gpu/drm/msm/Kconfig              | 3 ++-
>  drivers/media/platform/qcom/iris/Kconfig | 3 ++-
>  drivers/soc/qcom/Kconfig                 | 1 +
>  include/linux/soc/qcom/ubwc.h            | 1 +
>  4 files changed, 6 insertions(+), 2 deletions(-)

Thanks, this resolves the build errors that I noticed.

Tested-by: Nathan Chancellor <nathan@kernel.org> # build

-- 
Cheers,
Nathan

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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 12:35 [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
2026-08-17 12:35 ` [PATCH v6 1/4] drm/msm: Guard the QCOM_UBWC_CONFIG select with QCOM_SMEM Daniel Baluta
2026-08-17 12:41   ` sashiko-bot
2026-08-17 12:35 ` [PATCH v6 2/4] media: iris: " Daniel Baluta
2026-08-17 12:35 ` [PATCH v6 3/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Daniel Baluta
2026-08-17 12:35 ` [PATCH v6 4/4] soc: qcom: ubwc: Fix missing include Daniel Baluta
2026-08-17 12:42   ` sashiko-bot
2026-08-17 18:17 ` [PATCH v6 0/4] soc: qcom: ubwc: Fix link error when QCOM_SMEM=n Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox