Skip to contentSkip to conversation

instmem/gk20a: set DMA mask early

PATCH Superseded Alexandre Courbot 1 participant 1 message Feb 24, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 instmem/gk20a: set DMA mask early

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.

---
 drm/nouveau/nvkm/subdev/instmem/gk20a.c | 5 +++++
 1 file changed, 5 insertions(+)
drm/nouveau/nvkm/subdev/instmem/gk20a.c +5 -0
index 6b8f2a19b2d9..4c3c744c5c6b 100644
@@ -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;
Signature · 1 line
2.7.1