From 1b71581b9e3534661b4552faadf38bbb98851c45 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 23 Apr 2018 12:28:09 -0700 Subject: gpu: nvgpu: Set DMA mask on a per-platform basis Each GPU platform has different DMA limitations. For older chips the maximum size of a DMA buffer was more limited than newer SoCs (read: Xavier) and discrete GPUs. This patch adds support to set the DMA mask for a GPU on a per platform basis by adding a platform field that is populated with the maximum allowed DMA mask. That mask is programmed by the driver common code. If no mask is specified then the default mask size is 16GB (34 bits). Bug 2043276 Change-Id: I9c3c76c86bac6c485eb1197326e662516fbcaa41 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1700980 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/driver_common.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/driver_common.c') diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index 8086cb29..015046dd 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c @@ -73,9 +73,15 @@ static void nvgpu_init_vars(struct gk20a *g) dev->dma_parms = &l->dma_parms; dma_set_max_seg_size(dev, UINT_MAX); - /* 34 bit mask - can be expanded for later chips is needed. */ - dma_set_mask(dev, DMA_BIT_MASK(34)); - dma_set_coherent_mask(dev, DMA_BIT_MASK(34)); + /* + * A default of 16GB is the largest supported DMA size that is + * acceptable to all currently supported Tegra SoCs. + */ + if (!platform->dma_mask) + platform->dma_mask = DMA_BIT_MASK(34); + + dma_set_mask(dev, platform->dma_mask); + dma_set_coherent_mask(dev, platform->dma_mask); nvgpu_init_list_node(&g->profiler_objects); -- cgit v1.2.2