diff options
author | Sunny He <suhe@nvidia.com> | 2017-07-31 21:54:38 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-14 18:55:19 -0400 |
commit | 959c02d6757c3c40748f7d2db1515885a5066a12 (patch) | |
tree | 58b685a52bc8b543565645227219c1c9609a50b3 /drivers/gpu/nvgpu/gm20b | |
parent | ee60394abc9a52182892ab54554d3e9c841080bf (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/gm20b')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 24 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/mm_gm20b.c | 33 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/mm_gm20b.h | 12 |
3 files changed, 36 insertions, 33 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index a540de64..073c377e 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "gk20a/fb_gk20a.h" | 19 | #include "gk20a/fb_gk20a.h" |
20 | #include "gk20a/fifo_gk20a.h" | 20 | #include "gk20a/fifo_gk20a.h" |
21 | #include "gk20a/therm_gk20a.h" | 21 | #include "gk20a/therm_gk20a.h" |
22 | #include "gk20a/mm_gk20a.h" | ||
22 | #include "gk20a/css_gr_gk20a.h" | 23 | #include "gk20a/css_gr_gk20a.h" |
23 | #include "gk20a/mc_gk20a.h" | 24 | #include "gk20a/mc_gk20a.h" |
24 | #include "gk20a/bus_gk20a.h" | 25 | #include "gk20a/bus_gk20a.h" |
@@ -287,6 +288,27 @@ static const struct gpu_ops gm20b_ops = { | |||
287 | .get_netlist_name = gr_gm20b_get_netlist_name, | 288 | .get_netlist_name = gr_gm20b_get_netlist_name, |
288 | .is_fw_defined = gr_gm20b_is_firmware_defined, | 289 | .is_fw_defined = gr_gm20b_is_firmware_defined, |
289 | }, | 290 | }, |
291 | .mm = { | ||
292 | .support_sparse = gm20b_mm_support_sparse, | ||
293 | .gmmu_map = gk20a_locked_gmmu_map, | ||
294 | .gmmu_unmap = gk20a_locked_gmmu_unmap, | ||
295 | .vm_bind_channel = gk20a_vm_bind_channel, | ||
296 | .fb_flush = gk20a_mm_fb_flush, | ||
297 | .l2_invalidate = gk20a_mm_l2_invalidate, | ||
298 | .l2_flush = gk20a_mm_l2_flush, | ||
299 | .cbc_clean = gk20a_mm_cbc_clean, | ||
300 | .set_big_page_size = gm20b_mm_set_big_page_size, | ||
301 | .get_big_page_sizes = gm20b_mm_get_big_page_sizes, | ||
302 | .get_default_big_page_size = gm20b_mm_get_default_big_page_size, | ||
303 | .gpu_phys_addr = gm20b_gpu_phys_addr, | ||
304 | .get_physical_addr_bits = gk20a_mm_get_physical_addr_bits, | ||
305 | .get_mmu_levels = gk20a_mm_get_mmu_levels, | ||
306 | .init_pdb = gk20a_mm_init_pdb, | ||
307 | .init_mm_setup_hw = gk20a_init_mm_setup_hw, | ||
308 | .is_bar1_supported = gm20b_mm_is_bar1_supported, | ||
309 | .init_inst_block = gk20a_init_inst_block, | ||
310 | .mmu_fault_pending = gk20a_fifo_mmu_fault_pending, | ||
311 | }, | ||
290 | .therm = { | 312 | .therm = { |
291 | .init_therm_setup_hw = gm20b_init_therm_setup_hw, | 313 | .init_therm_setup_hw = gm20b_init_therm_setup_hw, |
292 | .elcg_init_idle_filters = gk20a_elcg_init_idle_filters, | 314 | .elcg_init_idle_filters = gk20a_elcg_init_idle_filters, |
@@ -398,6 +420,7 @@ int gm20b_init_hal(struct gk20a *g) | |||
398 | gops->clock_gating = gm20b_ops.clock_gating; | 420 | gops->clock_gating = gm20b_ops.clock_gating; |
399 | gops->fifo = gm20b_ops.fifo; | 421 | gops->fifo = gm20b_ops.fifo; |
400 | gops->gr_ctx = gm20b_ops.gr_ctx; | 422 | gops->gr_ctx = gm20b_ops.gr_ctx; |
423 | gops->mm = gm20b_ops.mm; | ||
401 | gops->therm = gm20b_ops.therm; | 424 | gops->therm = gm20b_ops.therm; |
402 | /* | 425 | /* |
403 | * clk must be assigned member by member | 426 | * clk must be assigned member by member |
@@ -462,7 +485,6 @@ int gm20b_init_hal(struct gk20a *g) | |||
462 | #endif | 485 | #endif |
463 | g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT; | 486 | g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT; |
464 | gm20b_init_gr(g); | 487 | gm20b_init_gr(g); |
465 | gm20b_init_mm(gops); | ||
466 | gm20b_init_pmu_ops(g); | 488 | gm20b_init_pmu_ops(g); |
467 | 489 | ||
468 | gm20b_init_uncompressed_kind_map(); | 490 | gm20b_init_uncompressed_kind_map(); |
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c index bbcd6314..05752f03 100644 --- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <nvgpu/hw/gm20b/hw_gmmu_gm20b.h> | 20 | #include <nvgpu/hw/gm20b/hw_gmmu_gm20b.h> |
21 | #include <nvgpu/hw/gm20b/hw_ram_gm20b.h> | 21 | #include <nvgpu/hw/gm20b/hw_ram_gm20b.h> |
22 | 22 | ||
23 | static void gm20b_mm_set_big_page_size(struct gk20a *g, | 23 | void gm20b_mm_set_big_page_size(struct gk20a *g, |
24 | struct nvgpu_mem *mem, int size) | 24 | struct nvgpu_mem *mem, int size) |
25 | { | 25 | { |
26 | u32 val; | 26 | u32 val; |
@@ -40,22 +40,22 @@ static void gm20b_mm_set_big_page_size(struct gk20a *g, | |||
40 | gk20a_dbg_fn("done"); | 40 | gk20a_dbg_fn("done"); |
41 | } | 41 | } |
42 | 42 | ||
43 | static u32 gm20b_mm_get_big_page_sizes(void) | 43 | u32 gm20b_mm_get_big_page_sizes(void) |
44 | { | 44 | { |
45 | return SZ_64K | SZ_128K; | 45 | return SZ_64K | SZ_128K; |
46 | } | 46 | } |
47 | 47 | ||
48 | static u32 gm20b_mm_get_default_big_page_size(void) | 48 | u32 gm20b_mm_get_default_big_page_size(void) |
49 | { | 49 | { |
50 | return SZ_128K; | 50 | return SZ_128K; |
51 | } | 51 | } |
52 | 52 | ||
53 | static bool gm20b_mm_support_sparse(struct gk20a *g) | 53 | bool gm20b_mm_support_sparse(struct gk20a *g) |
54 | { | 54 | { |
55 | return true; | 55 | return true; |
56 | } | 56 | } |
57 | 57 | ||
58 | static bool gm20b_mm_is_bar1_supported(struct gk20a *g) | 58 | bool gm20b_mm_is_bar1_supported(struct gk20a *g) |
59 | { | 59 | { |
60 | return true; | 60 | return true; |
61 | } | 61 | } |
@@ -65,26 +65,3 @@ u64 gm20b_gpu_phys_addr(struct gk20a *g, | |||
65 | { | 65 | { |
66 | return phys; | 66 | return phys; |
67 | } | 67 | } |
68 | |||
69 | void gm20b_init_mm(struct gpu_ops *gops) | ||
70 | { | ||
71 | gops->mm.support_sparse = gm20b_mm_support_sparse; | ||
72 | gops->mm.gmmu_map = gk20a_locked_gmmu_map; | ||
73 | gops->mm.gmmu_unmap = gk20a_locked_gmmu_unmap; | ||
74 | gops->mm.vm_bind_channel = gk20a_vm_bind_channel; | ||
75 | gops->mm.fb_flush = gk20a_mm_fb_flush; | ||
76 | gops->mm.l2_invalidate = gk20a_mm_l2_invalidate; | ||
77 | gops->mm.l2_flush = gk20a_mm_l2_flush; | ||
78 | gops->mm.cbc_clean = gk20a_mm_cbc_clean; | ||
79 | gops->mm.set_big_page_size = gm20b_mm_set_big_page_size; | ||
80 | gops->mm.get_big_page_sizes = gm20b_mm_get_big_page_sizes; | ||
81 | gops->mm.get_default_big_page_size = gm20b_mm_get_default_big_page_size; | ||
82 | gops->mm.gpu_phys_addr = gm20b_gpu_phys_addr; | ||
83 | gops->mm.get_physical_addr_bits = gk20a_mm_get_physical_addr_bits; | ||
84 | gops->mm.get_mmu_levels = gk20a_mm_get_mmu_levels; | ||
85 | gops->mm.init_pdb = gk20a_mm_init_pdb; | ||
86 | gops->mm.init_mm_setup_hw = gk20a_init_mm_setup_hw; | ||
87 | gops->mm.is_bar1_supported = gm20b_mm_is_bar1_supported; | ||
88 | gops->mm.init_inst_block = gk20a_init_inst_block; | ||
89 | gops->mm.mmu_fault_pending = gk20a_fifo_mmu_fault_pending; | ||
90 | } | ||
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.h b/drivers/gpu/nvgpu/gm20b/mm_gm20b.h index 2bb29ea8..b1bb38a3 100644 --- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GM20B GMMU | 2 | * GM20B GMMU |
3 | * | 3 | * |
4 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -20,9 +20,13 @@ struct gk20a; | |||
20 | #define PDE_ADDR_START(x, y) ((x) & ~((0x1UL << (y)) - 1)) | 20 | #define PDE_ADDR_START(x, y) ((x) & ~((0x1UL << (y)) - 1)) |
21 | #define PDE_ADDR_END(x, y) ((x) | ((0x1UL << (y)) - 1)) | 21 | #define PDE_ADDR_END(x, y) ((x) | ((0x1UL << (y)) - 1)) |
22 | 22 | ||
23 | void gm20b_mm_set_big_page_size(struct gk20a *g, | ||
24 | struct nvgpu_mem *mem, int size); | ||
25 | u32 gm20b_mm_get_big_page_sizes(void); | ||
26 | u32 gm20b_mm_get_default_big_page_size(void); | ||
27 | bool gm20b_mm_support_sparse(struct gk20a *g); | ||
28 | bool gm20b_mm_is_bar1_supported(struct gk20a *g); | ||
29 | int gm20b_mm_mmu_vpr_info_fetch(struct gk20a *g); | ||
23 | u64 gm20b_gpu_phys_addr(struct gk20a *g, | 30 | u64 gm20b_gpu_phys_addr(struct gk20a *g, |
24 | struct nvgpu_gmmu_attrs *attrs, u64 phys); | 31 | struct nvgpu_gmmu_attrs *attrs, u64 phys); |
25 | |||
26 | void gm20b_init_mm(struct gpu_ops *gops); | ||
27 | int gm20b_mm_mmu_vpr_info_fetch(struct gk20a *g); | ||
28 | #endif | 32 | #endif |