From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752310AbcB2Kyp (ORCPT ); Mon, 29 Feb 2016 05:54:45 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:55236 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750724AbcB2Kyn (ORCPT ); Mon, 29 Feb 2016 05:54:43 -0500 From: Arnd Bergmann To: Robin Murphy Cc: Joerg Roedel , Joerg Roedel , linux-arm-kernel@lists.infradead.org, Yong Wu , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] iommu/mediatek: select ARM_DMA_USE_IOMMU Date: Mon, 29 Feb 2016 11:53:46 +0100 Message-ID: <2734684.OJWJHS6snX@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <56D41F74.8010408@arm.com> References: <1456737553-496245-1-git-send-email-arnd@arndb.de> <56D41F74.8010408@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:P0WwIAnaeGtcPBILQvGsTYO4NwQD3otZSc4poT6iXg16Uve28j8 595SOswnrO0a1W9CZZQgACfYc01AyDHvz7c4PcBW2Yy+7++Nz2GcbLvoV29AiZqATnc7Oss HrFZT5gcLZDhzJlufneOXNNX8wNJTOXZeWuI/RwbOX6fAZpVDYdiVWC4eE6TdgYg34BENH5 4XLel+jA83yPvnMckWwsA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Yce9MYinlII=:ZbgO7aR3PJcYBzDLfvJaMu f4SwEypK8P1aXw9fbuPQEOmFPuXiEheKxd4KmOKSxzQc2w0b0jJ71z7bfooOSZsBuujd01trl V7oQXfadoDSG3C5UkfYtOlpPAU2zSRmrDvpgjtCBMBCmQHcFkbSyg5CS5rM8+FXwHB8OdaHMA 8DBZYvbQaq9BiCxyPWvI8r7VYwhoir/vUtP6Ss99v88QcF6EJmXTj0+RjRLUv2eiq8vMuUL+s zaBPJJ/4qE+eD+R/bcmI73HgzJi1waEeSUC6gGE/siRpKKmbHC6C/WvFqOehNL5C4fiOZSA6s J7zbfrBzzUt/llWgkYz3gIHy2PQNkd3sQLge5nDLN1+30kuLoWKpN2dvGeUtaPCFwVO4Y074D 7TweaVbgUxYAsxLHLVdn8OrS7WrfWmaWw2aU0MYud19Qp8Aud3LfbjlWg1Sdgw1jJWUWFEAhX uqxZgHq6oR20ce9yWlbHgPn4p0fy9mBoohB4ZINcSAEJJFjG48KALzZzIJyd7ZziqtRmfMxr7 fALX+yYCwffY3o4M1wTb7o4xFIDb7vus7L97zLQLrDx1unP96nF5nFwwS6ibArp9O/G7wf3RQ 8lCNN+kxcEWCpctxNgmyVKU+xCqfpoXqO1vojLFxOCXu9XIpXAHlTkX9cyI/dMTUQHQE/QOzk +PJzOCQF6IhGzRhJ+a0MRsQyKk18UgV6TRtuEERhu7Pj03vZKpQUMxDraR5frRNXqnJJvOftU asUoG6hl+T5kxaA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 29 February 2016 10:37:40 Robin Murphy wrote: > 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? ARM_DMA_USE_IOMMU gets this right, it selects NEED_SG_DMA_LENGTH as it actually needs it. The IOMMU_DMA symbol is a bit strange, and the dependency can probably get dropped altogether, but at least here it told us what went wrong. > > 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. Ok. > > Signed-off-by: Arnd Bergmann > > 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. That would run into the NEED_SG_DMA_LENGTH problem on other architectures that don't already set it, right? Arnd