summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-06-22 15:55:17 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-30 21:34:59 -0400
commit001c7c3185d9b087f89f48a41bee27d2d06721f6 (patch)
treec869be82279688a5dbe5d1145da09ca2323aef92
parent82c0c96290602b1baf296133c7f55ae1848e433a (diff)
gpu: nvgpu: Per chip default big page size
Make default big page size query a HAL op instead of per-platform constant. This allows querying for default big page size without accessing Linux specific gk20a_platform structure. JIRA NVGPU-38 Change-Id: Ibfbd1319764fdae5fdb06700fb64d23f6f3dd01a Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master/r/1507928 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/gpu/nvgpu/common/as.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c8
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c8
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a.h3
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c1
-rw-r--r--drivers/gpu/nvgpu/gm20b/mm_gm20b.c6
-rw-r--r--drivers/gpu/nvgpu/gp10b/mm_gp10b.c8
12 files changed, 21 insertions, 25 deletions
diff --git a/drivers/gpu/nvgpu/common/as.c b/drivers/gpu/nvgpu/common/as.c
index 99d18195..0ff5bc6c 100644
--- a/drivers/gpu/nvgpu/common/as.c
+++ b/drivers/gpu/nvgpu/common/as.c
@@ -49,8 +49,7 @@ static int gk20a_vm_alloc_share(struct gk20a_as_share *as_share,
49 gk20a_dbg_fn(""); 49 gk20a_dbg_fn("");
50 50
51 if (big_page_size == 0) { 51 if (big_page_size == 0) {
52 big_page_size = 52 big_page_size = g->ops.mm.get_default_big_page_size();
53 gk20a_get_platform(g->dev)->default_big_page_size;
54 } else { 53 } else {
55 if (!is_power_of_2(big_page_size)) 54 if (!is_power_of_2(big_page_size))
56 return -EINVAL; 55 return -EINVAL;
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index 87751351..5fcf717c 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -86,8 +86,6 @@ static struct gk20a_platform nvgpu_pci_device[] = {
86 .is_railgated = nvgpu_pci_tegra_is_railgated, 86 .is_railgated = nvgpu_pci_tegra_is_railgated,
87 .clk_round_rate = nvgpu_pci_clk_round_rate, 87 .clk_round_rate = nvgpu_pci_clk_round_rate,
88 88
89 .default_big_page_size = SZ_64K,
90
91 .ch_wdt_timeout_ms = 7000, 89 .ch_wdt_timeout_ms = 7000,
92 90
93 .honors_aperture = true, 91 .honors_aperture = true,
@@ -121,8 +119,6 @@ static struct gk20a_platform nvgpu_pci_device[] = {
121 .is_railgated = nvgpu_pci_tegra_is_railgated, 119 .is_railgated = nvgpu_pci_tegra_is_railgated,
122 .clk_round_rate = nvgpu_pci_clk_round_rate, 120 .clk_round_rate = nvgpu_pci_clk_round_rate,
123 121
124 .default_big_page_size = SZ_64K,
125
126 .ch_wdt_timeout_ms = 7000, 122 .ch_wdt_timeout_ms = 7000,
127 123
128 .honors_aperture = true, 124 .honors_aperture = true,
@@ -156,8 +152,6 @@ static struct gk20a_platform nvgpu_pci_device[] = {
156 .is_railgated = nvgpu_pci_tegra_is_railgated, 152 .is_railgated = nvgpu_pci_tegra_is_railgated,
157 .clk_round_rate = nvgpu_pci_clk_round_rate, 153 .clk_round_rate = nvgpu_pci_clk_round_rate,
158 154
159 .default_big_page_size = SZ_64K,
160
161 .ch_wdt_timeout_ms = 7000, 155 .ch_wdt_timeout_ms = 7000,
162 156
163 .honors_aperture = true, 157 .honors_aperture = true,
@@ -191,8 +185,6 @@ static struct gk20a_platform nvgpu_pci_device[] = {
191 .is_railgated = nvgpu_pci_tegra_is_railgated, 185 .is_railgated = nvgpu_pci_tegra_is_railgated,
192 .clk_round_rate = nvgpu_pci_clk_round_rate, 186 .clk_round_rate = nvgpu_pci_clk_round_rate,
193 187
194 .default_big_page_size = SZ_64K,
195
196 .ch_wdt_timeout_ms = 7000, 188 .ch_wdt_timeout_ms = 7000,
197 189
198 .honors_aperture = true, 190 .honors_aperture = true,
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
index fda3bc95..9652c1da 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
@@ -924,8 +924,6 @@ struct gk20a_platform gm20b_tegra_platform = {
924 924
925 .force_reset_in_do_idle = false, 925 .force_reset_in_do_idle = false,
926 926
927 .default_big_page_size = SZ_128K,
928
929 .ch_wdt_timeout_ms = 5000, 927 .ch_wdt_timeout_ms = 5000,
930 928
931 .probe = gk20a_tegra_probe, 929 .probe = gk20a_tegra_probe,
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
index ab2aa1c5..61b8053f 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
@@ -398,8 +398,6 @@ struct gk20a_platform gp10b_tegra_platform = {
398 398
399 .dump_platform_dependencies = gk20a_tegra_debug_dump, 399 .dump_platform_dependencies = gk20a_tegra_debug_dump,
400 400
401 .default_big_page_size = SZ_64K,
402
403 .has_cde = true, 401 .has_cde = true,
404 402
405 .clk_round_rate = gp10b_round_clk_rate, 403 .clk_round_rate = gp10b_round_clk_rate,
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index c7552f04..546d2eb1 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -1886,7 +1886,7 @@ static int gk20a_perfbuf_map(struct dbg_session_gk20a *dbg_s,
1886 struct mm_gk20a *mm = &g->mm; 1886 struct mm_gk20a *mm = &g->mm;
1887 int err; 1887 int err;
1888 u32 virt_size; 1888 u32 virt_size;
1889 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; 1889 u32 big_page_size = g->ops.mm.get_default_big_page_size();
1890 1890
1891 nvgpu_mutex_acquire(&g->dbg_sessions_lock); 1891 nvgpu_mutex_acquire(&g->dbg_sessions_lock);
1892 1892
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 7506c1dd..a87d34f9 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -420,7 +420,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
420 gpu->bus_type = NVGPU_GPU_BUS_TYPE_AXI; /* always AXI for now */ 420 gpu->bus_type = NVGPU_GPU_BUS_TYPE_AXI; /* always AXI for now */
421 421
422 gpu->compression_page_size = g->ops.fb.compression_page_size(g); 422 gpu->compression_page_size = g->ops.fb.compression_page_size(g);
423 gpu->big_page_size = platform->default_big_page_size; 423 gpu->big_page_size = g->ops.mm.get_default_big_page_size();
424 gpu->pde_coverage_bit_count = 424 gpu->pde_coverage_bit_count =
425 g->ops.mm.get_mmu_levels(g, gpu->big_page_size)[0].lo_bit[0]; 425 g->ops.mm.get_mmu_levels(g, gpu->big_page_size)[0].lo_bit[0];
426 426
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 9b28e0c6..1e6995c4 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -674,6 +674,7 @@ struct gpu_ops {
674 void (*set_big_page_size)(struct gk20a *g, 674 void (*set_big_page_size)(struct gk20a *g,
675 struct nvgpu_mem *mem, int size); 675 struct nvgpu_mem *mem, int size);
676 u32 (*get_big_page_sizes)(void); 676 u32 (*get_big_page_sizes)(void);
677 u32 (*get_default_big_page_size)(void);
677 u32 (*get_physical_addr_bits)(struct gk20a *g); 678 u32 (*get_physical_addr_bits)(struct gk20a *g);
678 int (*init_mm_setup_hw)(struct gk20a *g); 679 int (*init_mm_setup_hw)(struct gk20a *g);
679 bool (*is_bar1_supported)(struct gk20a *g); 680 bool (*is_bar1_supported)(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index fa6b5109..52053c14 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -2124,7 +2124,7 @@ static int gk20a_init_bar1_vm(struct mm_gk20a *mm)
2124 int err; 2124 int err;
2125 struct gk20a *g = gk20a_from_mm(mm); 2125 struct gk20a *g = gk20a_from_mm(mm);
2126 struct nvgpu_mem *inst_block = &mm->bar1.inst_block; 2126 struct nvgpu_mem *inst_block = &mm->bar1.inst_block;
2127 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; 2127 u32 big_page_size = g->ops.mm.get_default_big_page_size();
2128 2128
2129 mm->bar1.aperture_size = bar1_aperture_size_mb_gk20a() << 20; 2129 mm->bar1.aperture_size = bar1_aperture_size_mb_gk20a() << 20;
2130 gk20a_dbg_info("bar1 vm size = 0x%x", mm->bar1.aperture_size); 2130 gk20a_dbg_info("bar1 vm size = 0x%x", mm->bar1.aperture_size);
@@ -2156,7 +2156,7 @@ static int gk20a_init_system_vm(struct mm_gk20a *mm)
2156 int err; 2156 int err;
2157 struct gk20a *g = gk20a_from_mm(mm); 2157 struct gk20a *g = gk20a_from_mm(mm);
2158 struct nvgpu_mem *inst_block = &mm->pmu.inst_block; 2158 struct nvgpu_mem *inst_block = &mm->pmu.inst_block;
2159 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; 2159 u32 big_page_size = g->ops.mm.get_default_big_page_size();
2160 u32 low_hole, aperture_size; 2160 u32 low_hole, aperture_size;
2161 2161
2162 /* 2162 /*
@@ -2207,7 +2207,7 @@ static int gk20a_init_hwpm(struct mm_gk20a *mm)
2207static int gk20a_init_cde_vm(struct mm_gk20a *mm) 2207static int gk20a_init_cde_vm(struct mm_gk20a *mm)
2208{ 2208{
2209 struct gk20a *g = gk20a_from_mm(mm); 2209 struct gk20a *g = gk20a_from_mm(mm);
2210 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; 2210 u32 big_page_size = g->ops.mm.get_default_big_page_size();
2211 2211
2212 mm->cde.vm = nvgpu_vm_init(g, big_page_size, 2212 mm->cde.vm = nvgpu_vm_init(g, big_page_size,
2213 big_page_size << 10, 2213 big_page_size << 10,
@@ -2222,7 +2222,7 @@ static int gk20a_init_cde_vm(struct mm_gk20a *mm)
2222static int gk20a_init_ce_vm(struct mm_gk20a *mm) 2222static int gk20a_init_ce_vm(struct mm_gk20a *mm)
2223{ 2223{
2224 struct gk20a *g = gk20a_from_mm(mm); 2224 struct gk20a *g = gk20a_from_mm(mm);
2225 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; 2225 u32 big_page_size = g->ops.mm.get_default_big_page_size();
2226 2226
2227 mm->ce.vm = nvgpu_vm_init(g, big_page_size, 2227 mm->ce.vm = nvgpu_vm_init(g, big_page_size,
2228 big_page_size << 10, 2228 big_page_size << 10,
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
index 3eda1da4..04ac2505 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
@@ -111,9 +111,6 @@ struct gk20a_platform {
111 */ 111 */
112 bool force_reset_in_do_idle; 112 bool force_reset_in_do_idle;
113 113
114 /* Default big page size 64K or 128K */
115 u32 default_big_page_size;
116
117 /* default pri timeout, on PCIe it should be lower than timeout 114 /* default pri timeout, on PCIe it should be lower than timeout
118 * detection 115 * detection
119 */ 116 */
diff --git a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c
index 48b5a90a..bbf1092c 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c
+++ b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c
@@ -52,7 +52,6 @@ struct gk20a_platform vgpu_tegra_platform = {
52 .ch_wdt_timeout_ms = 5000, 52 .ch_wdt_timeout_ms = 5000,
53 53
54 .probe = gk20a_tegra_probe, 54 .probe = gk20a_tegra_probe,
55 .default_big_page_size = SZ_128K,
56 55
57 .clk_round_rate = vgpu_clk_round_rate, 56 .clk_round_rate = vgpu_clk_round_rate,
58 .get_clk_freqs = vgpu_clk_get_freqs, 57 .get_clk_freqs = vgpu_clk_get_freqs,
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
index 0595fe2e..bdb3b827 100644
--- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c
@@ -45,6 +45,11 @@ static u32 gm20b_mm_get_big_page_sizes(void)
45 return SZ_64K | SZ_128K; 45 return SZ_64K | SZ_128K;
46} 46}
47 47
48static u32 gm20b_mm_get_default_big_page_size(void)
49{
50 return SZ_128K;
51}
52
48static bool gm20b_mm_support_sparse(struct gk20a *g) 53static bool gm20b_mm_support_sparse(struct gk20a *g)
49{ 54{
50 return true; 55 return true;
@@ -67,6 +72,7 @@ void gm20b_init_mm(struct gpu_ops *gops)
67 gops->mm.cbc_clean = gk20a_mm_cbc_clean; 72 gops->mm.cbc_clean = gk20a_mm_cbc_clean;
68 gops->mm.set_big_page_size = gm20b_mm_set_big_page_size; 73 gops->mm.set_big_page_size = gm20b_mm_set_big_page_size;
69 gops->mm.get_big_page_sizes = gm20b_mm_get_big_page_sizes; 74 gops->mm.get_big_page_sizes = gm20b_mm_get_big_page_sizes;
75 gops->mm.get_default_big_page_size = gm20b_mm_get_default_big_page_size;
70 gops->mm.get_iova_addr = gk20a_mm_iova_addr; 76 gops->mm.get_iova_addr = gk20a_mm_iova_addr;
71 gops->mm.get_physical_addr_bits = gk20a_mm_get_physical_addr_bits; 77 gops->mm.get_physical_addr_bits = gk20a_mm_get_physical_addr_bits;
72 gops->mm.get_mmu_levels = gk20a_mm_get_mmu_levels; 78 gops->mm.get_mmu_levels = gk20a_mm_get_mmu_levels;
diff --git a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
index 3cd3eb50..d7391c6d 100644
--- a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
@@ -26,6 +26,11 @@
26#include <nvgpu/hw/gp10b/hw_bus_gp10b.h> 26#include <nvgpu/hw/gp10b/hw_bus_gp10b.h>
27#include <nvgpu/hw/gp10b/hw_gmmu_gp10b.h> 27#include <nvgpu/hw/gp10b/hw_gmmu_gp10b.h>
28 28
29static u32 gp10b_mm_get_default_big_page_size(void)
30{
31 return SZ_64K;
32}
33
29static u32 gp10b_mm_get_physical_addr_bits(struct gk20a *g) 34static u32 gp10b_mm_get_physical_addr_bits(struct gk20a *g)
30{ 35{
31 return 36; 36 return 36;
@@ -68,7 +73,7 @@ static int gb10b_init_bar2_vm(struct gk20a *g)
68 int err; 73 int err;
69 struct mm_gk20a *mm = &g->mm; 74 struct mm_gk20a *mm = &g->mm;
70 struct nvgpu_mem *inst_block = &mm->bar2.inst_block; 75 struct nvgpu_mem *inst_block = &mm->bar2.inst_block;
71 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; 76 u32 big_page_size = g->ops.mm.get_default_big_page_size();
72 77
73 /* BAR2 aperture size is 32MB */ 78 /* BAR2 aperture size is 32MB */
74 mm->bar2.aperture_size = 32 << 20; 79 mm->bar2.aperture_size = 32 << 20;
@@ -410,6 +415,7 @@ static void gp10b_remove_bar2_vm(struct gk20a *g)
410void gp10b_init_mm(struct gpu_ops *gops) 415void gp10b_init_mm(struct gpu_ops *gops)
411{ 416{
412 gm20b_init_mm(gops); 417 gm20b_init_mm(gops);
418 gops->mm.get_default_big_page_size = gp10b_mm_get_default_big_page_size;
413 gops->mm.get_physical_addr_bits = gp10b_mm_get_physical_addr_bits; 419 gops->mm.get_physical_addr_bits = gp10b_mm_get_physical_addr_bits;
414 gops->mm.init_mm_setup_hw = gp10b_init_mm_setup_hw; 420 gops->mm.init_mm_setup_hw = gp10b_init_mm_setup_hw;
415 gops->mm.init_bar2_vm = gb10b_init_bar2_vm; 421 gops->mm.init_bar2_vm = gb10b_init_bar2_vm;