summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2015-12-17 13:12:21 -0500
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-01-05 10:50:02 -0500
commit9812bd5eea1c5d2c97149d64c5ccf81eae75fda1 (patch)
tree5b9c006b9c94d8c6920fc779f71a9bf36db43766 /drivers/gpu
parentc9d6a79a4ce28744bc1c68f8c16c28d453b91a51 (diff)
gpu: nvgpu: Control comptagline assignment from kernel
On Maxwell comptaglines are assigned per 128k, but preferred big page size for graphics is 64k. Bit 16 of GPU VA is used for determining which half of comptagline is used. This creates problems if user space wants to map a page multiple times and to arbitrary GPU VA. In one mapping the page might be mapped to lower half of 128k comptagline, and in another mapping the page might be mapped to upper half. Turn on mode where MSB of comptagline in PTE is used instead of bit 16 for determining the comptagline lower/upper half selection. Bug 1704834 Change-Id: If87e8f6ac0fc9c5624e80fa1ba2ceeb02781355b Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/924322 Reviewed-by: Alex Waterman <alexw@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gk20a/hw_gmmu_gk20a.h6
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c9
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gm20b/fb_gm20b.c11
-rw-r--r--drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h8
-rw-r--r--drivers/gpu/nvgpu/gm20b/hw_gmmu_gm20b.h6
7 files changed, 40 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index d3dc03e7..6f2258e9 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -197,6 +197,7 @@ struct gpu_ops {
197 void (*init_uncompressed_kind_map)(struct gk20a *g); 197 void (*init_uncompressed_kind_map)(struct gk20a *g);
198 void (*init_kind_attr)(struct gk20a *g); 198 void (*init_kind_attr)(struct gk20a *g);
199 void (*set_mmu_page_size)(struct gk20a *g); 199 void (*set_mmu_page_size)(struct gk20a *g);
200 bool (*set_use_full_comp_tag_line)(struct gk20a *g);
200 int (*compression_page_size)(struct gk20a *g); 201 int (*compression_page_size)(struct gk20a *g);
201 int (*compressible_page_size)(struct gk20a *g); 202 int (*compressible_page_size)(struct gk20a *g);
202 void (*dump_vpr_wpr_info)(struct gk20a *g); 203 void (*dump_vpr_wpr_info)(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/hw_gmmu_gk20a.h b/drivers/gpu/nvgpu/gk20a/hw_gmmu_gk20a.h
index 19e44382..d92f0d58 100644
--- a/drivers/gpu/nvgpu/gk20a/hw_gmmu_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/hw_gmmu_gk20a.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -210,6 +210,10 @@ static inline u32 gmmu_pte_read_disable_true_f(void)
210{ 210{
211 return 0x40000000; 211 return 0x40000000;
212} 212}
213static inline u32 gmmu_pte_comptagline_s(void)
214{
215 return 17;
216}
213static inline u32 gmmu_pte_comptagline_f(u32 v) 217static inline u32 gmmu_pte_comptagline_f(u32 v)
214{ 218{
215 return (v & 0x1ffff) << 12; 219 return (v & 0x1ffff) << 12;
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 6c4637e8..76c33512 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -414,6 +414,10 @@ int gk20a_init_mm_setup_hw(struct gk20a *g)
414 gk20a_dbg_fn(""); 414 gk20a_dbg_fn("");
415 415
416 g->ops.fb.set_mmu_page_size(g); 416 g->ops.fb.set_mmu_page_size(g);
417 if (g->ops.fb.set_use_full_comp_tag_line)
418 mm->use_full_comp_tag_line =
419 g->ops.fb.set_use_full_comp_tag_line(g);
420
417 421
418 inst_pa = (u32)(inst_pa >> bar1_instance_block_shift_gk20a()); 422 inst_pa = (u32)(inst_pa >> bar1_instance_block_shift_gk20a());
419 gk20a_dbg_info("bar1 inst block ptr: 0x%08x", (u32)inst_pa); 423 gk20a_dbg_info("bar1 inst block ptr: 0x%08x", (u32)inst_pa);
@@ -2327,6 +2331,11 @@ static int update_gmmu_pte_locked(struct vm_gk20a *vm,
2327 gmmu_pte_kind_f(kind_v) | 2331 gmmu_pte_kind_f(kind_v) |
2328 gmmu_pte_comptagline_f((u32)(*ctag / ctag_granularity)); 2332 gmmu_pte_comptagline_f((u32)(*ctag / ctag_granularity));
2329 2333
2334 if (vm->mm->use_full_comp_tag_line && *iova & 0x10000) {
2335 pte_w[1] |= gmmu_pte_comptagline_f(
2336 1 << (gmmu_pte_comptagline_s() - 1));
2337 }
2338
2330 if (rw_flag == gk20a_mem_flag_read_only) { 2339 if (rw_flag == gk20a_mem_flag_read_only) {
2331 pte_w[0] |= gmmu_pte_read_only_true_f(); 2340 pte_w[0] |= gmmu_pte_read_only_true_f();
2332 pte_w[1] |= 2341 pte_w[1] |=
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
index ac55e988..5ce931c3 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
@@ -329,6 +329,7 @@ struct mm_gk20a {
329 void (*remove_support)(struct mm_gk20a *mm); 329 void (*remove_support)(struct mm_gk20a *mm);
330 bool sw_ready; 330 bool sw_ready;
331 int physical_bits; 331 int physical_bits;
332 bool use_full_comp_tag_line;
332#ifdef CONFIG_DEBUG_FS 333#ifdef CONFIG_DEBUG_FS
333 u32 ltc_enabled; 334 u32 ltc_enabled;
334 u32 ltc_enabled_debug; 335 u32 ltc_enabled_debug;
diff --git a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
index 3d4604c5..c65cd450 100644
--- a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
@@ -91,6 +91,16 @@ static void gm20b_fb_set_mmu_page_size(struct gk20a *g)
91 gk20a_writel(g, fb_mmu_ctrl_r(), fb_mmu_ctrl); 91 gk20a_writel(g, fb_mmu_ctrl_r(), fb_mmu_ctrl);
92} 92}
93 93
94static bool gm20b_fb_set_use_full_comp_tag_line(struct gk20a *g)
95{
96 /* set large page size in fb */
97 u32 fb_mmu_ctrl = gk20a_readl(g, fb_mmu_ctrl_r());
98 fb_mmu_ctrl |= fb_mmu_ctrl_use_full_comp_tag_line_true_f();
99 gk20a_writel(g, fb_mmu_ctrl_r(), fb_mmu_ctrl);
100
101 return true;
102}
103
94static int gm20b_fb_compression_page_size(struct gk20a *g) 104static int gm20b_fb_compression_page_size(struct gk20a *g)
95{ 105{
96 return SZ_128K; 106 return SZ_128K;
@@ -135,6 +145,7 @@ void gm20b_init_fb(struct gpu_ops *gops)
135 gops->fb.reset = fb_gk20a_reset; 145 gops->fb.reset = fb_gk20a_reset;
136 gops->fb.init_fs_state = fb_gm20b_init_fs_state; 146 gops->fb.init_fs_state = fb_gm20b_init_fs_state;
137 gops->fb.set_mmu_page_size = gm20b_fb_set_mmu_page_size; 147 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;
138 gops->fb.compression_page_size = gm20b_fb_compression_page_size; 149 gops->fb.compression_page_size = gm20b_fb_compression_page_size;
139 gops->fb.compressible_page_size = gm20b_fb_compressible_page_size; 150 gops->fb.compressible_page_size = gm20b_fb_compressible_page_size;
140 gops->fb.dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info; 151 gops->fb.dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info;
diff --git a/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h
index 5ec4a46e..d68f6479 100644
--- a/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/hw_fb_gm20b.h
@@ -94,6 +94,14 @@ static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_false_f(void)
94{ 94{
95 return 0x0; 95 return 0x0;
96} 96}
97static inline u32 fb_mmu_ctrl_use_full_comp_tag_line_v(u32 r)
98{
99 return (r >> 12) & 0x1;
100}
101static inline u32 fb_mmu_ctrl_use_full_comp_tag_line_true_f(void)
102{
103 return 0x1000;
104}
97static inline u32 fb_priv_mmu_phy_secure_r(void) 105static inline u32 fb_priv_mmu_phy_secure_r(void)
98{ 106{
99 return 0x00100ce4; 107 return 0x00100ce4;
diff --git a/drivers/gpu/nvgpu/gm20b/hw_gmmu_gm20b.h b/drivers/gpu/nvgpu/gm20b/hw_gmmu_gm20b.h
index 32b65912..572f727f 100644
--- a/drivers/gpu/nvgpu/gm20b/hw_gmmu_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/hw_gmmu_gm20b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -210,6 +210,10 @@ static inline u32 gmmu_pte_read_disable_true_f(void)
210{ 210{
211 return 0x40000000; 211 return 0x40000000;
212} 212}
213static inline u32 gmmu_pte_comptagline_s(void)
214{
215 return 17;
216}
213static inline u32 gmmu_pte_comptagline_f(u32 v) 217static inline u32 gmmu_pte_comptagline_f(u32 v)
214{ 218{
215 return (v & 0x1ffff) << 12; 219 return (v & 0x1ffff) << 12;