summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-10-19 18:34:47 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-10 18:46:58 -0500
commit8428c82c816f361ce7bbb1fe4804f350b8cbea2f (patch)
tree7a1cf630fd9de6ed2acf33d6b9e2085d074a6906 /drivers/gpu/nvgpu/include
parentee4970a33f41b56f2ada6a0b5ab6f9c400e39d88 (diff)
gpu: nvgpu: Add nvgpu_os_buffer
Add a generic nvgpu_os_buffer type, defined by each OS, to abstract a "user" buffer. This allows the comptag interface to be used in the core code. The end goal of this patch is to allow the OS specific mapping code to call a generic mapping function that handles most of the mapping logic. The problem is a lot of the logic involves comptags which are highly dependent on the operating systems buffer management scheme. With this, each OS can implement the buffer comptag mechanics however it wishes without the core MM code caring. JIRA NVGPU-30 JIRA NVGPU-223 Change-Id: Iaf64bc52e01ef3f262b4f8f9173a84384db7dc3e Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1583986 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> 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/comptags.h12
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/linux/vm.h6
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/vm.h6
3 files changed, 24 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/comptags.h b/drivers/gpu/nvgpu/include/nvgpu/comptags.h
index 6e3062ec..5482d0ce 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/comptags.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/comptags.h
@@ -20,6 +20,7 @@
20#include <nvgpu/lock.h> 20#include <nvgpu/lock.h>
21 21
22struct gk20a; 22struct gk20a;
23struct nvgpu_os_buffer;
23 24
24struct gk20a_comptags { 25struct gk20a_comptags {
25 u32 offset; 26 u32 offset;
@@ -52,6 +53,17 @@ int gk20a_comptaglines_alloc(struct gk20a_comptag_allocator *allocator,
52void gk20a_comptaglines_free(struct gk20a_comptag_allocator *allocator, 53void gk20a_comptaglines_free(struct gk20a_comptag_allocator *allocator,
53 u32 offset, u32 len); 54 u32 offset, u32 len);
54 55
56/*
57 * Defined by OS specific code since comptags are stored in a highly OS specific
58 * way.
59 */
60int gk20a_alloc_comptags(struct gk20a *g,
61 struct nvgpu_os_buffer *buf,
62 struct gk20a_comptag_allocator *allocator,
63 u32 lines);
64void gk20a_get_comptags(struct nvgpu_os_buffer *buf,
65 struct gk20a_comptags *comptags);
66
55 67
56 68
57#endif 69#endif
diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h
index dee8fa09..39deeb69 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h
@@ -33,11 +33,17 @@
33 33
34struct sg_table; 34struct sg_table;
35struct dma_buf; 35struct dma_buf;
36struct device;
36 37
37struct vm_gk20a; 38struct vm_gk20a;
38struct vm_gk20a_mapping_batch; 39struct vm_gk20a_mapping_batch;
39struct nvgpu_vm_area; 40struct nvgpu_vm_area;
40 41
42struct nvgpu_os_buffer {
43 struct dma_buf *dmabuf;
44 struct device *dev;
45};
46
41/* NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL must be set */ 47/* NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL must be set */
42int nvgpu_vm_map_linux(struct vm_gk20a *vm, 48int nvgpu_vm_map_linux(struct vm_gk20a *vm,
43 struct dma_buf *dmabuf, 49 struct dma_buf *dmabuf,
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm.h b/drivers/gpu/nvgpu/include/nvgpu/vm.h
index 10a7f7ce..b91b41e4 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/vm.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/vm.h
@@ -107,6 +107,12 @@ struct nvgpu_mapped_buf {
107 bool va_allocated; 107 bool va_allocated;
108}; 108};
109 109
110/*
111 * Defined by each OS. Allows the common VM code do things to the OS specific
112 * buffer structures.
113 */
114struct nvgpu_os_buffer;
115
110static inline struct nvgpu_mapped_buf * 116static inline struct nvgpu_mapped_buf *
111nvgpu_mapped_buf_from_buffer_list(struct nvgpu_list_node *node) 117nvgpu_mapped_buf_from_buffer_list(struct nvgpu_list_node *node)
112{ 118{