summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv11b
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2018-05-25 13:27:10 -0400
committerTejal Kudav <tkudav@nvidia.com>2018-06-14 09:44:07 -0400
commit27694ca572c4d7698b107c6713f0f0604b41c186 (patch)
tree60dc8a1a8518797fd95f82d1e02892a984911667 /drivers/gpu/nvgpu/gv11b
parent5c8f1619ce5ab1cf46484c8914fa29bcc208b9a0 (diff)
gpu: nvgpu: Implement bus HAL for bar2 bind
Implement BAR2 bind as a bus HAL and remove the corresponding MM HAL. BAR2 bind HW API is in bus. JIRA NVGPU-588 Change-Id: I3a8391b00f1ba65f9ed28b633f1d52bf7c984230 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1730896 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b')
-rw-r--r--drivers/gpu/nvgpu/gv11b/fb_gv11b.c2
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c3
-rw-r--r--drivers/gpu/nvgpu/gv11b/mm_gv11b.c54
-rw-r--r--drivers/gpu/nvgpu/gv11b/mm_gv11b.h1
4 files changed, 4 insertions, 56 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c
index bba47471..9fd6c857 100644
--- a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c
@@ -1229,7 +1229,7 @@ static void gv11b_fb_handle_bar2_fault(struct gk20a *g,
1229 } 1229 }
1230 gv11b_ce_mthd_buffer_fault_in_bar2_fault(g); 1230 gv11b_ce_mthd_buffer_fault_in_bar2_fault(g);
1231 1231
1232 g->ops.mm.init_bar2_mm_hw_setup(g); 1232 g->ops.bus.bar2_bind(g, &g->mm.bar2.inst_block);
1233 1233
1234 if (mmfault->refch) { 1234 if (mmfault->refch) {
1235 gk20a_channel_put(mmfault->refch); 1235 gk20a_channel_put(mmfault->refch);
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 7b552723..58912a30 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include "common/bus/bus_gk20a.h" 25#include "common/bus/bus_gk20a.h"
26#include "common/bus/bus_gp10b.h"
26#include "common/clock_gating/gv11b_gating_reglist.h" 27#include "common/clock_gating/gv11b_gating_reglist.h"
27#include "common/ptimer/ptimer_gk20a.h" 28#include "common/ptimer/ptimer_gk20a.h"
28 29
@@ -621,7 +622,6 @@ static const struct gpu_ops gv11b_ops = {
621 .get_kind_invalid = gm20b_get_kind_invalid, 622 .get_kind_invalid = gm20b_get_kind_invalid,
622 .get_kind_pitch = gm20b_get_kind_pitch, 623 .get_kind_pitch = gm20b_get_kind_pitch,
623 .init_bar2_vm = gp10b_init_bar2_vm, 624 .init_bar2_vm = gp10b_init_bar2_vm,
624 .init_bar2_mm_hw_setup = gv11b_init_bar2_mm_hw_setup,
625 .remove_bar2_vm = gv11b_mm_remove_bar2_vm, 625 .remove_bar2_vm = gv11b_mm_remove_bar2_vm,
626 .fault_info_mem_destroy = gv11b_mm_fault_info_mem_destroy, 626 .fault_info_mem_destroy = gv11b_mm_fault_info_mem_destroy,
627 }, 627 },
@@ -724,6 +724,7 @@ static const struct gpu_ops gv11b_ops = {
724 .init_hw = gk20a_bus_init_hw, 724 .init_hw = gk20a_bus_init_hw,
725 .isr = gk20a_bus_isr, 725 .isr = gk20a_bus_isr,
726 .bar1_bind = NULL, 726 .bar1_bind = NULL,
727 .bar2_bind = gp10b_bus_bar2_bind,
727 .set_bar0_window = gk20a_bus_set_bar0_window, 728 .set_bar0_window = gk20a_bus_set_bar0_window,
728 }, 729 },
729 .ptimer = { 730 .ptimer = {
diff --git a/drivers/gpu/nvgpu/gv11b/mm_gv11b.c b/drivers/gpu/nvgpu/gv11b/mm_gv11b.c
index 357b15d7..6c38365c 100644
--- a/drivers/gpu/nvgpu/gv11b/mm_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/mm_gv11b.c
@@ -40,7 +40,6 @@
40 40
41#include <nvgpu/hw/gv11b/hw_fb_gv11b.h> 41#include <nvgpu/hw/gv11b/hw_fb_gv11b.h>
42#include <nvgpu/hw/gv11b/hw_gmmu_gv11b.h> 42#include <nvgpu/hw/gv11b/hw_gmmu_gv11b.h>
43#include <nvgpu/hw/gv11b/hw_bus_gv11b.h>
44 43
45#define NVGPU_L3_ALLOC_BIT BIT(36) 44#define NVGPU_L3_ALLOC_BIT BIT(36)
46 45
@@ -236,7 +235,7 @@ int gv11b_init_mm_setup_hw(struct gk20a *g)
236 g->ops.fb.set_mmu_page_size(g); 235 g->ops.fb.set_mmu_page_size(g);
237 g->ops.fb.init_hw(g); 236 g->ops.fb.init_hw(g);
238 237
239 err = g->ops.mm.init_bar2_mm_hw_setup(g); 238 err = g->ops.bus.bar2_bind(g, &g->mm.bar2.inst_block);
240 if (err) 239 if (err)
241 return err; 240 return err;
242 241
@@ -274,54 +273,3 @@ u64 gv11b_gpu_phys_addr(struct gk20a *g,
274 273
275 return phys; 274 return phys;
276} 275}
277
278int gv11b_init_bar2_mm_hw_setup(struct gk20a *g)
279{
280 struct mm_gk20a *mm = &g->mm;
281 struct nvgpu_mem *inst_block = &mm->bar2.inst_block;
282 u64 inst_pa = nvgpu_inst_block_addr(g, inst_block);
283 u32 reg_val;
284 struct nvgpu_timeout timeout;
285 u32 delay = GR_IDLE_CHECK_DEFAULT;
286
287 nvgpu_log_fn(g, " ");
288
289 g->ops.fb.set_mmu_page_size(g);
290
291 inst_pa = (u32)(inst_pa >> bus_bar2_block_ptr_shift_v());
292 nvgpu_log_info(g, "bar2 inst block ptr: 0x%08x", (u32)inst_pa);
293
294 gk20a_writel(g, bus_bar2_block_r(),
295 nvgpu_aperture_mask(g, inst_block,
296 bus_bar2_block_target_sys_mem_ncoh_f(),
297 bus_bar2_block_target_sys_mem_coh_f(),
298 bus_bar2_block_target_vid_mem_f()) |
299 bus_bar2_block_mode_virtual_f() |
300 bus_bar2_block_ptr_f(inst_pa));
301
302 /* This is needed as BAR1 support is removed and there is no way
303 * to know if gpu successfully accessed memory.
304 * To avoid deadlocks and non-deterministic virtual address translation
305 * behavior, after writing BAR2_BLOCK to bind BAR2 to a virtual address
306 * space, SW must ensure that the bind has completed prior to issuing
307 * any further BAR2 requests by polling for both
308 * BUS_BIND_STATUS_BAR2_PENDING to return to EMPTY and
309 * BUS_BIND_STATUS_BAR2_OUTSTANDING to return to FALSE
310 */
311 nvgpu_timeout_init(g, &timeout, gk20a_get_gr_idle_timeout(g),
312 NVGPU_TIMER_CPU_TIMER);
313 nvgpu_log_info(g, "check bar2 bind status");
314 do {
315 reg_val = gk20a_readl(g, bus_bind_status_r());
316
317 if (!((reg_val & bus_bind_status_bar2_pending_busy_f()) ||
318 (reg_val & bus_bind_status_bar2_outstanding_true_f())))
319 return 0;
320
321 nvgpu_usleep_range(delay, delay * 2);
322 delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX);
323 } while (!nvgpu_timeout_expired_msg(&timeout, "bar2 bind timedout"));
324
325 nvgpu_err(g, "bar2 bind failed. gpu unable to access memory");
326 return -EBUSY;
327}
diff --git a/drivers/gpu/nvgpu/gv11b/mm_gv11b.h b/drivers/gpu/nvgpu/gv11b/mm_gv11b.h
index 2b3ebf4e..f5f89d94 100644
--- a/drivers/gpu/nvgpu/gv11b/mm_gv11b.h
+++ b/drivers/gpu/nvgpu/gv11b/mm_gv11b.h
@@ -34,7 +34,6 @@ void gv11b_init_inst_block(struct nvgpu_mem *inst_block,
34bool gv11b_mm_mmu_fault_pending(struct gk20a *g); 34bool gv11b_mm_mmu_fault_pending(struct gk20a *g);
35void gv11b_mm_remove_bar2_vm(struct gk20a *g); 35void gv11b_mm_remove_bar2_vm(struct gk20a *g);
36int gv11b_init_mm_setup_hw(struct gk20a *g); 36int gv11b_init_mm_setup_hw(struct gk20a *g);
37int gv11b_init_bar2_mm_hw_setup(struct gk20a *g);
38void gv11b_mm_l2_flush(struct gk20a *g, bool invalidate); 37void gv11b_mm_l2_flush(struct gk20a *g, bool invalidate);
39u64 gv11b_gpu_phys_addr(struct gk20a *g, 38u64 gv11b_gpu_phys_addr(struct gk20a *g,
40 struct nvgpu_gmmu_attrs *attrs, u64 phys); 39 struct nvgpu_gmmu_attrs *attrs, u64 phys);