summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2014-10-16 08:15:11 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:46 -0400
commit2eb6dcb4694c8b83e22c50d9fd4d3fdd85b93c46 (patch)
tree0a2d10c9873b81fd6a6821959874d4345cc6bfad /drivers/gpu/nvgpu/gm20b
parentecc6f27fd13e7560d124faf67d114b93d47b73de (diff)
gpu: nvgpu: Implement 64k large page support
Implement support for 64kB large page size. Add an API to create an address space via IOCTL so that we can accept flags, and assign one flag for enabling 64kB large page size. Also adds APIs to set per-context large page size. This is possible only on Maxwell, so return error if caller tries to set large page size on Kepler. Default large page size is still 128kB. Change-Id: I20b51c8f6d4a984acae8411ace3de9000c78e82f Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r--drivers/gpu/nvgpu/gm20b/fb_gm20b.c9
-rw-r--r--drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h16
-rw-r--r--drivers/gpu/nvgpu/gm20b/hw_ram_gm20b.h20
-rw-r--r--drivers/gpu/nvgpu/gm20b/mm_gm20b.c21
4 files changed, 66 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
index 34ad6418..a2aa81d8 100644
--- a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
@@ -82,9 +82,18 @@ void gm20b_init_kind_attr(void)
82 } 82 }
83} 83}
84 84
85static void gm20b_fb_set_mmu_page_size(struct gk20a *g)
86{
87 /* set large page size in fb */
88 u32 fb_mmu_ctrl = gk20a_readl(g, fb_mmu_ctrl_r());
89 fb_mmu_ctrl |= fb_mmu_ctrl_use_pdb_big_page_size_true_f();
90 gk20a_writel(g, fb_mmu_ctrl_r(), fb_mmu_ctrl);
91}
92
85void gm20b_init_fb(struct gpu_ops *gops) 93void gm20b_init_fb(struct gpu_ops *gops)
86{ 94{
87 gops->fb.init_fs_state = fb_gm20b_init_fs_state; 95 gops->fb.init_fs_state = fb_gm20b_init_fs_state;
96 gops->fb.set_mmu_page_size = gm20b_fb_set_mmu_page_size;
88 gm20b_init_uncompressed_kind_map(); 97 gm20b_init_uncompressed_kind_map();
89 gm20b_init_kind_attr(); 98 gm20b_init_kind_attr();
90} 99}
diff --git a/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h
index 817e4fc4..7655d2a3 100644
--- a/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h
@@ -66,6 +66,10 @@ static inline u32 fb_mmu_ctrl_vm_pg_size_128kb_f(void)
66{ 66{
67 return 0x0; 67 return 0x0;
68} 68}
69static inline u32 fb_mmu_ctrl_vm_pg_size_64kb_f(void)
70{
71 return 0x1;
72}
69static inline u32 fb_mmu_ctrl_pri_fifo_empty_v(u32 r) 73static inline u32 fb_mmu_ctrl_pri_fifo_empty_v(u32 r)
70{ 74{
71 return (r >> 15) & 0x1; 75 return (r >> 15) & 0x1;
@@ -78,6 +82,18 @@ static inline u32 fb_mmu_ctrl_pri_fifo_space_v(u32 r)
78{ 82{
79 return (r >> 16) & 0xff; 83 return (r >> 16) & 0xff;
80} 84}
85static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_v(u32 r)
86{
87 return (r >> 11) & 0x1;
88}
89static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_true_f(void)
90{
91 return 0x800;
92}
93static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_false_f(void)
94{
95 return 0x0;
96}
81static inline u32 fb_priv_mmu_phy_secure_r(void) 97static inline u32 fb_priv_mmu_phy_secure_r(void)
82{ 98{
83 return 0x00100ce4; 99 return 0x00100ce4;
diff --git a/drivers/gpu/nvgpu/gm20b/hw_ram_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_ram_gm20b.h
index 6debecda..2e1df1d4 100644
--- a/drivers/gpu/nvgpu/gm20b/hw_ram_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/hw_ram_gm20b.h
@@ -78,6 +78,26 @@ static inline u32 ram_in_page_dir_base_vol_true_f(void)
78{ 78{
79 return 0x4; 79 return 0x4;
80} 80}
81static inline u32 ram_in_big_page_size_f(u32 v)
82{
83 return (v & 0x1) << 11;
84}
85static inline u32 ram_in_big_page_size_m(void)
86{
87 return 0x1 << 11;
88}
89static inline u32 ram_in_big_page_size_w(void)
90{
91 return 128;
92}
93static inline u32 ram_in_big_page_size_128kb_f(void)
94{
95 return 0x0;
96}
97static inline u32 ram_in_big_page_size_64kb_f(void)
98{
99 return 0x800;
100}
81static inline u32 ram_in_page_dir_base_lo_f(u32 v) 101static inline u32 ram_in_page_dir_base_lo_f(u32 v)
82{ 102{
83 return (v & 0xfffff) << 12; 103 return (v & 0xfffff) << 12;
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
index b4622c0b..13e7859f 100644
--- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
@@ -19,6 +19,7 @@
19#include "hw_gmmu_gm20b.h" 19#include "hw_gmmu_gm20b.h"
20#include "hw_fb_gm20b.h" 20#include "hw_fb_gm20b.h"
21#include "hw_gr_gm20b.h" 21#include "hw_gr_gm20b.h"
22#include "hw_ram_gm20b.h"
22 23
23static int allocate_gmmu_ptes_sparse(struct vm_gk20a *vm, 24static int allocate_gmmu_ptes_sparse(struct vm_gk20a *vm,
24 enum gmmu_pgsz_gk20a pgsz_idx, 25 enum gmmu_pgsz_gk20a pgsz_idx,
@@ -259,6 +260,25 @@ bool gm20b_mm_mmu_debug_mode_enabled(struct gk20a *g)
259 gr_gpcs_pri_mmu_debug_ctrl_debug_enabled_v(); 260 gr_gpcs_pri_mmu_debug_ctrl_debug_enabled_v();
260} 261}
261 262
263void gm20b_mm_set_big_page_size(struct gk20a *g, void *inst_ptr, int size)
264{
265 u32 val;
266
267 gk20a_dbg_fn("");
268
269 gk20a_dbg_info("big page size %d\n", size);
270 val = gk20a_mem_rd32(inst_ptr, ram_in_big_page_size_w());
271 val &= ~ram_in_big_page_size_m();
272
273 if (size == SZ_64K)
274 val |= ram_in_big_page_size_64kb_f();
275 else
276 val |= ram_in_big_page_size_128kb_f();
277
278 gk20a_mem_wr32(inst_ptr, ram_in_big_page_size_w(), val);
279 gk20a_dbg_fn("done");
280}
281
262void gm20b_init_mm(struct gpu_ops *gops) 282void gm20b_init_mm(struct gpu_ops *gops)
263{ 283{
264 gops->mm.set_sparse = gm20b_vm_put_sparse; 284 gops->mm.set_sparse = gm20b_vm_put_sparse;
@@ -273,4 +293,5 @@ void gm20b_init_mm(struct gpu_ops *gops)
273 gops->mm.l2_invalidate = gk20a_mm_l2_invalidate; 293 gops->mm.l2_invalidate = gk20a_mm_l2_invalidate;
274 gops->mm.l2_flush = gk20a_mm_l2_flush; 294 gops->mm.l2_flush = gk20a_mm_l2_flush;
275 gops->mm.tlb_invalidate = gk20a_mm_tlb_invalidate; 295 gops->mm.tlb_invalidate = gk20a_mm_tlb_invalidate;
296 gops->mm.set_big_page_size = gm20b_mm_set_big_page_size;
276} 297}