diff mbox

drm/etnaviv: select CMA and DMA_CMA if available

Message ID 20170714143801.21535-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach July 14, 2017, 2:38 p.m. UTC
While this is no build dependency, etnaviv will only work correctly on most
systems if CMA and DMA_CMA are enabled. Select both options if available to
avoid users ending up with a non-working GPU due to a lacking kernel config.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

Comments

Joshua Clayton July 14, 2017, 6:32 p.m. UTC | #1
On Friday, July 14, 2017 7:38:01 AM PDT Lucas Stach wrote:
> While this is no build dependency, etnaviv will only work correctly on most
> systems if CMA and DMA_CMA are enabled. Select both options if available to
> avoid users ending up with a non-working GPU due to a lacking kernel config.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/gpu/drm/etnaviv/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/etnaviv/Kconfig
> b/drivers/gpu/drm/etnaviv/Kconfig index 71cee4e9fefb..38b477b5fbf9 100644
> --- a/drivers/gpu/drm/etnaviv/Kconfig
> +++ b/drivers/gpu/drm/etnaviv/Kconfig
> @@ -10,6 +10,8 @@ config DRM_ETNAVIV
>  	select IOMMU_API
>  	select IOMMU_SUPPORT
>  	select WANT_DEV_COREDUMP
> +	select CMA if HAVE_DMA_CONTIGUOUS
> +	select DMA_CMA if HAVE_DMA_CONTIGUOUS
>  	help
>  	  DRM driver for Vivante GPUs.
IIRC, This at least half solves it.
Does the user of systems with > 2 GiB  need to explicitly specify cma size for 
it to work?
Russell King (Oracle) July 16, 2017, 3:29 p.m. UTC | #2
On Fri, Jul 14, 2017 at 04:38:01PM +0200, Lucas Stach wrote:
> While this is no build dependency, etnaviv will only work correctly on most
> systems if CMA and DMA_CMA are enabled. Select both options if available to
> avoid users ending up with a non-working GPU due to a lacking kernel config.

How does merely selecting CMA solve this problem?  Does CMA guarantee
that GPU command buffers will always be allocated in the lower 2G of
physical address space?

I suspect that's what you hope will happen, rather than a guarantee.
Lucas Stach July 17, 2017, 8:49 a.m. UTC | #3
Am Sonntag, den 16.07.2017, 16:29 +0100 schrieb Russell King - ARM
Linux:
> On Fri, Jul 14, 2017 at 04:38:01PM +0200, Lucas Stach wrote:
> > While this is no build dependency, etnaviv will only work correctly on most
> > systems if CMA and DMA_CMA are enabled. Select both options if available to
> > avoid users ending up with a non-working GPU due to a lacking kernel config.
> 
> How does merely selecting CMA solve this problem?  Does CMA guarantee
> that GPU command buffers will always be allocated in the lower 2G of
> physical address space?

No, but CMA guarantees that commandbuffers will be allocated from the
region and with the default CMA configuration dma_get_required_mask()
will return the correct location of the CMA area, so we can move the
linear memory window accordingly.
There are no guarantees, but at least with a CMA area no larger than 2GB
things will work for the average user, which is a lot better than
leaving them with a non-working GPU due to a simple missing kernel
configuration option.

Regards,
Lucas
Lucas Stach July 17, 2017, 8:52 a.m. UTC | #4
Am Freitag, den 14.07.2017, 11:32 -0700 schrieb Joshua Clayton:
> On Friday, July 14, 2017 7:38:01 AM PDT Lucas Stach wrote:
> > While this is no build dependency, etnaviv will only work correctly on most
> > systems if CMA and DMA_CMA are enabled. Select both options if available to
> > avoid users ending up with a non-working GPU due to a lacking kernel config.
> > 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  drivers/gpu/drm/etnaviv/Kconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/etnaviv/Kconfig
> > b/drivers/gpu/drm/etnaviv/Kconfig index 71cee4e9fefb..38b477b5fbf9 100644
> > --- a/drivers/gpu/drm/etnaviv/Kconfig
> > +++ b/drivers/gpu/drm/etnaviv/Kconfig
> > @@ -10,6 +10,8 @@ config DRM_ETNAVIV
> >  	select IOMMU_API
> >  	select IOMMU_SUPPORT
> >  	select WANT_DEV_COREDUMP
> > +	select CMA if HAVE_DMA_CONTIGUOUS
> > +	select DMA_CMA if HAVE_DMA_CONTIGUOUS
> >  	help
> >  	  DRM driver for Vivante GPUs.
> IIRC, This at least half solves it.
> Does the user of systems with > 2 GiB  need to explicitly specify cma size for 
> it to work?

No, we move the linear memory window to the location of the CMA area,
which means as long as the user doesn't explicitly specify a CMA size
> 2GB things will just work.

Regards,
Lucas
diff mbox

Patch

diff --git a/drivers/gpu/drm/etnaviv/Kconfig b/drivers/gpu/drm/etnaviv/Kconfig
index 71cee4e9fefb..38b477b5fbf9 100644
--- a/drivers/gpu/drm/etnaviv/Kconfig
+++ b/drivers/gpu/drm/etnaviv/Kconfig
@@ -10,6 +10,8 @@  config DRM_ETNAVIV
 	select IOMMU_API
 	select IOMMU_SUPPORT
 	select WANT_DEV_COREDUMP
+	select CMA if HAVE_DMA_CONTIGUOUS
+	select DMA_CMA if HAVE_DMA_CONTIGUOUS
 	help
 	  DRM driver for Vivante GPUs.