diff options
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/dma.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vidmem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/pramin.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/linux/vidmem.h | 23 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/vidmem.h | 13 |
7 files changed, 29 insertions, 20 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); |
diff --git a/drivers/gpu/nvgpu/common/mm/vidmem.c b/drivers/gpu/nvgpu/common/mm/vidmem.c index 18f46c03..d1c5a2e8 100644 --- a/drivers/gpu/nvgpu/common/mm/vidmem.c +++ b/drivers/gpu/nvgpu/common/mm/vidmem.c | |||
@@ -195,7 +195,7 @@ int nvgpu_vidmem_clear(struct gk20a *g, struct nvgpu_mem *mem) | |||
195 | if (g->mm.vidmem.ce_ctx_id == (u32)~0) | 195 | if (g->mm.vidmem.ce_ctx_id == (u32)~0) |
196 | return -EINVAL; | 196 | return -EINVAL; |
197 | 197 | ||
198 | alloc = nvgpu_vidmem_get_page_alloc(mem->priv.sgt->sgl); | 198 | alloc = mem->vidmem_alloc; |
199 | 199 | ||
200 | nvgpu_sgt_for_each_sgl(sgl, &alloc->sgt) { | 200 | nvgpu_sgt_for_each_sgl(sgl, &alloc->sgt) { |
201 | if (gk20a_last_fence) | 201 | if (gk20a_last_fence) |
diff --git a/drivers/gpu/nvgpu/common/pramin.c b/drivers/gpu/nvgpu/common/pramin.c index b7bc7439..b6166f51 100644 --- a/drivers/gpu/nvgpu/common/pramin.c +++ b/drivers/gpu/nvgpu/common/pramin.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <nvgpu/pramin.h> | 23 | #include <nvgpu/pramin.h> |
24 | #include <nvgpu/page_allocator.h> | 24 | #include <nvgpu/page_allocator.h> |
25 | #include <nvgpu/enabled.h> | 25 | #include <nvgpu/enabled.h> |
26 | #include <nvgpu/vidmem.h> | ||
27 | 26 | ||
28 | #include "gk20a/gk20a.h" | 27 | #include "gk20a/gk20a.h" |
29 | 28 | ||
@@ -55,7 +54,7 @@ void nvgpu_pramin_access_batched(struct gk20a *g, struct nvgpu_mem *mem, | |||
55 | if (!g->regs && nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) | 54 | if (!g->regs && nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) |
56 | return; | 55 | return; |
57 | 56 | ||
58 | alloc = nvgpu_vidmem_get_page_alloc(mem->priv.sgt->sgl); | 57 | alloc = mem->vidmem_alloc; |
59 | sgt = &alloc->sgt; | 58 | sgt = &alloc->sgt; |
60 | 59 | ||
61 | nvgpu_sgt_for_each_sgl(sgl, sgt) { | 60 | nvgpu_sgt_for_each_sgl(sgl, sgt) { |
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; | |||
24 | struct gk20a; | 24 | struct gk20a; |
25 | 25 | ||
26 | #ifdef CONFIG_GK20A_VIDMEM | 26 | #ifdef CONFIG_GK20A_VIDMEM |
27 | |||
27 | struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf); | 28 | struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf); |
28 | int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes); | 29 | int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes); |
29 | 30 | ||
31 | void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr); | ||
32 | struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl); | ||
33 | |||
30 | int nvgpu_vidmem_buf_access_memory(struct gk20a *g, struct dma_buf *dmabuf, | 34 | int 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 | |||
34 | static inline struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf) | 39 | static 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 | ||
49 | static inline void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, | ||
50 | u64 addr) | ||
51 | { | ||
52 | } | ||
53 | |||
54 | static inline struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc( | ||
55 | struct scatterlist *sgl) | ||
56 | { | ||
57 | return NULL; | ||
58 | } | ||
59 | |||
44 | static inline int nvgpu_vidmem_buf_access_memory(struct gk20a *g, | 60 | static 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 | |||
54 | struct nvgpu_vidmem_linux { | 71 | struct 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; | |||
39 | struct gk20a; | 39 | struct gk20a; |
40 | struct nvgpu_allocator; | 40 | struct nvgpu_allocator; |
41 | struct nvgpu_gmmu_attrs; | 41 | struct nvgpu_gmmu_attrs; |
42 | struct 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 | ||
30 | struct scatterlist; | ||
31 | struct work_struct; | 30 | struct work_struct; |
32 | 31 | ||
33 | struct gk20a; | 32 | struct gk20a; |
@@ -74,8 +73,6 @@ struct nvgpu_vidmem_buf *nvgpu_vidmem_user_alloc(struct gk20a *g, size_t bytes); | |||
74 | 73 | ||
75 | void nvgpu_vidmem_buf_free(struct gk20a *g, struct nvgpu_vidmem_buf *buf); | 74 | void nvgpu_vidmem_buf_free(struct gk20a *g, struct nvgpu_vidmem_buf *buf); |
76 | 75 | ||
77 | struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl); | ||
78 | void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr); | ||
79 | bool nvgpu_addr_is_vidmem_page_alloc(u64 addr); | 76 | bool nvgpu_addr_is_vidmem_page_alloc(u64 addr); |
80 | int nvgpu_vidmem_get_space(struct gk20a *g, u64 *space); | 77 | int 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 | ||
96 | static inline struct nvgpu_page_alloc * | ||
97 | nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl) | ||
98 | { | ||
99 | return NULL; | ||
100 | } | ||
101 | |||
102 | static inline void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr) | ||
103 | { | ||
104 | } | ||
105 | |||
106 | static inline bool nvgpu_addr_is_vidmem_page_alloc(u64 addr) | 93 | static inline bool nvgpu_addr_is_vidmem_page_alloc(u64 addr) |
107 | { | 94 | { |
108 | return false; | 95 | return false; |