[Nouveau] [PATCH] instmem/gk20a: set DMA mask early

Alexandre Courbot acourbot at nvidia.com
Wed Feb 24 09:53:38 UTC 2016


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 in GK20A's instmem constructor to avoid this.

Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
---
 drm/nouveau/nvkm/subdev/instmem/gk20a.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drm/nouveau/nvkm/subdev/instmem/gk20a.c
index 6b8f2a19b2d9..4c3c744c5c6b 100644
--- a/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -576,6 +576,7 @@ gk20a_instmem_new(struct nvkm_device *device, int index,
 {
 	struct nvkm_device_tegra *tdev = device->func->tegra(device);
 	struct gk20a_instmem *imem;
+	int ret;
 
 	if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
 		return -ENOMEM;
@@ -583,6 +584,10 @@ gk20a_instmem_new(struct nvkm_device *device, int index,
 	spin_lock_init(&imem->lock);
 	*pimem = &imem->base;
 
+	ret = dma_set_mask(device->dev, DMA_BIT_MASK(tdev->func->iommu_bit));
+	if (ret)
+		return ret;
+
 	/* do not allow more than 1MB of CPU-mapped instmem */
 	imem->vaddr_use = 0;
 	imem->vaddr_max = 0x100000;
-- 
2.7.1



More information about the Nouveau mailing list