summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-08-17 19:51:03 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-13 18:19:34 -0400
commitff9c3fc20a27444cd1ff7d9402965023e425f404 (patch)
treedbb511c48a4cc0068618c8a34a69ae8305e18747 /drivers/gpu/nvgpu/include
parent59e4089278bd052b440293356605ce524e4944db (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/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/linux/vidmem.h23
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h2
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/vidmem.h13
3 files changed, 22 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/vidmem.h b/drivers/gpu/nvgpu/include/nvgpu/linux/vidmem.h
index 76bbb05b..ec02faec 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/linux/vidmem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/linux/vidmem.h
@@ -24,13 +24,18 @@ struct dma_buf;
24struct gk20a; 24struct gk20a;
25 25
26#ifdef CONFIG_GK20A_VIDMEM 26#ifdef CONFIG_GK20A_VIDMEM
27
27struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf); 28struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf);
28int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes); 29int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes);
29 30
31void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr);
32struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl);
33
30int nvgpu_vidmem_buf_access_memory(struct gk20a *g, struct dma_buf *dmabuf, 34int nvgpu_vidmem_buf_access_memory(struct gk20a *g, struct dma_buf *dmabuf,
31 void *buffer, u64 offset, u64 size, u32 cmd); 35 void *buffer, u64 offset, u64 size, u32 cmd);
32 36
33#else /* !CONFIG_GK20A_VIDMEM */ 37#else /* !CONFIG_GK20A_VIDMEM */
38
34static inline struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf) 39static inline struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf)
35{ 40{
36 return NULL; 41 return NULL;
@@ -41,16 +46,28 @@ static inline int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes)
41 return -ENOSYS; 46 return -ENOSYS;
42} 47}
43 48
49static inline void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl,
50 u64 addr)
51{
52}
53
54static inline struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(
55 struct scatterlist *sgl)
56{
57 return NULL;
58}
59
44static inline int nvgpu_vidmem_buf_access_memory(struct gk20a *g, 60static inline int nvgpu_vidmem_buf_access_memory(struct gk20a *g,
45 struct dma_buf *dmabuf, 61 struct dma_buf *dmabuf,
46 void *buffer, u64 offset, 62 void *buffer, u64 offset,
47 u64 size, u32 cmd) 63 u64 size, u32 cmd)
48{ 64{
49 return -ENOSYS; 65 return -ENOSYS;
50} 66}
51 67
52#endif 68#endif
53 69
70
54struct nvgpu_vidmem_linux { 71struct nvgpu_vidmem_linux {
55 struct dma_buf *dmabuf; 72 struct dma_buf *dmabuf;
56 void *dmabuf_priv; 73 void *dmabuf_priv;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
index 23a1bad7..537409a8 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
@@ -39,6 +39,7 @@ struct nvgpu_sgt;
39struct gk20a; 39struct gk20a;
40struct nvgpu_allocator; 40struct nvgpu_allocator;
41struct nvgpu_gmmu_attrs; 41struct nvgpu_gmmu_attrs;
42struct nvgpu_page_alloc;
42 43
43#define NVGPU_MEM_DMA_ERROR (~0ULL) 44#define NVGPU_MEM_DMA_ERROR (~0ULL)
44 45
@@ -162,6 +163,7 @@ struct nvgpu_mem {
162 /* 163 /*
163 * Fields only populated for vidmem allocations. 164 * Fields only populated for vidmem allocations.
164 */ 165 */
166 struct nvgpu_page_alloc *vidmem_alloc;
165 struct nvgpu_allocator *allocator; 167 struct nvgpu_allocator *allocator;
166 struct nvgpu_list_node clear_list_entry; 168 struct nvgpu_list_node clear_list_entry;
167 169
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vidmem.h b/drivers/gpu/nvgpu/include/nvgpu/vidmem.h
index b89c710d..9e9f8301 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/vidmem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/vidmem.h
@@ -27,7 +27,6 @@
27#include <nvgpu/errno.h> 27#include <nvgpu/errno.h>
28#include <nvgpu/nvgpu_mem.h> 28#include <nvgpu/nvgpu_mem.h>
29 29
30struct scatterlist;
31struct work_struct; 30struct work_struct;
32 31
33struct gk20a; 32struct gk20a;
@@ -74,8 +73,6 @@ struct nvgpu_vidmem_buf *nvgpu_vidmem_user_alloc(struct gk20a *g, size_t bytes);
74 73
75void nvgpu_vidmem_buf_free(struct gk20a *g, struct nvgpu_vidmem_buf *buf); 74void nvgpu_vidmem_buf_free(struct gk20a *g, struct nvgpu_vidmem_buf *buf);
76 75
77struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl);
78void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr);
79bool nvgpu_addr_is_vidmem_page_alloc(u64 addr); 76bool nvgpu_addr_is_vidmem_page_alloc(u64 addr);
80int nvgpu_vidmem_get_space(struct gk20a *g, u64 *space); 77int nvgpu_vidmem_get_space(struct gk20a *g, u64 *space);
81 78
@@ -93,16 +90,6 @@ int nvgpu_vidmem_clear(struct gk20a *g, struct nvgpu_mem *mem);
93 * When VIDMEM support is not present this interface is used. 90 * When VIDMEM support is not present this interface is used.
94 */ 91 */
95 92
96static inline struct nvgpu_page_alloc *
97nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl)
98{
99 return NULL;
100}
101
102static inline void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr)
103{
104}
105
106static inline bool nvgpu_addr_is_vidmem_page_alloc(u64 addr) 93static inline bool nvgpu_addr_is_vidmem_page_alloc(u64 addr)
107{ 94{
108 return false; 95 return false;