All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/etnaviv: don't move linear memory window on 3D cores without MC2.0
@ 2016-04-21 12:51 Lucas Stach
  2016-04-27 15:22 ` Christian Gmeiner
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2016-04-21 12:51 UTC (permalink / raw)
  To: dri-devel; +Cc: Russell King, kernel, patchwork-lst

On cores with MC1.0 the memory window offset is not properly respected
by all engines in the core, leading to different views of the memory
if the offset in non-zero. This causes relocs for those engines to be
wrong and might lead to other subtile problems.

Rather than trying to work around this, just disable the linear memory
window offset for those cores.

Suggested-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index a30d1c2b0f13..049d00d8ded5 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -572,6 +572,24 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 		goto fail;
 	}
 
+	/*
+	 * Set the GPU linear window to be at the end of the DMA window, where
+	 * the CMA area is likely to reside. This ensures that we are able to
+	 * map the command buffers while having the linear window overlap as
+	 * much RAM as possible, so we can optimize mappings for other buffers.
+	 *
+	 * For 3D cores only do this if MC2.0 is present, as with MC1.0 it leads
+	 * to different views of the memory on the individual engines.
+	 */
+	if (!(gpu->identity.features & chipFeatures_PIPE_3D) ||
+	    (gpu->identity.minor_features0 & chipMinorFeatures0_MC20)) {
+		u32 dma_mask = (u32)dma_get_required_mask(gpu->dev);
+		if (dma_mask < PHYS_OFFSET + SZ_2G)
+			gpu->memory_base = PHYS_OFFSET;
+		else
+			gpu->memory_base = dma_mask - SZ_2G + 1;
+	}
+
 	ret = etnaviv_hw_reset(gpu);
 	if (ret)
 		goto fail;
@@ -1566,7 +1584,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct etnaviv_gpu *gpu;
-	u32 dma_mask;
 	int err = 0;
 
 	gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL);
@@ -1576,18 +1593,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
 	gpu->dev = &pdev->dev;
 	mutex_init(&gpu->lock);
 
-	/*
-	 * Set the GPU linear window to be at the end of the DMA window, where
-	 * the CMA area is likely to reside. This ensures that we are able to
-	 * map the command buffers while having the linear window overlap as
-	 * much RAM as possible, so we can optimize mappings for other buffers.
-	 */
-	dma_mask = (u32)dma_get_required_mask(dev);
-	if (dma_mask < PHYS_OFFSET + SZ_2G)
-		gpu->memory_base = PHYS_OFFSET;
-	else
-		gpu->memory_base = dma_mask - SZ_2G + 1;
-
 	/* Map registers: */
 	gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev));
 	if (IS_ERR(gpu->mmio))
-- 
2.8.0.rc3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/etnaviv: don't move linear memory window on 3D cores without MC2.0
  2016-04-21 12:51 [PATCH] drm/etnaviv: don't move linear memory window on 3D cores without MC2.0 Lucas Stach
@ 2016-04-27 15:22 ` Christian Gmeiner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Gmeiner @ 2016-04-27 15:22 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Russell King, Sascha Hauer, DRI mailing list, patchwork-lst

2016-04-21 14:51 GMT+02:00 Lucas Stach <l.stach@pengutronix.de>:
> On cores with MC1.0 the memory window offset is not properly respected
> by all engines in the core, leading to different views of the memory
> if the offset in non-zero. This causes relocs for those engines to be
> wrong and might lead to other subtile problems.
>
> Rather than trying to work around this, just disable the linear memory
> window offset for those cores.
>
> Suggested-by: Russell King <linux@arm.linux.org.uk>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 31 ++++++++++++++++++-------------
>  1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index a30d1c2b0f13..049d00d8ded5 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -572,6 +572,24 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
>                 goto fail;
>         }
>
> +       /*
> +        * Set the GPU linear window to be at the end of the DMA window, where
> +        * the CMA area is likely to reside. This ensures that we are able to
> +        * map the command buffers while having the linear window overlap as
> +        * much RAM as possible, so we can optimize mappings for other buffers.
> +        *
> +        * For 3D cores only do this if MC2.0 is present, as with MC1.0 it leads
> +        * to different views of the memory on the individual engines.
> +        */
> +       if (!(gpu->identity.features & chipFeatures_PIPE_3D) ||
> +           (gpu->identity.minor_features0 & chipMinorFeatures0_MC20)) {
> +               u32 dma_mask = (u32)dma_get_required_mask(gpu->dev);
> +               if (dma_mask < PHYS_OFFSET + SZ_2G)
> +                       gpu->memory_base = PHYS_OFFSET;
> +               else
> +                       gpu->memory_base = dma_mask - SZ_2G + 1;
> +       }
> +
>         ret = etnaviv_hw_reset(gpu);
>         if (ret)
>                 goto fail;
> @@ -1566,7 +1584,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>         struct etnaviv_gpu *gpu;
> -       u32 dma_mask;
>         int err = 0;
>
>         gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL);
> @@ -1576,18 +1593,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
>         gpu->dev = &pdev->dev;
>         mutex_init(&gpu->lock);
>
> -       /*
> -        * Set the GPU linear window to be at the end of the DMA window, where
> -        * the CMA area is likely to reside. This ensures that we are able to
> -        * map the command buffers while having the linear window overlap as
> -        * much RAM as possible, so we can optimize mappings for other buffers.
> -        */
> -       dma_mask = (u32)dma_get_required_mask(dev);
> -       if (dma_mask < PHYS_OFFSET + SZ_2G)
> -               gpu->memory_base = PHYS_OFFSET;
> -       else
> -               gpu->memory_base = dma_mask - SZ_2G + 1;
> -
>         /* Map registers: */
>         gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev));
>         if (IS_ERR(gpu->mmio))
> --
> 2.8.0.rc3
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-27 15:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21 12:51 [PATCH] drm/etnaviv: don't move linear memory window on 3D cores without MC2.0 Lucas Stach
2016-04-27 15:22 ` Christian Gmeiner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.