[PATCH 8/9] drm/rockchip: Drop ROCKCHIP_IOMMU depend for DRM_ROCKCHIP

Chaoyi Chen posted 9 patches 3 months ago
[PATCH 8/9] drm/rockchip: Drop ROCKCHIP_IOMMU depend for DRM_ROCKCHIP
Posted by Chaoyi Chen 3 months ago
From: Chaoyi Chen <chaoyi.chen@rock-chips.com>

On the RK3506 platform, there is no iommu hardware. And even on
platform that have iommu hardware, it should be possible to use
VOP without enabling iommu. In this case, a contiguous memory
space like CMA should be used.

So this patch removes the dependency on ROCKCHIP_IOMMU.

Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
 drivers/gpu/drm/rockchip/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index b7b025814e72..a056d419190c 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_ROCKCHIP
 	tristate "DRM Support for Rockchip"
-	depends on DRM && ROCKCHIP_IOMMU
+	depends on DRM
+	depends on ROCKCHIP_IOMMU || !ROCKCHIP_IOMMU
 	depends on OF
 	select DRM_CLIENT_SELECTION
 	select DRM_GEM_DMA_HELPER
-- 
2.51.1
Re: [PATCH 8/9] drm/rockchip: Drop ROCKCHIP_IOMMU depend for DRM_ROCKCHIP
Posted by Heiko Stuebner 1 month ago
Am Donnerstag, 6. November 2025, 03:06:31 Mitteleuropäische Normalzeit schrieb Chaoyi Chen:
> From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
> 
> On the RK3506 platform, there is no iommu hardware. And even on
> platform that have iommu hardware, it should be possible to use
> VOP without enabling iommu. In this case, a contiguous memory
> space like CMA should be used.
> 
> So this patch removes the dependency on ROCKCHIP_IOMMU.
> 
> Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
> ---
>  drivers/gpu/drm/rockchip/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
> index b7b025814e72..a056d419190c 100644
> --- a/drivers/gpu/drm/rockchip/Kconfig
> +++ b/drivers/gpu/drm/rockchip/Kconfig
> @@ -1,7 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  config DRM_ROCKCHIP
>  	tristate "DRM Support for Rockchip"
> -	depends on DRM && ROCKCHIP_IOMMU
> +	depends on DRM
> +	depends on ROCKCHIP_IOMMU || !ROCKCHIP_IOMMU

I don't really understand this yes+no line :-)

Can't you just
- drop the dependency altogether
or
- do a depends on ROCKCHIP_IOMMU if ARM64


Heiko

>  	depends on OF
>  	select DRM_CLIENT_SELECTION
>  	select DRM_GEM_DMA_HELPER
> 
Re: [PATCH 8/9] drm/rockchip: Drop ROCKCHIP_IOMMU depend for DRM_ROCKCHIP
Posted by Chaoyi Chen 1 month ago
Hi Heiko,

On 1/9/2026 3:03 AM, Heiko Stuebner wrote:
> Am Donnerstag, 6. November 2025, 03:06:31 Mitteleuropäische Normalzeit schrieb Chaoyi Chen:
>> From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
>>
>> On the RK3506 platform, there is no iommu hardware. And even on
>> platform that have iommu hardware, it should be possible to use
>> VOP without enabling iommu. In this case, a contiguous memory
>> space like CMA should be used.
>>
>> So this patch removes the dependency on ROCKCHIP_IOMMU.
>>
>> Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
>> ---
>>  drivers/gpu/drm/rockchip/Kconfig | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
>> index b7b025814e72..a056d419190c 100644
>> --- a/drivers/gpu/drm/rockchip/Kconfig
>> +++ b/drivers/gpu/drm/rockchip/Kconfig
>> @@ -1,7 +1,8 @@
>>  # SPDX-License-Identifier: GPL-2.0-only
>>  config DRM_ROCKCHIP
>>  	tristate "DRM Support for Rockchip"
>> -	depends on DRM && ROCKCHIP_IOMMU
>> +	depends on DRM
>> +	depends on ROCKCHIP_IOMMU || !ROCKCHIP_IOMMU
> 
> I don't really understand this yes+no line :-)
> 
> Can't you just
> - drop the dependency altogether
> or
> - do a depends on ROCKCHIP_IOMMU if ARM64
> 
>

This trick is called optional-dependencies [0]. In addition to the 
familiar depends on ROCKCHIP_IOMMU part, the newly added !ROCKCHIP_IOMMU
ensures that DRM_ROCKCHIP can still be built even when ROCKCHIP_IOMMU
is not build.

[0]: https://docs.kernel.org/kbuild/kconfig-language.html#optional-dependencies

If we just:
- drop the dependency altogether 

When IOMMU is enabled, the dependency relationship cannot be handled 
correctly. For example, the following configuration is possible: 
ROCKCHIP_IOMMU=m, DRM_ROCKCHIP=y, which leads to a build failure.

- do a depends on ROCKCHIP_IOMMU if ARM64

This changes the semantics. On arm64 we should also be able to work
without IOMMU being enabled.

-- 
Best, 
Chaoyi
Re: [PATCH 8/9] drm/rockchip: Drop ROCKCHIP_IOMMU depend for DRM_ROCKCHIP
Posted by Heiko Stübner 4 weeks, 1 day ago
Hi,

Am Freitag, 9. Januar 2026, 02:26:00 Mitteleuropäische Normalzeit schrieb Chaoyi Chen:
> On 1/9/2026 3:03 AM, Heiko Stuebner wrote:
> > Am Donnerstag, 6. November 2025, 03:06:31 Mitteleuropäische Normalzeit schrieb Chaoyi Chen:
> >> From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
> >>
> >> On the RK3506 platform, there is no iommu hardware. And even on
> >> platform that have iommu hardware, it should be possible to use
> >> VOP without enabling iommu. In this case, a contiguous memory
> >> space like CMA should be used.
> >>
> >> So this patch removes the dependency on ROCKCHIP_IOMMU.
> >>
> >> Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
> >> ---
> >>  drivers/gpu/drm/rockchip/Kconfig | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
> >> index b7b025814e72..a056d419190c 100644
> >> --- a/drivers/gpu/drm/rockchip/Kconfig
> >> +++ b/drivers/gpu/drm/rockchip/Kconfig
> >> @@ -1,7 +1,8 @@
> >>  # SPDX-License-Identifier: GPL-2.0-only
> >>  config DRM_ROCKCHIP
> >>  	tristate "DRM Support for Rockchip"
> >> -	depends on DRM && ROCKCHIP_IOMMU
> >> +	depends on DRM
> >> +	depends on ROCKCHIP_IOMMU || !ROCKCHIP_IOMMU
> > 
> > I don't really understand this yes+no line :-)
> > 
> > Can't you just
> > - drop the dependency altogether
> > or
> > - do a depends on ROCKCHIP_IOMMU if ARM64
> > 
> >
> 
> This trick is called optional-dependencies [0]. In addition to the 
> familiar depends on ROCKCHIP_IOMMU part, the newly added !ROCKCHIP_IOMMU
> ensures that DRM_ROCKCHIP can still be built even when ROCKCHIP_IOMMU
> is not build.
> 
> [0]: https://docs.kernel.org/kbuild/kconfig-language.html#optional-dependencies

thanks a lot for pointing me to this nifty feature :-)

Heiko