diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-08-17 19:51:03 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-10-13 18:19:34 -0400 |
commit | ff9c3fc20a27444cd1ff7d9402965023e425f404 (patch) | |
tree | dbb511c48a4cc0068618c8a34a69ae8305e18747 /drivers/gpu/nvgpu/common/linux | |
parent | 59e4089278bd052b440293356605ce524e4944db (diff) |
gpu: nvgpu: Reduce usage of nvgpu_vidmem_get_page_alloc
Reduce the usage of nvgpu_vidmem_get_page_alloc() and friends as much
as possible. This reduces the dependency of nvgpu on Linux SGLs. SGLs
still need to be used, however, since sharing buffers in userspace is
done by dma_buf FD. The best way to pass the vidmem buf through the
dma_buf is by SGL pointer.
JIRA NVGPU-30
JIRA NVGPU-138
Change-Id: Ide0e9e5a557f00aa63b063be085042101a5b34ee
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1540709
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/dma.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index ca657da2..b62c4593 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c | |||
@@ -28,9 +28,11 @@ | |||
28 | #include <nvgpu/vidmem.h> | 28 | #include <nvgpu/vidmem.h> |
29 | 29 | ||
30 | #include <nvgpu/linux/dma.h> | 30 | #include <nvgpu/linux/dma.h> |
31 | #include <nvgpu/linux/vidmem.h> | ||
31 | 32 | ||
32 | #include "gk20a/gk20a.h" | 33 | #include "gk20a/gk20a.h" |
33 | #include "gk20a/platform_gk20a.h" | 34 | #include "gk20a/platform_gk20a.h" |
35 | |||
34 | #include "os_linux.h" | 36 | #include "os_linux.h" |
35 | 37 | ||
36 | /* | 38 | /* |
@@ -348,6 +350,7 @@ int nvgpu_dma_alloc_flags_vid_at(struct gk20a *g, unsigned long flags, | |||
348 | 350 | ||
349 | mem->aligned_size = size; | 351 | mem->aligned_size = size; |
350 | mem->aperture = APERTURE_VIDMEM; | 352 | mem->aperture = APERTURE_VIDMEM; |
353 | mem->vidmem_alloc = (struct nvgpu_page_alloc *)(uintptr_t)addr; | ||
351 | mem->allocator = vidmem_alloc; | 354 | mem->allocator = vidmem_alloc; |
352 | mem->priv.flags = flags; | 355 | mem->priv.flags = flags; |
353 | 356 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c index e1f8a598..8740ac3d 100644 --- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <nvgpu/vidmem.h> | 25 | #include <nvgpu/vidmem.h> |
26 | 26 | ||
27 | #include <nvgpu/linux/dma.h> | 27 | #include <nvgpu/linux/dma.h> |
28 | #include <nvgpu/linux/vidmem.h> | ||
28 | 29 | ||
29 | #include "os_linux.h" | 30 | #include "os_linux.h" |
30 | 31 | ||
@@ -355,7 +356,7 @@ u64 nvgpu_mem_get_addr(struct gk20a *g, struct nvgpu_mem *mem) | |||
355 | /* | 356 | /* |
356 | * Otherwise get the vidmem address. | 357 | * Otherwise get the vidmem address. |
357 | */ | 358 | */ |
358 | alloc = nvgpu_vidmem_get_page_alloc(mem->priv.sgt->sgl); | 359 | alloc = mem->vidmem_alloc; |
359 | 360 | ||
360 | /* This API should not be used with > 1 chunks */ | 361 | /* This API should not be used with > 1 chunks */ |
361 | WARN_ON(alloc->nr_chunks != 1); | 362 | WARN_ON(alloc->nr_chunks != 1); |