diff options
author | Sunny He <suhe@nvidia.com> | 2017-07-31 21:54:38 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-11 17:16:52 -0400 |
commit | 8d63cd3995d4a650b478ad69d7e29ed2b1b2d927 (patch) | |
tree | 5acb73abbe5ef0b94d7147156fa23d707d6ed1c0 /drivers/gpu/nvgpu/gk20a | |
parent | 63b74d4b768e0c96367d4983fdd8f1db1d317d01 (diff) |
gpu: nvgpu: Reorg mm HAL initialization
Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the
mm sub-module of the gpu_ops struct.
Perform HAL function assignments in hal_gxxxx.c through the
population of a chip-specific copy of gpu_ops.
Jira NVGPU-74
Change-Id: I289284e6e528fc7951c959c8765ccf9349eec33b
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1533351
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 17 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 12 |
2 files changed, 15 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 7b998204..58558159 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -734,16 +734,17 @@ struct gpu_ops { | |||
734 | void (*init_inst_block)(struct nvgpu_mem *inst_block, | 734 | void (*init_inst_block)(struct nvgpu_mem *inst_block, |
735 | struct vm_gk20a *vm, u32 big_page_size); | 735 | struct vm_gk20a *vm, u32 big_page_size); |
736 | bool (*mmu_fault_pending)(struct gk20a *g); | 736 | bool (*mmu_fault_pending)(struct gk20a *g); |
737 | /* This function is called to allocate secure memory (memory | ||
738 | * that the CPU cannot see). The function should fill the | ||
739 | * context buffer descriptor (especially fields destroy, sgt, | ||
740 | * size). | ||
741 | */ | ||
742 | int (*secure_alloc)(struct gk20a *g, | ||
743 | struct gr_ctx_buffer_desc *desc, | ||
744 | size_t size); | ||
745 | void (*fault_info_mem_destroy)(struct gk20a *g); | 737 | void (*fault_info_mem_destroy)(struct gk20a *g); |
746 | } mm; | 738 | } mm; |
739 | /* | ||
740 | * This function is called to allocate secure memory (memory | ||
741 | * that the CPU cannot see). The function should fill the | ||
742 | * context buffer descriptor (especially fields destroy, sgt, | ||
743 | * size). | ||
744 | */ | ||
745 | int (*secure_alloc)(struct gk20a *g, | ||
746 | struct gr_ctx_buffer_desc *desc, | ||
747 | size_t size); | ||
747 | struct { | 748 | struct { |
748 | u32 (*enter)(struct gk20a *g, struct nvgpu_mem *mem, | 749 | u32 (*enter)(struct gk20a *g, struct nvgpu_mem *mem, |
749 | struct page_alloc_chunk *chunk, u32 w); | 750 | struct page_alloc_chunk *chunk, u32 w); |
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 497e7ee2..608b011a 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -2524,8 +2524,8 @@ static int gr_gk20a_alloc_global_ctx_buffers(struct gk20a *g) | |||
2524 | if (err) | 2524 | if (err) |
2525 | goto clean_up; | 2525 | goto clean_up; |
2526 | 2526 | ||
2527 | if (g->ops.mm.secure_alloc) | 2527 | if (g->ops.secure_alloc) |
2528 | g->ops.mm.secure_alloc(g, | 2528 | g->ops.secure_alloc(g, |
2529 | &gr->global_ctx_buffer[CIRCULAR_VPR], | 2529 | &gr->global_ctx_buffer[CIRCULAR_VPR], |
2530 | cb_buffer_size); | 2530 | cb_buffer_size); |
2531 | 2531 | ||
@@ -2536,8 +2536,8 @@ static int gr_gk20a_alloc_global_ctx_buffers(struct gk20a *g) | |||
2536 | if (err) | 2536 | if (err) |
2537 | goto clean_up; | 2537 | goto clean_up; |
2538 | 2538 | ||
2539 | if (g->ops.mm.secure_alloc) | 2539 | if (g->ops.secure_alloc) |
2540 | g->ops.mm.secure_alloc(g, | 2540 | g->ops.secure_alloc(g, |
2541 | &gr->global_ctx_buffer[PAGEPOOL_VPR], | 2541 | &gr->global_ctx_buffer[PAGEPOOL_VPR], |
2542 | pagepool_buffer_size); | 2542 | pagepool_buffer_size); |
2543 | 2543 | ||
@@ -2548,8 +2548,8 @@ static int gr_gk20a_alloc_global_ctx_buffers(struct gk20a *g) | |||
2548 | if (err) | 2548 | if (err) |
2549 | goto clean_up; | 2549 | goto clean_up; |
2550 | 2550 | ||
2551 | if (g->ops.mm.secure_alloc) | 2551 | if (g->ops.secure_alloc) |
2552 | g->ops.mm.secure_alloc(g, | 2552 | g->ops.secure_alloc(g, |
2553 | &gr->global_ctx_buffer[ATTRIBUTE_VPR], | 2553 | &gr->global_ctx_buffer[ATTRIBUTE_VPR], |
2554 | attr_buffer_size); | 2554 | attr_buffer_size); |
2555 | 2555 | ||