diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-04-17 19:26:28 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-19 18:34:01 -0400 |
commit | d37e8f7dcf190f31f9c0c12583db2bb0c0d313c0 (patch) | |
tree | 4807c89bf40954c54804c3a8dd88c16849181f29 /drivers/gpu/nvgpu/vgpu | |
parent | dcb744acfbbc11e66cac2d0a674a42e62d908b9d (diff) |
gpu: nvgpu: Split VM interface out
This patch begins the major rework of the GPU's virtual memory manager
(VMM). The VMM is the piece of code that handles the userspace interface
to buffers and their mappings into the GMMU. The core data structure is
the VM - for now still known as 'struct vm_gk20a'. Each one of these
structs represents one addres space to which channels or TSGs may bind
themselves to.
The VMM splits the interface up into two broad categories. First there's
the common, OS independent interfaces; and second there's the OS specific
interfaces.
OS independent
--------------
This is the code that manages the lifetime of VMs, the buffers inside
VMs (search, batch mapping) creation, destruction, etc.
OS Specific
-----------
This handles mapping of buffers represented as they are represented by
the OS (dma_buf's for example on Linux).
This patch is by no means complete. There's still Linux specific functions
scattered in ostensibly OS independent code. This is the first step. A
patch that rewrites everything in one go would simply be too big to
effectively review.
Instead the goal of this change is to simply separate out the basic
OS specific and OS agnostic interfaces into their own header files. The
next series of patches will start to pull the relevant implementations
into OS specific C files and common C files.
JIRA NVGPU-12
JIRA NVGPU-30
Change-Id: I242c7206047b6c769296226d855b7e44d5c4bfa8
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1464939
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c index c7960c1f..dd515f41 100644 --- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c | |||
@@ -526,7 +526,7 @@ static int vgpu_gr_alloc_obj_ctx(struct channel_gk20a *c, | |||
526 | } else { | 526 | } else { |
527 | if (!tsg->tsg_gr_ctx) { | 527 | if (!tsg->tsg_gr_ctx) { |
528 | tsg->vm = c->vm; | 528 | tsg->vm = c->vm; |
529 | gk20a_vm_get(tsg->vm); | 529 | nvgpu_vm_get(tsg->vm); |
530 | err = g->ops.gr.alloc_gr_ctx(g, &tsg->tsg_gr_ctx, | 530 | err = g->ops.gr.alloc_gr_ctx(g, &tsg->tsg_gr_ctx, |
531 | c->vm, | 531 | c->vm, |
532 | args->class_num, | 532 | args->class_num, |
@@ -536,7 +536,7 @@ static int vgpu_gr_alloc_obj_ctx(struct channel_gk20a *c, | |||
536 | if (err) { | 536 | if (err) { |
537 | nvgpu_err(g, | 537 | nvgpu_err(g, |
538 | "fail to allocate TSG gr ctx buffer, err=%d", err); | 538 | "fail to allocate TSG gr ctx buffer, err=%d", err); |
539 | gk20a_vm_put(tsg->vm); | 539 | nvgpu_vm_put(tsg->vm); |
540 | tsg->vm = NULL; | 540 | tsg->vm = NULL; |
541 | goto out; | 541 | goto out; |
542 | } | 542 | } |
diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index 7e42c198..cfa9e428 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include "vgpu/vgpu.h" | 22 | #include "vgpu/vgpu.h" |
23 | #include "gk20a/mm_gk20a.h" | 23 | #include "gk20a/mm_gk20a.h" |
24 | 24 | ||
25 | #include "common/linux/vm_priv.h" | ||
26 | |||
25 | static int vgpu_init_mm_setup_sw(struct gk20a *g) | 27 | static int vgpu_init_mm_setup_sw(struct gk20a *g) |
26 | { | 28 | { |
27 | struct mm_gk20a *mm = &g->mm; | 29 | struct mm_gk20a *mm = &g->mm; |
@@ -216,7 +218,7 @@ static void vgpu_vm_remove_support(struct vm_gk20a *vm) | |||
216 | nvgpu_rbtree_enum_start(0, &node, vm->mapped_buffers); | 218 | nvgpu_rbtree_enum_start(0, &node, vm->mapped_buffers); |
217 | while (node) { | 219 | while (node) { |
218 | mapped_buffer = mapped_buffer_from_rbtree_node(node); | 220 | mapped_buffer = mapped_buffer_from_rbtree_node(node); |
219 | gk20a_vm_unmap_locked(mapped_buffer, NULL); | 221 | nvgpu_vm_unmap_locked(mapped_buffer, NULL); |
220 | nvgpu_rbtree_enum_start(0, &node, vm->mapped_buffers); | 222 | nvgpu_rbtree_enum_start(0, &node, vm->mapped_buffers); |
221 | } | 223 | } |
222 | 224 | ||
@@ -454,7 +456,7 @@ static int vgpu_vm_bind_channel(struct gk20a_as_share *as_share, | |||
454 | } | 456 | } |
455 | 457 | ||
456 | if (ch->vm) | 458 | if (ch->vm) |
457 | gk20a_vm_get(ch->vm); | 459 | nvgpu_vm_get(ch->vm); |
458 | 460 | ||
459 | return err; | 461 | return err; |
460 | } | 462 | } |