summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-07-31 21:54:38 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-14 18:55:19 -0400
commit959c02d6757c3c40748f7d2db1515885a5066a12 (patch)
tree58b685a52bc8b543565645227219c1c9609a50b3 /drivers/gpu/nvgpu/gp10b
parentee60394abc9a52182892ab54554d3e9c841080bf (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: Ieb87a62f047510e51c52e6563d8e3fd5a65b5f28 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1537753 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b')
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c29
-rw-r--r--drivers/gpu/nvgpu/gp10b/mm_gp10b.c30
-rw-r--r--drivers/gpu/nvgpu/gp10b/mm_gp10b.h19
3 files changed, 51 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index b0871155..a37295bb 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -17,6 +17,7 @@
17#include "gk20a/fifo_gk20a.h" 17#include "gk20a/fifo_gk20a.h"
18#include "gk20a/ctxsw_trace_gk20a.h" 18#include "gk20a/ctxsw_trace_gk20a.h"
19#include "gk20a/fecs_trace_gk20a.h" 19#include "gk20a/fecs_trace_gk20a.h"
20#include "gk20a/mm_gk20a.h"
20#include "gk20a/dbg_gpu_gk20a.h" 21#include "gk20a/dbg_gpu_gk20a.h"
21#include "gk20a/css_gr_gk20a.h" 22#include "gk20a/css_gr_gk20a.h"
22#include "gk20a/bus_gk20a.h" 23#include "gk20a/bus_gk20a.h"
@@ -47,8 +48,8 @@
47#include "gm20b/fifo_gm20b.h" 48#include "gm20b/fifo_gm20b.h"
48#include "gm20b/pmu_gm20b.h" 49#include "gm20b/pmu_gm20b.h"
49#include "gm20b/clk_gm20b.h" 50#include "gm20b/clk_gm20b.h"
50#include "gm20b/fifo_gm20b.h"
51#include "gm20b/fb_gm20b.h" 51#include "gm20b/fb_gm20b.h"
52#include "gm20b/mm_gm20b.h"
52 53
53#include "gp10b.h" 54#include "gp10b.h"
54#include "hal_gp10b.h" 55#include "hal_gp10b.h"
@@ -319,6 +320,30 @@ static const struct gpu_ops gp10b_ops = {
319 .max_entries = gk20a_gr_max_entries, 320 .max_entries = gk20a_gr_max_entries,
320 }, 321 },
321#endif /* CONFIG_GK20A_CTXSW_TRACE */ 322#endif /* CONFIG_GK20A_CTXSW_TRACE */
323 .mm = {
324 .support_sparse = gm20b_mm_support_sparse,
325 .gmmu_map = gk20a_locked_gmmu_map,
326 .gmmu_unmap = gk20a_locked_gmmu_unmap,
327 .vm_bind_channel = gk20a_vm_bind_channel,
328 .fb_flush = gk20a_mm_fb_flush,
329 .l2_invalidate = gk20a_mm_l2_invalidate,
330 .l2_flush = gk20a_mm_l2_flush,
331 .cbc_clean = gk20a_mm_cbc_clean,
332 .set_big_page_size = gm20b_mm_set_big_page_size,
333 .get_big_page_sizes = gm20b_mm_get_big_page_sizes,
334 .get_default_big_page_size = gp10b_mm_get_default_big_page_size,
335 .gpu_phys_addr = gm20b_gpu_phys_addr,
336 .get_physical_addr_bits = gp10b_mm_get_physical_addr_bits,
337 .get_mmu_levels = gp10b_mm_get_mmu_levels,
338 .init_pdb = gp10b_mm_init_pdb,
339 .init_mm_setup_hw = gp10b_init_mm_setup_hw,
340 .is_bar1_supported = gm20b_mm_is_bar1_supported,
341 .init_inst_block = gk20a_init_inst_block,
342 .mmu_fault_pending = gk20a_fifo_mmu_fault_pending,
343 .init_bar2_vm = gb10b_init_bar2_vm,
344 .init_bar2_mm_hw_setup = gb10b_init_bar2_mm_hw_setup,
345 .remove_bar2_vm = gp10b_remove_bar2_vm,
346 },
322 .pramin = { 347 .pramin = {
323 .enter = gk20a_pramin_enter, 348 .enter = gk20a_pramin_enter,
324 .exit = gk20a_pramin_exit, 349 .exit = gk20a_pramin_exit,
@@ -427,6 +452,7 @@ int gp10b_init_hal(struct gk20a *g)
427 gops->fifo = gp10b_ops.fifo; 452 gops->fifo = gp10b_ops.fifo;
428 gops->gr_ctx = gp10b_ops.gr_ctx; 453 gops->gr_ctx = gp10b_ops.gr_ctx;
429 gops->fecs_trace = gp10b_ops.fecs_trace; 454 gops->fecs_trace = gp10b_ops.fecs_trace;
455 gops->mm = gp10b_ops.mm;
430 gops->pramin = gp10b_ops.pramin; 456 gops->pramin = gp10b_ops.pramin;
431 gops->therm = gp10b_ops.therm; 457 gops->therm = gp10b_ops.therm;
432 gops->regops = gp10b_ops.regops; 458 gops->regops = gp10b_ops.regops;
@@ -489,7 +515,6 @@ int gp10b_init_hal(struct gk20a *g)
489 515
490 g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT; 516 g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT;
491 gp10b_init_gr(g); 517 gp10b_init_gr(g);
492 gp10b_init_mm(gops);
493 gp10b_init_pmu_ops(g); 518 gp10b_init_pmu_ops(g);
494 519
495 gp10b_init_uncompressed_kind_map(); 520 gp10b_init_uncompressed_kind_map();
diff --git a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
index 9aa72e64..6b629ecf 100644
--- a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
@@ -27,17 +27,17 @@
27#include <nvgpu/hw/gp10b/hw_bus_gp10b.h> 27#include <nvgpu/hw/gp10b/hw_bus_gp10b.h>
28#include <nvgpu/hw/gp10b/hw_gmmu_gp10b.h> 28#include <nvgpu/hw/gp10b/hw_gmmu_gp10b.h>
29 29
30static u32 gp10b_mm_get_default_big_page_size(void) 30u32 gp10b_mm_get_default_big_page_size(void)
31{ 31{
32 return SZ_64K; 32 return SZ_64K;
33} 33}
34 34
35static u32 gp10b_mm_get_physical_addr_bits(struct gk20a *g) 35u32 gp10b_mm_get_physical_addr_bits(struct gk20a *g)
36{ 36{
37 return 36; 37 return 36;
38} 38}
39 39
40static int gp10b_init_mm_setup_hw(struct gk20a *g) 40int gp10b_init_mm_setup_hw(struct gk20a *g)
41{ 41{
42 struct mm_gk20a *mm = &g->mm; 42 struct mm_gk20a *mm = &g->mm;
43 struct nvgpu_mem *inst_block = &mm->bar1.inst_block; 43 struct nvgpu_mem *inst_block = &mm->bar1.inst_block;
@@ -68,7 +68,7 @@ static int gp10b_init_mm_setup_hw(struct gk20a *g)
68 68
69} 69}
70 70
71static int gb10b_init_bar2_vm(struct gk20a *g) 71int gb10b_init_bar2_vm(struct gk20a *g)
72{ 72{
73 int err; 73 int err;
74 struct mm_gk20a *mm = &g->mm; 74 struct mm_gk20a *mm = &g->mm;
@@ -99,7 +99,7 @@ clean_up_va:
99 return err; 99 return err;
100} 100}
101 101
102static int gb10b_init_bar2_mm_hw_setup(struct gk20a *g) 102int gb10b_init_bar2_mm_hw_setup(struct gk20a *g)
103{ 103{
104 struct mm_gk20a *mm = &g->mm; 104 struct mm_gk20a *mm = &g->mm;
105 struct nvgpu_mem *inst_block = &mm->bar2.inst_block; 105 struct nvgpu_mem *inst_block = &mm->bar2.inst_block;
@@ -333,13 +333,13 @@ static const struct gk20a_mmu_level gp10b_mm_levels[] = {
333 {.update_entry = NULL} 333 {.update_entry = NULL}
334}; 334};
335 335
336static const struct gk20a_mmu_level *gp10b_mm_get_mmu_levels(struct gk20a *g, 336const struct gk20a_mmu_level *gp10b_mm_get_mmu_levels(struct gk20a *g,
337 u32 big_page_size) 337 u32 big_page_size)
338{ 338{
339 return gp10b_mm_levels; 339 return gp10b_mm_levels;
340} 340}
341 341
342static void gp10b_mm_init_pdb(struct gk20a *g, struct nvgpu_mem *inst_block, 342void gp10b_mm_init_pdb(struct gk20a *g, struct nvgpu_mem *inst_block,
343 struct vm_gk20a *vm) 343 struct vm_gk20a *vm)
344{ 344{
345 u64 pdb_addr = nvgpu_mem_get_addr(g, vm->pdb.mem); 345 u64 pdb_addr = nvgpu_mem_get_addr(g, vm->pdb.mem);
@@ -360,7 +360,7 @@ static void gp10b_mm_init_pdb(struct gk20a *g, struct nvgpu_mem *inst_block,
360 ram_in_page_dir_base_hi_f(pdb_addr_hi)); 360 ram_in_page_dir_base_hi_f(pdb_addr_hi));
361} 361}
362 362
363static void gp10b_remove_bar2_vm(struct gk20a *g) 363void gp10b_remove_bar2_vm(struct gk20a *g)
364{ 364{
365 struct mm_gk20a *mm = &g->mm; 365 struct mm_gk20a *mm = &g->mm;
366 366
@@ -368,17 +368,3 @@ static void gp10b_remove_bar2_vm(struct gk20a *g)
368 gk20a_free_inst_block(g, &mm->bar2.inst_block); 368 gk20a_free_inst_block(g, &mm->bar2.inst_block);
369 nvgpu_vm_put(mm->bar2.vm); 369 nvgpu_vm_put(mm->bar2.vm);
370} 370}
371
372
373void gp10b_init_mm(struct gpu_ops *gops)
374{
375 gm20b_init_mm(gops);
376 gops->mm.get_default_big_page_size = gp10b_mm_get_default_big_page_size;
377 gops->mm.get_physical_addr_bits = gp10b_mm_get_physical_addr_bits;
378 gops->mm.init_mm_setup_hw = gp10b_init_mm_setup_hw;
379 gops->mm.init_bar2_vm = gb10b_init_bar2_vm;
380 gops->mm.init_bar2_mm_hw_setup = gb10b_init_bar2_mm_hw_setup;
381 gops->mm.get_mmu_levels = gp10b_mm_get_mmu_levels;
382 gops->mm.init_pdb = gp10b_mm_init_pdb;
383 gops->mm.remove_bar2_vm = gp10b_remove_bar2_vm;
384}
diff --git a/drivers/gpu/nvgpu/gp10b/mm_gp10b.h b/drivers/gpu/nvgpu/gp10b/mm_gp10b.h
index 4cc71ea6..a0b9acd6 100644
--- a/drivers/gpu/nvgpu/gp10b/mm_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/mm_gp10b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -14,7 +14,20 @@
14#ifndef MM_GP10B_H 14#ifndef MM_GP10B_H
15#define MM_GP10B_H 15#define MM_GP10B_H
16 16
17struct gpu_ops; 17struct gk20a;
18struct gk20a_mmu_level;
19struct nvgpu_mem;
20struct vm_gk20a;
21
22u32 gp10b_mm_get_default_big_page_size(void);
23u32 gp10b_mm_get_physical_addr_bits(struct gk20a *g);
24int gp10b_init_mm_setup_hw(struct gk20a *g);
25int gb10b_init_bar2_vm(struct gk20a *g);
26int gb10b_init_bar2_mm_hw_setup(struct gk20a *g);
27const struct gk20a_mmu_level *gp10b_mm_get_mmu_levels(struct gk20a *g,
28 u32 big_page_size);
29void gp10b_mm_init_pdb(struct gk20a *g, struct nvgpu_mem *inst_block,
30 struct vm_gk20a *vm);
31void gp10b_remove_bar2_vm(struct gk20a *g);
18 32
19void gp10b_init_mm(struct gpu_ops *gops);
20#endif 33#endif