summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-04-11 16:01:59 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-04-15 15:38:33 -0400
commit0e423669a4ff3f00b06d86f8ca251ef99f3671ce (patch)
tree637552c0c76d0a7a820d5cb8f359478d756e8c2a /drivers/gpu/nvgpu/gm20b/mm_gm20b.c
parent7d8e2193893454bc8e05543c956fab32b8eed54b (diff)
gpu: nvgpu: Wait for BAR1 bind
Wait for BAR1 bind to complete before continuing. The register to wait exists Maxwell onwards. Change-Id: Ie3736033fdb748c5da8d7a6085ad6d63acaf41f5 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1123941
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/mm_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/gm20b/mm_gm20b.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
index 7bc19972..ac73b5c8 100644
--- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
@@ -14,12 +14,14 @@
14 */ 14 */
15 15
16#include <linux/pm_runtime.h> 16#include <linux/pm_runtime.h>
17#include <linux/delay.h>
17#include "gk20a/gk20a.h" 18#include "gk20a/gk20a.h"
18#include "mm_gm20b.h" 19#include "mm_gm20b.h"
19#include "hw_gmmu_gm20b.h" 20#include "hw_gmmu_gm20b.h"
20#include "hw_fb_gm20b.h" 21#include "hw_fb_gm20b.h"
21#include "hw_gr_gm20b.h" 22#include "hw_gr_gm20b.h"
22#include "hw_ram_gm20b.h" 23#include "hw_ram_gm20b.h"
24#include "hw_bus_gm20b.h"
23 25
24static int gm20b_mm_mmu_vpr_info_fetch_wait(struct gk20a *g, 26static int gm20b_mm_mmu_vpr_info_fetch_wait(struct gk20a *g,
25 const unsigned int msec) 27 const unsigned int msec)
@@ -133,6 +135,32 @@ static bool gm20b_mm_support_sparse(struct gk20a *g)
133 return true; 135 return true;
134} 136}
135 137
138static int gm20b_mm_bar1_bind(struct gk20a *g, u64 bar1_iova)
139{
140 int retry = 1000;
141 u64 inst_pa = (u32)(bar1_iova >> bar1_instance_block_shift_gk20a());
142 gk20a_dbg_info("bar1 inst block ptr: 0x%08x", (u32)inst_pa);
143
144 gk20a_writel(g, bus_bar1_block_r(),
145 (g->mm.vidmem_is_vidmem ?
146 bus_bar1_block_target_sys_mem_ncoh_f() :
147 bus_bar1_block_target_vid_mem_f()) |
148 bus_bar1_block_mode_virtual_f() |
149 bus_bar1_block_ptr_f(inst_pa));
150 do {
151 u32 val = gk20a_readl(g, bus_bind_status_r());
152 u32 pending = bus_bind_status_bar1_pending_v(val);
153 u32 outstanding = bus_bind_status_bar1_outstanding_v(val);
154 if (!pending && !outstanding)
155 break;
156
157 udelay(5);
158 retry--;
159 } while (retry >= 0 || !tegra_platform_is_silicon());
160
161 return retry ? -EINVAL : 0;
162}
163
136void gm20b_init_mm(struct gpu_ops *gops) 164void gm20b_init_mm(struct gpu_ops *gops)
137{ 165{
138 gops->mm.support_sparse = gm20b_mm_support_sparse; 166 gops->mm.support_sparse = gm20b_mm_support_sparse;
@@ -155,4 +183,5 @@ void gm20b_init_mm(struct gpu_ops *gops)
155 gops->mm.get_mmu_levels = gk20a_mm_get_mmu_levels; 183 gops->mm.get_mmu_levels = gk20a_mm_get_mmu_levels;
156 gops->mm.init_pdb = gk20a_mm_init_pdb; 184 gops->mm.init_pdb = gk20a_mm_init_pdb;
157 gops->mm.init_mm_setup_hw = gk20a_init_mm_setup_hw; 185 gops->mm.init_mm_setup_hw = gk20a_init_mm_setup_hw;
186 gops->mm.bar1_bind = gm20b_mm_bar1_bind;
158} 187}