* [PATCH] drm/nouveau/platform: add IOMMU dependency
@ 2015-05-19 12:53 Arnd Bergmann
2015-05-19 13:32 ` Thierry Reding
2015-05-20 0:33 ` Alexandre Courbot
0 siblings, 2 replies; 9+ messages in thread
From: Arnd Bergmann @ 2015-05-19 12:53 UTC (permalink / raw)
To: David Airlie
Cc: Alexandre Courbot, Ben Skeggs, Thierry Reding, dri-devel,
linux-kernel, linux-arm-kernel
The recently added iommu code in the nouveau driver fails to build
when the IOMMU support is disabled:
drivers/gpu/drm/nouveau/nouveau_platform.c: In function 'nouveau_platform_probe_iommu':
drivers/gpu/drm/nouveau/nouveau_platform.c:113:41: error: 'const struct iommu_ops' has no mem
To avoid the build error, this now adds an explicit dependency on the
IOMMU implementation.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 58fd9375c2c5 ("drm/nouveau/platform: probe IOMMU if present")
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index 5ab13e7939db..18dfa4af60ea 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -28,6 +28,7 @@ config DRM_NOUVEAU
config NOUVEAU_PLATFORM_DRIVER
bool "Nouveau (NVIDIA) SoC GPUs"
depends on DRM_NOUVEAU && ARCH_TEGRA
+ depends on IOMMU
default y
help
Support for Nouveau platform driver, used for SoC GPUs as found
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] drm/nouveau/platform: add IOMMU dependency 2015-05-19 12:53 [PATCH] drm/nouveau/platform: add IOMMU dependency Arnd Bergmann @ 2015-05-19 13:32 ` Thierry Reding 2015-05-20 0:33 ` Alexandre Courbot 1 sibling, 0 replies; 9+ messages in thread From: Thierry Reding @ 2015-05-19 13:32 UTC (permalink / raw) To: Arnd Bergmann Cc: David Airlie, Alexandre Courbot, Ben Skeggs, dri-devel, linux-kernel, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 640 bytes --] On Tue, May 19, 2015 at 02:53:26PM +0200, Arnd Bergmann wrote: > The recently added iommu code in the nouveau driver fails to build > when the IOMMU support is disabled: > > drivers/gpu/drm/nouveau/nouveau_platform.c: In function 'nouveau_platform_probe_iommu': > drivers/gpu/drm/nouveau/nouveau_platform.c:113:41: error: 'const struct iommu_ops' has no mem > > To avoid the build error, this now adds an explicit dependency on the > IOMMU implementation. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Fixes: 58fd9375c2c5 ("drm/nouveau/platform: probe IOMMU if present") Acked-by: Thierry Reding <treding@nvidia.com> [-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/platform: add IOMMU dependency 2015-05-19 12:53 [PATCH] drm/nouveau/platform: add IOMMU dependency Arnd Bergmann 2015-05-19 13:32 ` Thierry Reding @ 2015-05-20 0:33 ` Alexandre Courbot 2015-05-20 6:10 ` [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU Alexandre Courbot 1 sibling, 1 reply; 9+ messages in thread From: Alexandre Courbot @ 2015-05-20 0:33 UTC (permalink / raw) To: Arnd Bergmann, David Airlie Cc: Ben Skeggs, Thierry Reding, dri-devel, linux-kernel, linux-arm-kernel On 05/19/2015 09:53 PM, Arnd Bergmann wrote: > The recently added iommu code in the nouveau driver fails to build > when the IOMMU support is disabled: > > drivers/gpu/drm/nouveau/nouveau_platform.c: In function 'nouveau_platform_probe_iommu': > drivers/gpu/drm/nouveau/nouveau_platform.c:113:41: error: 'const struct iommu_ops' has no mem > > To avoid the build error, this now adds an explicit dependency on the > IOMMU implementation. I have a local patch to nouveau_platform.c that only calls the IOMMU functions if CONFIG_IOMMU is set. Wouldn't this be more suitable as IOMMU support is only used by Tegra and thus not beneficial for desktop GPUs? ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU 2015-05-20 0:33 ` Alexandre Courbot @ 2015-05-20 6:10 ` Alexandre Courbot 2015-05-20 7:07 ` Arnd Bergmann 2015-05-20 11:32 ` Thierry Reding 0 siblings, 2 replies; 9+ messages in thread From: Alexandre Courbot @ 2015-05-20 6:10 UTC (permalink / raw) To: Ben Skeggs, David Airlie, Arnd Bergmann Cc: Thierry Reding, linux-arm-kernel, dri-devel, linux-kernel, gnurou, Alexandre Courbot The lack of IOMMU API support can make nouveau_platform_probe_iommu() fail to compile because struct iommu_ops is then empty. Fix this by skipping IOMMU probe in that case - lack of IOMMU on platform devices is sub-optimal, but is not an error. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> --- This is an alternative to https://lkml.org/lkml/2015/5/19/484. Most users of Nouveau do not care about IOMMU support, so we should not impose that option on them. drm/nouveau/nouveau_platform.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/nouveau/nouveau_platform.c index 775277f1edb0..dcfbbfaf1739 100644 --- a/drivers/gpu/drm/nouveau/nouveau_platform.c +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c @@ -92,6 +92,8 @@ static int nouveau_platform_power_down(struct nouveau_platform_gpu *gpu) return 0; } +#if IS_ENABLED(CONFIG_IOMMU_API) + static void nouveau_platform_probe_iommu(struct device *dev, struct nouveau_platform_gpu *gpu) { @@ -158,6 +160,20 @@ static void nouveau_platform_remove_iommu(struct device *dev, } } +#else + +static void nouveau_platform_probe_iommu(struct device *dev, + struct nouveau_platform_gpu *gpu) +{ +} + +static void nouveau_platform_remove_iommu(struct device *dev, + struct nouveau_platform_gpu *gpu) +{ +} + +#endif + static int nouveau_platform_probe(struct platform_device *pdev) { struct nouveau_platform_gpu *gpu; -- 2.4.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU 2015-05-20 6:10 ` [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU Alexandre Courbot @ 2015-05-20 7:07 ` Arnd Bergmann 2015-05-26 8:43 ` Alexandre Courbot 2015-05-20 11:32 ` Thierry Reding 1 sibling, 1 reply; 9+ messages in thread From: Arnd Bergmann @ 2015-05-20 7:07 UTC (permalink / raw) To: linux-arm-kernel Cc: Alexandre Courbot, Ben Skeggs, David Airlie, gnurou, linux-kernel, dri-devel, Thierry Reding On Wednesday 20 May 2015 15:10:24 Alexandre Courbot wrote: > The lack of IOMMU API support can make nouveau_platform_probe_iommu() > fail to compile because struct iommu_ops is then empty. Fix this by > skipping IOMMU probe in that case - lack of IOMMU on platform devices > is sub-optimal, but is not an error. > > Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> > --- > This is an alternative to https://lkml.org/lkml/2015/5/19/484. Most users > of Nouveau do not care about IOMMU support, so we should not impose that > option on them. > Yes, good idea. Acked-by: Arnd Bergmann <arnd@arndb.de> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU 2015-05-20 7:07 ` Arnd Bergmann @ 2015-05-26 8:43 ` Alexandre Courbot 0 siblings, 0 replies; 9+ messages in thread From: Alexandre Courbot @ 2015-05-26 8:43 UTC (permalink / raw) To: David Airlie, Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, Alexandre Courbot, Ben Skeggs, Linux Kernel Mailing List, dri-devel@lists.freedesktop.org, Thierry Reding On Wed, May 20, 2015 at 4:07 PM, Arnd Bergmann <arnd@arndb.de> wrote: > On Wednesday 20 May 2015 15:10:24 Alexandre Courbot wrote: >> The lack of IOMMU API support can make nouveau_platform_probe_iommu() >> fail to compile because struct iommu_ops is then empty. Fix this by >> skipping IOMMU probe in that case - lack of IOMMU on platform devices >> is sub-optimal, but is not an error. >> >> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> >> --- >> This is an alternative to https://lkml.org/lkml/2015/5/19/484. Most users >> of Nouveau do not care about IOMMU support, so we should not impose that >> option on them. >> > > Yes, good idea. > > Acked-by: Arnd Bergmann <arnd@arndb.de> Thanks. Dave, are you ok with this patch? If so, can you take it? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU 2015-05-20 6:10 ` [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU Alexandre Courbot 2015-05-20 7:07 ` Arnd Bergmann @ 2015-05-20 11:32 ` Thierry Reding 2015-05-20 12:01 ` Arnd Bergmann 1 sibling, 1 reply; 9+ messages in thread From: Thierry Reding @ 2015-05-20 11:32 UTC (permalink / raw) To: Alexandre Courbot Cc: Ben Skeggs, David Airlie, Arnd Bergmann, linux-arm-kernel, dri-devel, linux-kernel, gnurou [-- Attachment #1: Type: text/plain, Size: 2041 bytes --] On Wed, May 20, 2015 at 03:10:24PM +0900, Alexandre Courbot wrote: > The lack of IOMMU API support can make nouveau_platform_probe_iommu() > fail to compile because struct iommu_ops is then empty. Fix this by > skipping IOMMU probe in that case - lack of IOMMU on platform devices > is sub-optimal, but is not an error. > > Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> > --- > This is an alternative to https://lkml.org/lkml/2015/5/19/484. Most users > of Nouveau do not care about IOMMU support, so we should not impose that > option on them. > > drm/nouveau/nouveau_platform.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/nouveau/nouveau_platform.c > index 775277f1edb0..dcfbbfaf1739 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_platform.c > +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c > @@ -92,6 +92,8 @@ static int nouveau_platform_power_down(struct nouveau_platform_gpu *gpu) > return 0; > } > > +#if IS_ENABLED(CONFIG_IOMMU_API) > + > static void nouveau_platform_probe_iommu(struct device *dev, > struct nouveau_platform_gpu *gpu) > { > @@ -158,6 +160,20 @@ static void nouveau_platform_remove_iommu(struct device *dev, > } > } > > +#else > + > +static void nouveau_platform_probe_iommu(struct device *dev, > + struct nouveau_platform_gpu *gpu) > +{ > +} > + > +static void nouveau_platform_remove_iommu(struct device *dev, > + struct nouveau_platform_gpu *gpu) > +{ > +} > + > +#endif > + Since these are all static functions, perhaps an "if (IS_ENABLED(...))" would work here? That way you'd get compile coverage of the code in all cases. But perhaps that doesn't work for IOMMU. I have a vague memory of running across something like this before and IOMMU has this quirk of defining struct iommu_ops as empty if IOMMU_API is deselected so you'll probably get compiler errors unless you actually preprocess the code out. Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU 2015-05-20 11:32 ` Thierry Reding @ 2015-05-20 12:01 ` Arnd Bergmann 2015-05-20 14:18 ` Alexandre Courbot 0 siblings, 1 reply; 9+ messages in thread From: Arnd Bergmann @ 2015-05-20 12:01 UTC (permalink / raw) To: linux-arm-kernel Cc: Thierry Reding, Alexandre Courbot, gnurou, David Airlie, linux-kernel, dri-devel, Ben Skeggs On Wednesday 20 May 2015 13:32:33 Thierry Reding wrote: > > Since these are all static functions, perhaps an "if (IS_ENABLED(...))" > would work here? That way you'd get compile coverage of the code in all > cases. I had the same thought at first. > But perhaps that doesn't work for IOMMU. I have a vague memory of > running across something like this before and IOMMU has this quirk of > defining struct iommu_ops as empty if IOMMU_API is deselected so you'll > probably get compiler errors unless you actually preprocess the code > out. Exactly. Arnd ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU 2015-05-20 12:01 ` Arnd Bergmann @ 2015-05-20 14:18 ` Alexandre Courbot 0 siblings, 0 replies; 9+ messages in thread From: Alexandre Courbot @ 2015-05-20 14:18 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, Thierry Reding, Alexandre Courbot, David Airlie, Linux Kernel Mailing List, dri-devel@lists.freedesktop.org, Ben Skeggs On Wed, May 20, 2015 at 9:01 PM, Arnd Bergmann <arnd@arndb.de> wrote: > On Wednesday 20 May 2015 13:32:33 Thierry Reding wrote: >> >> Since these are all static functions, perhaps an "if (IS_ENABLED(...))" >> would work here? That way you'd get compile coverage of the code in all >> cases. > > I had the same thought at first. > >> But perhaps that doesn't work for IOMMU. I have a vague memory of >> running across something like this before and IOMMU has this quirk of >> defining struct iommu_ops as empty if IOMMU_API is deselected so you'll >> probably get compiler errors unless you actually preprocess the code >> out. > > Exactly. That's precisely the issue here, so not covering this code is exactly what we want if !CONFIG_IOMMU. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-05-26 8:44 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-05-19 12:53 [PATCH] drm/nouveau/platform: add IOMMU dependency Arnd Bergmann 2015-05-19 13:32 ` Thierry Reding 2015-05-20 0:33 ` Alexandre Courbot 2015-05-20 6:10 ` [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU Alexandre Courbot 2015-05-20 7:07 ` Arnd Bergmann 2015-05-26 8:43 ` Alexandre Courbot 2015-05-20 11:32 ` Thierry Reding 2015-05-20 12:01 ` Arnd Bergmann 2015-05-20 14:18 ` Alexandre Courbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox