Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 471070ab authored by Lucas Stach's avatar Lucas Stach
Browse files

drm/etnaviv: move GPU linear window to end of DMA window



If the end of the system DMA window is farther away from the start of
physical RAM than the size of the GPU linear window, move the linear
window so that it ends at the same address than the system DMA window.

This allows to map command buffer from CMA, which is likely to reside
at the end of the system DMA window, while also overlapping as much
RAM as possible, in order to optimize regular buffer mappings through
the linear window.

Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
parent d9fd0c7d
Loading
Loading
Loading
Loading
+10 −5
Original line number Original line Diff line number Diff line
@@ -1563,6 +1563,7 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
{
{
	struct device *dev = &pdev->dev;
	struct device *dev = &pdev->dev;
	struct etnaviv_gpu *gpu;
	struct etnaviv_gpu *gpu;
	u32 dma_mask;
	int err = 0;
	int err = 0;


	gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL);
	gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL);
@@ -1573,12 +1574,16 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
	mutex_init(&gpu->lock);
	mutex_init(&gpu->lock);


	/*
	/*
	 * Set the GPU base address to the start of physical memory.  This
	 * Set the GPU linear window to be at the end of the DMA window, where
	 * ensures that if we have up to 2GB, the v1 MMU can address the
	 * the CMA area is likely to reside. This ensures that we are able to
	 * highest memory.  This is important as command buffers may be
	 * map the command buffers while having the linear window overlap as
	 * allocated outside of this limit.
	 * 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;
		gpu->memory_base = PHYS_OFFSET;
	else
		gpu->memory_base = dma_mask - SZ_2G + 1;


	/* Map registers: */
	/* Map registers: */
	gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev));
	gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev));