diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/acr_gm20b.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/fb_gm20b.c | 72 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/mm_gm20b.c | 69 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/mm_gm20b.h | 1 |
4 files changed, 73 insertions, 71 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c index 2d932b67..bcad4437 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c | |||
@@ -397,7 +397,7 @@ int prepare_ucode_blob(struct gk20a *g) | |||
397 | plsfm = &lsfm_l; | 397 | plsfm = &lsfm_l; |
398 | memset((void *)plsfm, 0, sizeof(struct ls_flcn_mgr)); | 398 | memset((void *)plsfm, 0, sizeof(struct ls_flcn_mgr)); |
399 | gm20b_dbg_pmu("fetching GMMU regs\n"); | 399 | gm20b_dbg_pmu("fetching GMMU regs\n"); |
400 | gm20b_mm_mmu_vpr_info_fetch(g); | 400 | g->ops.fb.vpr_info_fetch(g); |
401 | gr_gk20a_init_ctxsw_ucode(g); | 401 | gr_gk20a_init_ctxsw_ucode(g); |
402 | 402 | ||
403 | g->ops.pmu.get_wpr(g, &wpr_inf); | 403 | g->ops.pmu.get_wpr(g, &wpr_inf); |
diff --git a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c index 985248b0..b50cb2d1 100644 --- a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c | |||
@@ -22,6 +22,9 @@ | |||
22 | #include <nvgpu/hw/gm20b/hw_fb_gm20b.h> | 22 | #include <nvgpu/hw/gm20b/hw_fb_gm20b.h> |
23 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> | 23 | #include <nvgpu/hw/gm20b/hw_top_gm20b.h> |
24 | #include <nvgpu/hw/gm20b/hw_gmmu_gm20b.h> | 24 | #include <nvgpu/hw/gm20b/hw_gmmu_gm20b.h> |
25 | #include <nvgpu/hw/gm20b/hw_gr_gm20b.h> | ||
26 | |||
27 | #define VPR_INFO_FETCH_WAIT (5) | ||
25 | 28 | ||
26 | static void fb_gm20b_init_fs_state(struct gk20a *g) | 29 | static void fb_gm20b_init_fs_state(struct gk20a *g) |
27 | { | 30 | { |
@@ -140,15 +143,84 @@ static void gm20b_fb_dump_vpr_wpr_info(struct gk20a *g) | |||
140 | 143 | ||
141 | } | 144 | } |
142 | 145 | ||
146 | static int gm20b_fb_vpr_info_fetch_wait(struct gk20a *g, | ||
147 | unsigned int msec) | ||
148 | { | ||
149 | struct nvgpu_timeout timeout; | ||
150 | |||
151 | nvgpu_timeout_init(g, &timeout, msec, NVGPU_TIMER_CPU_TIMER); | ||
152 | |||
153 | do { | ||
154 | u32 val; | ||
155 | |||
156 | val = gk20a_readl(g, fb_mmu_vpr_info_r()); | ||
157 | if (fb_mmu_vpr_info_fetch_v(val) == | ||
158 | fb_mmu_vpr_info_fetch_false_v()) | ||
159 | return 0; | ||
160 | |||
161 | } while (!nvgpu_timeout_expired(&timeout)); | ||
162 | |||
163 | return -ETIMEDOUT; | ||
164 | } | ||
165 | |||
166 | int gm20b_fb_vpr_info_fetch(struct gk20a *g) | ||
167 | { | ||
168 | if (gm20b_fb_vpr_info_fetch_wait(g, VPR_INFO_FETCH_WAIT)) { | ||
169 | return -ETIME; | ||
170 | } | ||
171 | |||
172 | gk20a_writel(g, fb_mmu_vpr_info_r(), | ||
173 | fb_mmu_vpr_info_fetch_true_v()); | ||
174 | |||
175 | return gm20b_fb_vpr_info_fetch_wait(g, VPR_INFO_FETCH_WAIT); | ||
176 | } | ||
177 | |||
178 | static bool gm20b_fb_debug_mode_enabled(struct gk20a *g) | ||
179 | { | ||
180 | u32 debug_ctrl = gk20a_readl(g, gr_gpcs_pri_mmu_debug_ctrl_r()); | ||
181 | return gr_gpcs_pri_mmu_debug_ctrl_debug_v(debug_ctrl) == | ||
182 | gr_gpcs_pri_mmu_debug_ctrl_debug_enabled_v(); | ||
183 | } | ||
184 | |||
185 | static void gm20b_fb_set_debug_mode(struct gk20a *g, bool enable) | ||
186 | { | ||
187 | u32 reg_val, fb_debug_ctrl, gpc_debug_ctrl; | ||
188 | |||
189 | if (enable) { | ||
190 | fb_debug_ctrl = fb_mmu_debug_ctrl_debug_enabled_f(); | ||
191 | gpc_debug_ctrl = gr_gpcs_pri_mmu_debug_ctrl_debug_enabled_f(); | ||
192 | g->mmu_debug_ctrl = true; | ||
193 | } else { | ||
194 | fb_debug_ctrl = fb_mmu_debug_ctrl_debug_disabled_f(); | ||
195 | gpc_debug_ctrl = gr_gpcs_pri_mmu_debug_ctrl_debug_disabled_f(); | ||
196 | g->mmu_debug_ctrl = false; | ||
197 | } | ||
198 | |||
199 | reg_val = gk20a_readl(g, fb_mmu_debug_ctrl_r()); | ||
200 | reg_val = set_field(reg_val, | ||
201 | fb_mmu_debug_ctrl_debug_m(), fb_debug_ctrl); | ||
202 | gk20a_writel(g, fb_mmu_debug_ctrl_r(), reg_val); | ||
203 | |||
204 | reg_val = gk20a_readl(g, gr_gpcs_pri_mmu_debug_ctrl_r()); | ||
205 | reg_val = set_field(reg_val, | ||
206 | gr_gpcs_pri_mmu_debug_ctrl_debug_m(), gpc_debug_ctrl); | ||
207 | gk20a_writel(g, gr_gpcs_pri_mmu_debug_ctrl_r(), reg_val); | ||
208 | } | ||
209 | |||
143 | void gm20b_init_fb(struct gpu_ops *gops) | 210 | void gm20b_init_fb(struct gpu_ops *gops) |
144 | { | 211 | { |
145 | gops->fb.reset = fb_gk20a_reset; | 212 | gops->fb.reset = fb_gk20a_reset; |
213 | gops->fb.init_hw = gk20a_fb_init_hw; | ||
146 | gops->fb.init_fs_state = fb_gm20b_init_fs_state; | 214 | gops->fb.init_fs_state = fb_gm20b_init_fs_state; |
147 | gops->fb.set_mmu_page_size = gm20b_fb_set_mmu_page_size; | 215 | gops->fb.set_mmu_page_size = gm20b_fb_set_mmu_page_size; |
148 | gops->fb.set_use_full_comp_tag_line = gm20b_fb_set_use_full_comp_tag_line; | 216 | gops->fb.set_use_full_comp_tag_line = gm20b_fb_set_use_full_comp_tag_line; |
149 | gops->fb.compression_page_size = gm20b_fb_compression_page_size; | 217 | gops->fb.compression_page_size = gm20b_fb_compression_page_size; |
150 | gops->fb.compressible_page_size = gm20b_fb_compressible_page_size; | 218 | gops->fb.compressible_page_size = gm20b_fb_compressible_page_size; |
219 | gops->fb.vpr_info_fetch = gm20b_fb_vpr_info_fetch; | ||
151 | gops->fb.dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info; | 220 | gops->fb.dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info; |
221 | gops->fb.is_debug_mode_enabled = gm20b_fb_debug_mode_enabled; | ||
222 | gops->fb.set_debug_mode = gm20b_fb_set_debug_mode; | ||
223 | gops->fb.tlb_invalidate = gk20a_fb_tlb_invalidate; | ||
152 | gm20b_init_uncompressed_kind_map(); | 224 | gm20b_init_uncompressed_kind_map(); |
153 | gm20b_init_kind_attr(); | 225 | gm20b_init_kind_attr(); |
154 | } | 226 | } |
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 | ||
30 | static 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 | |||
50 | int 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 | |||
62 | static 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 | |||
69 | static 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 | |||
94 | static void gm20b_mm_set_big_page_size(struct gk20a *g, | 28 | static 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) | |||
157 | void gm20b_init_mm(struct gpu_ops *gops) | 91 | void 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; |
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.h b/drivers/gpu/nvgpu/gm20b/mm_gm20b.h index 6939fc1a..99d6c161 100644 --- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.h | |||
@@ -19,7 +19,6 @@ struct gk20a; | |||
19 | 19 | ||
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 | #define VPR_INFO_FETCH_WAIT (5) | ||
23 | 22 | ||
24 | void gm20b_init_mm(struct gpu_ops *gops); | 23 | void gm20b_init_mm(struct gpu_ops *gops); |
25 | int gm20b_mm_mmu_vpr_info_fetch(struct gk20a *g); | 24 | int gm20b_mm_mmu_vpr_info_fetch(struct gk20a *g); |