summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-03-15 17:08:32 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-17 11:44:03 -0400
commitca762e42205febba72ce063417e1ac598610941d (patch)
treecaff32adafb4c09ed335756da3e8beb7b87fe47b /drivers/gpu/nvgpu/gm20b/mm_gm20b.c
parent0742f4e7032aabf44a31792330fcd4f55f4540f7 (diff)
gpu: nvgpu: Move all FB programming to FB HAL
Move all programming of FB to fb_*.c files, and remove the inclusion of FB hardware headers from other files. TLB invalidate function took previously a pointer to VM, but the new API takes only a PDB mem_desc, because FB does not need to know about higher level VM. GPC MMU is programmed from the same function as FB MMU, so added dependency to GR hardware header to FB. GP106 ACR was also triggering a VPR fetch, but that's not applicable to dGPU, so removed that call. Change-Id: I4eb69377ac3745da205907626cf60948b7c5392a Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1321516 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/mm_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/gm20b/mm_gm20b.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
index cd1a106d..0b3192cc 100644
--- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
@@ -22,75 +22,9 @@
22#include <nvgpu/timers.h> 22#include <nvgpu/timers.h>
23 23
24#include <nvgpu/hw/gm20b/hw_gmmu_gm20b.h> 24#include <nvgpu/hw/gm20b/hw_gmmu_gm20b.h>
25#include <nvgpu/hw/gm20b/hw_fb_gm20b.h>
26#include <nvgpu/hw/gm20b/hw_gr_gm20b.h>
27#include <nvgpu/hw/gm20b/hw_ram_gm20b.h> 25#include <nvgpu/hw/gm20b/hw_ram_gm20b.h>
28#include <nvgpu/hw/gm20b/hw_bus_gm20b.h> 26#include <nvgpu/hw/gm20b/hw_bus_gm20b.h>
29 27
30static int gm20b_mm_mmu_vpr_info_fetch_wait(struct gk20a *g,
31 unsigned int msec)
32{
33 struct nvgpu_timeout timeout;
34
35 nvgpu_timeout_init(g, &timeout, msec, NVGPU_TIMER_CPU_TIMER);
36
37 do {
38 u32 val;
39
40 val = gk20a_readl(g, fb_mmu_vpr_info_r());
41 if (fb_mmu_vpr_info_fetch_v(val) ==
42 fb_mmu_vpr_info_fetch_false_v())
43 return 0;
44
45 } while (!nvgpu_timeout_expired(&timeout));
46
47 return -ETIMEDOUT;
48}
49
50int gm20b_mm_mmu_vpr_info_fetch(struct gk20a *g)
51{
52 if (gm20b_mm_mmu_vpr_info_fetch_wait(g, VPR_INFO_FETCH_WAIT)) {
53 return -ETIME;
54 }
55
56 gk20a_writel(g, fb_mmu_vpr_info_r(),
57 fb_mmu_vpr_info_fetch_true_v());
58
59 return gm20b_mm_mmu_vpr_info_fetch_wait(g, VPR_INFO_FETCH_WAIT);
60}
61
62static bool gm20b_mm_mmu_debug_mode_enabled(struct gk20a *g)
63{
64 u32 debug_ctrl = gk20a_readl(g, gr_gpcs_pri_mmu_debug_ctrl_r());
65 return gr_gpcs_pri_mmu_debug_ctrl_debug_v(debug_ctrl) ==
66 gr_gpcs_pri_mmu_debug_ctrl_debug_enabled_v();
67}
68
69static void gm20b_mm_mmu_set_debug_mode(struct gk20a *g, bool enable)
70{
71 u32 reg_val, fb_debug_ctrl, gpc_debug_ctrl;
72
73 if (enable) {
74 fb_debug_ctrl = fb_mmu_debug_ctrl_debug_enabled_f();
75 gpc_debug_ctrl = gr_gpcs_pri_mmu_debug_ctrl_debug_enabled_f();
76 g->mmu_debug_ctrl = true;
77 } else {
78 fb_debug_ctrl = fb_mmu_debug_ctrl_debug_disabled_f();
79 gpc_debug_ctrl = gr_gpcs_pri_mmu_debug_ctrl_debug_disabled_f();
80 g->mmu_debug_ctrl = false;
81 }
82
83 reg_val = gk20a_readl(g, fb_mmu_debug_ctrl_r());
84 reg_val = set_field(reg_val,
85 fb_mmu_debug_ctrl_debug_m(), fb_debug_ctrl);
86 gk20a_writel(g, fb_mmu_debug_ctrl_r(), reg_val);
87
88 reg_val = gk20a_readl(g, gr_gpcs_pri_mmu_debug_ctrl_r());
89 reg_val = set_field(reg_val,
90 gr_gpcs_pri_mmu_debug_ctrl_debug_m(), gpc_debug_ctrl);
91 gk20a_writel(g, gr_gpcs_pri_mmu_debug_ctrl_r(), reg_val);
92}
93
94static void gm20b_mm_set_big_page_size(struct gk20a *g, 28static void gm20b_mm_set_big_page_size(struct gk20a *g,
95 struct mem_desc *mem, int size) 29 struct mem_desc *mem, int size)
96{ 30{
@@ -157,8 +91,6 @@ static bool gm20b_mm_is_bar1_supported(struct gk20a *g)
157void gm20b_init_mm(struct gpu_ops *gops) 91void gm20b_init_mm(struct gpu_ops *gops)
158{ 92{
159 gops->mm.support_sparse = gm20b_mm_support_sparse; 93 gops->mm.support_sparse = gm20b_mm_support_sparse;
160 gops->mm.is_debug_mode_enabled = gm20b_mm_mmu_debug_mode_enabled;
161 gops->mm.set_debug_mode = gm20b_mm_mmu_set_debug_mode;
162 gops->mm.gmmu_map = gk20a_locked_gmmu_map; 94 gops->mm.gmmu_map = gk20a_locked_gmmu_map;
163 gops->mm.gmmu_unmap = gk20a_locked_gmmu_unmap; 95 gops->mm.gmmu_unmap = gk20a_locked_gmmu_unmap;
164 gops->mm.vm_remove = gk20a_vm_remove_support; 96 gops->mm.vm_remove = gk20a_vm_remove_support;
@@ -168,7 +100,6 @@ void gm20b_init_mm(struct gpu_ops *gops)
168 gops->mm.l2_invalidate = gk20a_mm_l2_invalidate; 100 gops->mm.l2_invalidate = gk20a_mm_l2_invalidate;
169 gops->mm.l2_flush = gk20a_mm_l2_flush; 101 gops->mm.l2_flush = gk20a_mm_l2_flush;
170 gops->mm.cbc_clean = gk20a_mm_cbc_clean; 102 gops->mm.cbc_clean = gk20a_mm_cbc_clean;
171 gops->mm.tlb_invalidate = gk20a_mm_tlb_invalidate;
172 gops->mm.set_big_page_size = gm20b_mm_set_big_page_size; 103 gops->mm.set_big_page_size = gm20b_mm_set_big_page_size;
173 gops->mm.get_big_page_sizes = gm20b_mm_get_big_page_sizes; 104 gops->mm.get_big_page_sizes = gm20b_mm_get_big_page_sizes;
174 gops->mm.get_iova_addr = gk20a_mm_iova_addr; 105 gops->mm.get_iova_addr = gk20a_mm_iova_addr;