drm/nouveau/instmem/gk20a: set DMA mask early
authorAlexandre Courbot <acourbot@nvidia.com>
Thu, 25 Feb 2016 06:08:42 +0000 (15:08 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 14 Mar 2016 00:13:29 +0000 (10:13 +1000)
DMA mask is typically set in nouveau_ttm_init(), but this function is
called late during initialization and GK20A's instmem will have called
DMA functions before this happens.

Having a wrongly set DMA mask can result in the use of unneeded bounce
buffers. Set it early to avoid this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c

index 92cc7c685eda9d8966fd6b2d0599b82ff288b6b0..9afa5f3e3c1c2d23e57ba076025bc8de1c2d2e25 100644 (file)
@@ -280,6 +280,15 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
                goto free;
        }
 
+       /**
+        * The IOMMU bit defines the upper limit of the GPU-addressable space.
+        * This will be refined in nouveau_ttm_init but we need to do it early
+        * for instmem to behave properly
+        */
+       ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(tdev->func->iommu_bit));
+       if (ret)
+               goto free;
+
        nvkm_device_tegra_probe_iommu(tdev);
 
        ret = nvkm_device_tegra_power_up(tdev);