summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorSeshendra Gadagottu <sgadagottu@nvidia.com>2014-12-03 20:57:35 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 21:04:38 -0400
commitf4883ab97af69610c0507c245f69eef00d203a28 (patch)
treec8555fbd7f474db20c44719eeab679ee7f5b1751 /drivers/gpu/nvgpu
parent2dda8077ec7d88ac689b57448031a3bac269fdfa (diff)
gpu:nvgpu: add bar2 aperture support
Bug 1587825 Change-Id: I884c6b268aabb04b4990713395ebedf92410e02a Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: http://git-master/r/659239 Tested-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c17
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.h15
3 files changed, 32 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 3c1186ed..b9796faa 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -325,6 +325,8 @@ struct gpu_ops {
325 void *inst_ptr, int size); 325 void *inst_ptr, int size);
326 u32 (*get_big_page_sizes)(void); 326 u32 (*get_big_page_sizes)(void);
327 u32 (*get_physical_addr_bits)(struct gk20a *g); 327 u32 (*get_physical_addr_bits)(struct gk20a *g);
328 int (*init_bar2_vm)(struct gk20a *g);
329 int (*init_bar2_mm_hw_setup)(struct gk20a *g);
328 } mm; 330 } mm;
329 struct { 331 struct {
330 int (*prepare_ucode)(struct gk20a *g); 332 int (*prepare_ucode)(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 8cd8e18c..3bce3c74 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -311,6 +311,11 @@ int gk20a_init_mm_setup_sw(struct gk20a *g)
311 if (err) 311 if (err)
312 return err; 312 return err;
313 313
314 if (g->ops.mm.init_bar2_vm) {
315 err = g->ops.mm.init_bar2_vm(g);
316 if (err)
317 return err;
318 }
314 err = gk20a_init_system_vm(mm); 319 err = gk20a_init_system_vm(mm);
315 if (err) 320 if (err)
316 return err; 321 return err;
@@ -330,6 +335,7 @@ static int gk20a_init_mm_setup_hw(struct gk20a *g)
330 struct mm_gk20a *mm = &g->mm; 335 struct mm_gk20a *mm = &g->mm;
331 struct inst_desc *inst_block = &mm->bar1.inst_block; 336 struct inst_desc *inst_block = &mm->bar1.inst_block;
332 phys_addr_t inst_pa = inst_block->cpu_pa; 337 phys_addr_t inst_pa = inst_block->cpu_pa;
338 int err;
333 339
334 gk20a_dbg_fn(""); 340 gk20a_dbg_fn("");
335 341
@@ -342,6 +348,13 @@ static int gk20a_init_mm_setup_hw(struct gk20a *g)
342 bus_bar1_block_target_vid_mem_f() | 348 bus_bar1_block_target_vid_mem_f() |
343 bus_bar1_block_mode_virtual_f() | 349 bus_bar1_block_mode_virtual_f() |
344 bus_bar1_block_ptr_f(inst_pa)); 350 bus_bar1_block_ptr_f(inst_pa));
351
352 if (g->ops.mm.init_bar2_mm_hw_setup) {
353 err = g->ops.mm.init_bar2_mm_hw_setup(g);
354 if (err)
355 return err;
356 }
357
345 if (gk20a_mm_fb_flush(g) || gk20a_mm_fb_flush(g)) 358 if (gk20a_mm_fb_flush(g) || gk20a_mm_fb_flush(g))
346 return -EBUSY; 359 return -EBUSY;
347 360
@@ -2124,7 +2137,7 @@ void gk20a_vm_put(struct vm_gk20a *vm)
2124 kref_put(&vm->ref, gk20a_vm_remove_support_kref); 2137 kref_put(&vm->ref, gk20a_vm_remove_support_kref);
2125} 2138}
2126 2139
2127static int gk20a_init_vm(struct mm_gk20a *mm, 2140int gk20a_init_vm(struct mm_gk20a *mm,
2128 struct vm_gk20a *vm, 2141 struct vm_gk20a *vm,
2129 u32 big_page_size, 2142 u32 big_page_size,
2130 u64 low_hole, 2143 u64 low_hole,
@@ -2659,7 +2672,7 @@ int gk20a_vm_unmap_buffer(struct gk20a_as_share *as_share, u64 offset)
2659 return 0; 2672 return 0;
2660} 2673}
2661 2674
2662static void gk20a_deinit_vm(struct vm_gk20a *vm) 2675void gk20a_deinit_vm(struct vm_gk20a *vm)
2663{ 2676{
2664 u32 pde_pages; 2677 u32 pde_pages;
2665 2678
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
index 79bc50af..8470a7ac 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
@@ -347,6 +347,12 @@ struct mm_gk20a {
347 u32 aperture_size; 347 u32 aperture_size;
348 struct vm_gk20a vm; 348 struct vm_gk20a vm;
349 struct inst_desc inst_block; 349 struct inst_desc inst_block;
350 } bar2;
351
352 struct {
353 u32 aperture_size;
354 struct vm_gk20a vm;
355 struct inst_desc inst_block;
350 } pmu; 356 } pmu;
351 357
352 struct mutex l2_op_lock; 358 struct mutex l2_op_lock;
@@ -534,6 +540,15 @@ int gk20a_vm_map_buffer(struct gk20a_as_share *as_share,
534 int kind, 540 int kind,
535 u64 buffer_offset, 541 u64 buffer_offset,
536 u64 mapping_size); 542 u64 mapping_size);
543
544int gk20a_init_vm(struct mm_gk20a *mm,
545 struct vm_gk20a *vm,
546 u32 big_page_size,
547 u64 low_hole,
548 u64 aperture_size,
549 bool big_pages,
550 char *name);
551void gk20a_deinit_vm(struct vm_gk20a *vm);
537int gk20a_vm_unmap_buffer(struct gk20a_as_share *, u64 offset); 552int gk20a_vm_unmap_buffer(struct gk20a_as_share *, u64 offset);
538void gk20a_get_comptags(struct device *dev, struct dma_buf *dmabuf, 553void gk20a_get_comptags(struct device *dev, struct dma_buf *dmabuf,
539 struct gk20a_comptags *comptags); 554 struct gk20a_comptags *comptags);