Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1345635

Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU

From Robin Murphy <robin.murphy@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU
Date 2016-02-29 11:40 +0100
Message-ID <r7tp9-1NN-51@gated-at.bofh.it> (permalink)
References <r7sjp-198-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Arnd,

On 29/02/16 09:19, Arnd Bergmann wrote:
> The newly added Mediatek IOMMU driver uses the IOMMU_DMA infrastructure,
> but unlike other such drivers, it does not select 'ARM_DMA_USE_IOMMU',
> which is a prerequisite, leading to a link error:
>
> warning: (MTK_IOMMU) selects IOMMU_DMA which has unmet direct dependencies (IOMMU_SUPPORT && NEED_SG_DMA_LENGTH)

Going off on a tangent, is it actually right for that to depend on a 
NEED_* symbol, or should that really be a select instead?

> drivers/iommu/built-in.o: In function `iommu_put_dma_cookie':
> mtk_iommu.c:(.text+0x11fe): undefined reference to `put_iova_domain'
> drivers/iommu/built-in.o: In function `iommu_dma_init_domain':
> mtk_iommu.c:(.text+0x1316): undefined reference to `init_iova_domain'
> drivers/iommu/built-in.o: In function `__iommu_dma_unmap':
> mtk_iommu.c:(.text+0x1380): undefined reference to `find_iova'
>
> This adds the same select that the other drivers have. On a related
> note, I wonder if we should just always select ARM_DMA_USE_IOMMU
> whenever any IOMMU driver is enabled. Are there any cases where
> we would enable an IOMMU but not use it?

You could use one solely for VFIO without caring about DMA ops - I think 
that's mostly how ARM SMMUs are being used in practice at the moment - 
but DMA-focused 'media' IOMMUs vastly outnumber 'virtualisation' IOMMUs 
on ARM, so it would probably make sense. We already have the equivalent 
"select IOMMU_DMA if IOMMU_SUPPORT" on arm64.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 0df4fabe208d ("iommu/mediatek: Add mt8173 IOMMU driver")
> ---
>   drivers/iommu/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> index b325954cf8f8..ea0998921702 100644
> --- a/drivers/iommu/Kconfig
> +++ b/drivers/iommu/Kconfig
> @@ -341,6 +341,7 @@ config MTK_IOMMU
>   	bool "MTK IOMMU Support"
>   	depends on ARM || ARM64
>   	depends on ARCH_MEDIATEK || COMPILE_TEST
> +	select ARM_DMA_USE_IOMMU

If going down this route, I'd be inclined to add an "if ARM" there, just 
for clarity.

>   	select IOMMU_API
>   	select IOMMU_DMA

As above, this is already selected on arm64, and isn't used on 32-bit*, 
so could probably just be removed, especially if it leads to build issues.

Robin.

*yet, of course. I need to have a proper look over Marek's RFC ;)

>   	select IOMMU_IO_PGTABLE_ARMV7S
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Arnd Bergmann <arnd@arndb.de> - 2016-02-29 10:30 +0100
  [PATCH 2/2] iommu/mediatek: mark PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2016-02-29 10:30 +0100
    Re: [PATCH 2/2] iommu/mediatek: mark PM functions as __maybe_unused Yong Wu <yong.wu@mediatek.com> - 2016-03-01 06:10 +0100
  Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Robin Murphy <robin.murphy@arm.com> - 2016-02-29 11:40 +0100
    Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Arnd Bergmann <arnd@arndb.de> - 2016-02-29 12:00 +0100
      Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Robin Murphy <robin.murphy@arm.com> - 2016-02-29 12:30 +0100
        Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Arnd Bergmann <arnd@arndb.de> - 2016-02-29 12:40 +0100
          Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Robin Murphy <robin.murphy@arm.com> - 2016-02-29 12:50 +0100
  Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Joerg Roedel <joro@8bytes.org> - 2016-02-29 16:50 +0100

csiph-web