summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/fb_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/fb_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/fb_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/gm20b/fb_gm20b.c72
1 files changed, 72 insertions, 0 deletions
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
26static void fb_gm20b_init_fs_state(struct gk20a *g) 29static 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
146static 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
166int 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
178static 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
185static 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
143void gm20b_init_fb(struct gpu_ops *gops) 210void 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}