summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-10-06 14:30:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-24 18:16:49 -0400
commit2a285d0607a20694476399f5719e74dbc26fcd58 (patch)
treeef0246e3ca7b933ce3ea4c74061f61cc2e394b8b /drivers/gpu/nvgpu/gp10b
parent748331cbab1c7af26ab1fbae5ead2cdaff22806a (diff)
gpu: nvgpu: Cleanup generic MM code in gk20a/mm_gk20a.c
Move much of the remaining generic MM code to a new common location: common/mm/mm.c. Also add a corresponding <nvgpu/mm.h> header. This mostly consists of init and cleanup code to handle the common MM data structures like the VIDMEM code, address spaces for various engines, etc. A few more indepth changes were made as well. 1. alloc_inst_block() has been added to the MM HAL. This used to be defined directly in the gk20a code but it used a register. As a result, if this register hypothetically changes in the future, it would need to become a HAL anyway. This path preempts that and for now just defines all HALs to use the gk20a version. 2. Rename as much as possible: global functions are, for the most part, prepended with nvgpu (there are a few exceptions which I have yet to decide what to do with). Functions that are static are renamed to be as consistent with their functionality as possible since in some cases function effect and function name have diverged. JIRA NVGPU-30 Change-Id: Ic948f1ecc2f7976eba4bb7169a44b7226bb7c0b5 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1574499 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b')
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c1
-rw-r--r--drivers/gpu/nvgpu/gp10b/mm_gp10b.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index b80722b8..a10df740 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -484,6 +484,7 @@ static const struct gpu_ops gp10b_ops = {
484 .init_pdb = gp10b_mm_init_pdb, 484 .init_pdb = gp10b_mm_init_pdb,
485 .init_mm_setup_hw = gp10b_init_mm_setup_hw, 485 .init_mm_setup_hw = gp10b_init_mm_setup_hw,
486 .is_bar1_supported = gm20b_mm_is_bar1_supported, 486 .is_bar1_supported = gm20b_mm_is_bar1_supported,
487 .alloc_inst_block = gk20a_alloc_inst_block,
487 .init_inst_block = gk20a_init_inst_block, 488 .init_inst_block = gk20a_init_inst_block,
488 .mmu_fault_pending = gk20a_fifo_mmu_fault_pending, 489 .mmu_fault_pending = gk20a_fifo_mmu_fault_pending,
489 .init_bar2_vm = gb10b_init_bar2_vm, 490 .init_bar2_vm = gb10b_init_bar2_vm,
diff --git a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
index 06a9b929..dc746153 100644
--- a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
@@ -22,6 +22,7 @@
22 * DEALINGS IN THE SOFTWARE. 22 * DEALINGS IN THE SOFTWARE.
23 */ 23 */
24 24
25#include <nvgpu/mm.h>
25#include <nvgpu/dma.h> 26#include <nvgpu/dma.h>
26#include <nvgpu/gmmu.h> 27#include <nvgpu/gmmu.h>
27 28
@@ -95,7 +96,7 @@ int gb10b_init_bar2_vm(struct gk20a *g)
95 return -ENOMEM; 96 return -ENOMEM;
96 97
97 /* allocate instance mem for bar2 */ 98 /* allocate instance mem for bar2 */
98 err = gk20a_alloc_inst_block(g, inst_block); 99 err = g->ops.mm.alloc_inst_block(g, inst_block);
99 if (err) 100 if (err)
100 goto clean_up_va; 101 goto clean_up_va;
101 102
@@ -112,7 +113,7 @@ int gb10b_init_bar2_mm_hw_setup(struct gk20a *g)
112{ 113{
113 struct mm_gk20a *mm = &g->mm; 114 struct mm_gk20a *mm = &g->mm;
114 struct nvgpu_mem *inst_block = &mm->bar2.inst_block; 115 struct nvgpu_mem *inst_block = &mm->bar2.inst_block;
115 u64 inst_pa = gk20a_mm_inst_block_addr(g, inst_block); 116 u64 inst_pa = nvgpu_inst_block_addr(g, inst_block);
116 117
117 gk20a_dbg_fn(""); 118 gk20a_dbg_fn("");
118 119
@@ -374,6 +375,6 @@ void gp10b_remove_bar2_vm(struct gk20a *g)
374 struct mm_gk20a *mm = &g->mm; 375 struct mm_gk20a *mm = &g->mm;
375 376
376 gp10b_replayable_pagefault_buffer_deinit(g); 377 gp10b_replayable_pagefault_buffer_deinit(g);
377 gk20a_free_inst_block(g, &mm->bar2.inst_block); 378 nvgpu_free_inst_block(g, &mm->bar2.inst_block);
378 nvgpu_vm_put(mm->bar2.vm); 379 nvgpu_vm_put(mm->bar2.vm);
379} 380}