instmem/gk20a: set DMA mask early
Subsystems (2)
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.
Signed-off-by Alexandre Courbot <[email protected]>
--- drm/nouveau/nvkm/subdev/instmem/gk20a.c | 5 +++++ 1 file changed, 5 insertions(+)
drm/nouveau/nvkm/subdev/instmem/gk20a.c +5 -0
@@ -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