diff options
author | Sunny He <suhe@nvidia.com> | 2017-07-26 17:23:01 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-14 18:55:25 -0400 |
commit | 8ab6445df5b24c200ac4e346684119a85008e0e3 (patch) | |
tree | 557c0e126488532942c784bdfcdfe1e9bc6d2688 /drivers/gpu/nvgpu/gv100 | |
parent | 4bb0896912440d126ae47da350b448f37dabc63d (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: I5fd295c6473d5b4a6178c0c6be8fcf8f4c33f2e3
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1537754
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv100')
-rw-r--r-- | drivers/gpu/nvgpu/gv100/hal_gv100.c | 33 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv100/mm_gv100.c | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv100/mm_gv100.h | 4 |
3 files changed, 34 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c index a2a131da..74bc48fb 100644 --- a/drivers/gpu/nvgpu/gv100/hal_gv100.c +++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c | |||
@@ -31,11 +31,13 @@ | |||
31 | #include "gk20a/flcn_gk20a.h" | 31 | #include "gk20a/flcn_gk20a.h" |
32 | #include "gk20a/regops_gk20a.h" | 32 | #include "gk20a/regops_gk20a.h" |
33 | #include "gk20a/fb_gk20a.h" | 33 | #include "gk20a/fb_gk20a.h" |
34 | #include "gk20a/mm_gk20a.h" | ||
34 | 35 | ||
35 | #include "gm20b/ltc_gm20b.h" | 36 | #include "gm20b/ltc_gm20b.h" |
36 | #include "gm20b/gr_gm20b.h" | 37 | #include "gm20b/gr_gm20b.h" |
37 | #include "gm20b/fifo_gm20b.h" | 38 | #include "gm20b/fifo_gm20b.h" |
38 | #include "gm20b/fb_gm20b.h" | 39 | #include "gm20b/fb_gm20b.h" |
40 | #include "gm20b/mm_gm20b.h" | ||
39 | 41 | ||
40 | #include "gp10b/fb_gp10b.h" | 42 | #include "gp10b/fb_gp10b.h" |
41 | 43 | ||
@@ -55,6 +57,7 @@ | |||
55 | #include "gp10b/priv_ring_gp10b.h" | 57 | #include "gp10b/priv_ring_gp10b.h" |
56 | #include "gp10b/fifo_gp10b.h" | 58 | #include "gp10b/fifo_gp10b.h" |
57 | #include "gp10b/fecs_trace_gp10b.h" | 59 | #include "gp10b/fecs_trace_gp10b.h" |
60 | #include "gp10b/mm_gp10b.h" | ||
58 | 61 | ||
59 | #include "gv11b/hal_gv11b.h" | 62 | #include "gv11b/hal_gv11b.h" |
60 | #include "gv11b/gr_gv11b.h" | 63 | #include "gv11b/gr_gv11b.h" |
@@ -63,7 +66,7 @@ | |||
63 | #include "gv11b/gv11b.h" | 66 | #include "gv11b/gv11b.h" |
64 | #include "gv11b/ce_gv11b.h" | 67 | #include "gv11b/ce_gv11b.h" |
65 | #include "gv100/gr_ctx_gv100.h" | 68 | #include "gv100/gr_ctx_gv100.h" |
66 | #include "gv100/mm_gv100.h" | 69 | #include "gv11b/mm_gv11b.h" |
67 | #include "gv11b/pmu_gv11b.h" | 70 | #include "gv11b/pmu_gv11b.h" |
68 | #include "gv11b/fb_gv11b.h" | 71 | #include "gv11b/fb_gv11b.h" |
69 | #include "gv11b/fifo_gv11b.h" | 72 | #include "gv11b/fifo_gv11b.h" |
@@ -74,6 +77,7 @@ | |||
74 | #include "gv100.h" | 77 | #include "gv100.h" |
75 | #include "hal_gv100.h" | 78 | #include "hal_gv100.h" |
76 | #include "gv100/fb_gv100.h" | 79 | #include "gv100/fb_gv100.h" |
80 | #include "gv100/mm_gv100.h" | ||
77 | 81 | ||
78 | #include <nvgpu/debug.h> | 82 | #include <nvgpu/debug.h> |
79 | #include <nvgpu/enabled.h> | 83 | #include <nvgpu/enabled.h> |
@@ -310,6 +314,32 @@ static const struct gpu_ops gv100_ops = { | |||
310 | .max_entries = gk20a_gr_max_entries, | 314 | .max_entries = gk20a_gr_max_entries, |
311 | }, | 315 | }, |
312 | #endif /* CONFIG_GK20A_CTXSW_TRACE */ | 316 | #endif /* CONFIG_GK20A_CTXSW_TRACE */ |
317 | .mm = { | ||
318 | .support_sparse = gm20b_mm_support_sparse, | ||
319 | .gmmu_map = gk20a_locked_gmmu_map, | ||
320 | .gmmu_unmap = gk20a_locked_gmmu_unmap, | ||
321 | .vm_bind_channel = gk20a_vm_bind_channel, | ||
322 | .fb_flush = gk20a_mm_fb_flush, | ||
323 | .l2_invalidate = gk20a_mm_l2_invalidate, | ||
324 | .l2_flush = gv11b_mm_l2_flush, | ||
325 | .cbc_clean = gk20a_mm_cbc_clean, | ||
326 | .set_big_page_size = gm20b_mm_set_big_page_size, | ||
327 | .get_big_page_sizes = gm20b_mm_get_big_page_sizes, | ||
328 | .get_default_big_page_size = gp10b_mm_get_default_big_page_size, | ||
329 | .gpu_phys_addr = gv11b_gpu_phys_addr, | ||
330 | .get_physical_addr_bits = NULL, | ||
331 | .get_mmu_levels = gp10b_mm_get_mmu_levels, | ||
332 | .get_vidmem_size = gv100_mm_get_vidmem_size, | ||
333 | .init_pdb = gp10b_mm_init_pdb, | ||
334 | .init_mm_setup_hw = gv11b_init_mm_setup_hw, | ||
335 | .is_bar1_supported = gv11b_mm_is_bar1_supported, | ||
336 | .init_inst_block = gv11b_init_inst_block, | ||
337 | .mmu_fault_pending = gv11b_mm_mmu_fault_pending, | ||
338 | .init_bar2_vm = gb10b_init_bar2_vm, | ||
339 | .init_bar2_mm_hw_setup = gv11b_init_bar2_mm_hw_setup, | ||
340 | .remove_bar2_vm = gv11b_mm_remove_bar2_vm, | ||
341 | .fault_info_mem_destroy = gv11b_mm_fault_info_mem_destroy, | ||
342 | }, | ||
313 | .pramin = { | 343 | .pramin = { |
314 | .enter = gk20a_pramin_enter, | 344 | .enter = gk20a_pramin_enter, |
315 | .exit = gk20a_pramin_exit, | 345 | .exit = gk20a_pramin_exit, |
@@ -446,7 +476,6 @@ int gv100_init_hal(struct gk20a *g) | |||
446 | g->bootstrap_owner = LSF_FALCON_ID_SEC2; | 476 | g->bootstrap_owner = LSF_FALCON_ID_SEC2; |
447 | 477 | ||
448 | gv11b_init_gr(g); | 478 | gv11b_init_gr(g); |
449 | gv100_init_mm(gops); | ||
450 | gp106_init_pmu_ops(g); | 479 | gp106_init_pmu_ops(g); |
451 | 480 | ||
452 | gv11b_init_uncompressed_kind_map(); | 481 | gv11b_init_uncompressed_kind_map(); |
diff --git a/drivers/gpu/nvgpu/gv100/mm_gv100.c b/drivers/gpu/nvgpu/gv100/mm_gv100.c index fbc5df79..6952cb5e 100644 --- a/drivers/gpu/nvgpu/gv100/mm_gv100.c +++ b/drivers/gpu/nvgpu/gv100/mm_gv100.c | |||
@@ -14,12 +14,11 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "gk20a/gk20a.h" | 16 | #include "gk20a/gk20a.h" |
17 | #include "gv11b/mm_gv11b.h" | ||
18 | #include "gv100/mm_gv100.h" | 17 | #include "gv100/mm_gv100.h" |
19 | 18 | ||
20 | #include <nvgpu/hw/gv100/hw_fb_gv100.h> | 19 | #include <nvgpu/hw/gv100/hw_fb_gv100.h> |
21 | 20 | ||
22 | static size_t gv100_mm_get_vidmem_size(struct gk20a *g) | 21 | size_t gv100_mm_get_vidmem_size(struct gk20a *g) |
23 | { | 22 | { |
24 | u32 range = gk20a_readl(g, fb_mmu_local_memory_range_r()); | 23 | u32 range = gk20a_readl(g, fb_mmu_local_memory_range_r()); |
25 | u32 mag = fb_mmu_local_memory_range_lower_mag_v(range); | 24 | u32 mag = fb_mmu_local_memory_range_lower_mag_v(range); |
@@ -32,10 +31,3 @@ static size_t gv100_mm_get_vidmem_size(struct gk20a *g) | |||
32 | 31 | ||
33 | return bytes; | 32 | return bytes; |
34 | } | 33 | } |
35 | |||
36 | void gv100_init_mm(struct gpu_ops *gops) | ||
37 | { | ||
38 | gv11b_init_mm(gops); | ||
39 | gops->mm.get_vidmem_size = gv100_mm_get_vidmem_size; | ||
40 | gops->mm.get_physical_addr_bits = NULL; | ||
41 | } | ||
diff --git a/drivers/gpu/nvgpu/gv100/mm_gv100.h b/drivers/gpu/nvgpu/gv100/mm_gv100.h index ff1bc3df..eeab7d56 100644 --- a/drivers/gpu/nvgpu/gv100/mm_gv100.h +++ b/drivers/gpu/nvgpu/gv100/mm_gv100.h | |||
@@ -16,8 +16,8 @@ | |||
16 | #ifndef MM_GV100_H | 16 | #ifndef MM_GV100_H |
17 | #define MM_GV100_H | 17 | #define MM_GV100_H |
18 | 18 | ||
19 | struct gpu_ops; | 19 | struct gk20a; |
20 | 20 | ||
21 | void gv100_init_mm(struct gpu_ops *gops); | 21 | size_t gv100_mm_get_vidmem_size(struct gk20a *g); |
22 | 22 | ||
23 | #endif | 23 | #endif |