summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-07-31 17:40:46 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-14 18:55:19 -0400
commit4bb0896912440d126ae47da350b448f37dabc63d (patch)
tree517e88d61e849a75755d0e5c0de675a5f432f852 /drivers
parentde232ceb4b3bfa88650d1eed764357ba4a598076 (diff)
gpu: nvgpu: Reorg fb HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the fb sub-module of the gpu_ops struct. Perform HAL function assignments in hal_gxxxx.c through the population of a chip-specific copy of gpu_ops. Jira NVGPU-74 Change-Id: I3fdbf6059ef664caf8d33797a8a5f3f8eb6485bf Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1537748 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gv100/fb_gv100.c9
-rw-r--r--drivers/gpu/nvgpu/gv100/fb_gv100.h4
-rw-r--r--drivers/gpu/nvgpu/gv100/hal_gv100.c28
-rw-r--r--drivers/gpu/nvgpu/gv11b/fb_gv11b.c25
-rw-r--r--drivers/gpu/nvgpu/gv11b/fb_gv11b.h11
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c25
6 files changed, 68 insertions, 34 deletions
diff --git a/drivers/gpu/nvgpu/gv100/fb_gv100.c b/drivers/gpu/nvgpu/gv100/fb_gv100.c
index a3785266..319ebad6 100644
--- a/drivers/gpu/nvgpu/gv100/fb_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/fb_gv100.c
@@ -21,7 +21,6 @@
21#include <nvgpu/gmmu.h> 21#include <nvgpu/gmmu.h>
22 22
23#include "gk20a/gk20a.h" 23#include "gk20a/gk20a.h"
24#include "gv11b/fb_gv11b.h"
25#include "gv100/fb_gv100.h" 24#include "gv100/fb_gv100.h"
26 25
27#include <nvgpu/hw/gv100/hw_fb_gv100.h> 26#include <nvgpu/hw/gv100/hw_fb_gv100.h>
@@ -29,7 +28,7 @@
29#define HW_SCRUB_TIMEOUT_DEFAULT 100 /* usec */ 28#define HW_SCRUB_TIMEOUT_DEFAULT 100 /* usec */
30#define HW_SCRUB_TIMEOUT_MAX 2000000 /* usec */ 29#define HW_SCRUB_TIMEOUT_MAX 2000000 /* usec */
31 30
32static void gv100_fb_reset(struct gk20a *g) 31void gv100_fb_reset(struct gk20a *g)
33{ 32{
34 u32 val; 33 u32 val;
35 int retries = HW_SCRUB_TIMEOUT_MAX / HW_SCRUB_TIMEOUT_DEFAULT; 34 int retries = HW_SCRUB_TIMEOUT_MAX / HW_SCRUB_TIMEOUT_DEFAULT;
@@ -50,9 +49,3 @@ static void gv100_fb_reset(struct gk20a *g)
50 val &= ~fb_mmu_priv_level_mask_write_violation_m(); 49 val &= ~fb_mmu_priv_level_mask_write_violation_m();
51 gk20a_writel(g, fb_mmu_priv_level_mask_r(), val); 50 gk20a_writel(g, fb_mmu_priv_level_mask_r(), val);
52} 51}
53
54void gv100_init_fb(struct gpu_ops *gops)
55{
56 gv11b_init_fb(gops);
57 gops->fb.reset = gv100_fb_reset;
58}
diff --git a/drivers/gpu/nvgpu/gv100/fb_gv100.h b/drivers/gpu/nvgpu/gv100/fb_gv100.h
index b234fa13..f3219177 100644
--- a/drivers/gpu/nvgpu/gv100/fb_gv100.h
+++ b/drivers/gpu/nvgpu/gv100/fb_gv100.h
@@ -16,7 +16,7 @@
16#ifndef _NVGPU_GV100_FB 16#ifndef _NVGPU_GV100_FB
17#define _NVGPU_GV100_FB 17#define _NVGPU_GV100_FB
18 18
19struct gpu_ops; 19struct gk20a;
20 20
21void gv100_init_fb(struct gpu_ops *gops); 21void gv100_fb_reset(struct gk20a *g);
22#endif 22#endif
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c
index 337c607f..a2a131da 100644
--- a/drivers/gpu/nvgpu/gv100/hal_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c
@@ -30,10 +30,14 @@
30#include "gk20a/pramin_gk20a.h" 30#include "gk20a/pramin_gk20a.h"
31#include "gk20a/flcn_gk20a.h" 31#include "gk20a/flcn_gk20a.h"
32#include "gk20a/regops_gk20a.h" 32#include "gk20a/regops_gk20a.h"
33#include "gk20a/fb_gk20a.h"
33 34
34#include "gm20b/ltc_gm20b.h" 35#include "gm20b/ltc_gm20b.h"
35#include "gm20b/gr_gm20b.h" 36#include "gm20b/gr_gm20b.h"
36#include "gm20b/fifo_gm20b.h" 37#include "gm20b/fifo_gm20b.h"
38#include "gm20b/fb_gm20b.h"
39
40#include "gp10b/fb_gp10b.h"
37 41
38#include "gp106/clk_gp106.h" 42#include "gp106/clk_gp106.h"
39#include "gp106/clk_arb_gp106.h" 43#include "gp106/clk_arb_gp106.h"
@@ -61,7 +65,7 @@
61#include "gv100/gr_ctx_gv100.h" 65#include "gv100/gr_ctx_gv100.h"
62#include "gv100/mm_gv100.h" 66#include "gv100/mm_gv100.h"
63#include "gv11b/pmu_gv11b.h" 67#include "gv11b/pmu_gv11b.h"
64#include "gv100/fb_gv100.h" 68#include "gv11b/fb_gv11b.h"
65#include "gv11b/fifo_gv11b.h" 69#include "gv11b/fifo_gv11b.h"
66#include "gv11b/gv11b_gating_reglist.h" 70#include "gv11b/gv11b_gating_reglist.h"
67#include "gv11b/regops_gv11b.h" 71#include "gv11b/regops_gv11b.h"
@@ -69,6 +73,7 @@
69 73
70#include "gv100.h" 74#include "gv100.h"
71#include "hal_gv100.h" 75#include "hal_gv100.h"
76#include "gv100/fb_gv100.h"
72 77
73#include <nvgpu/debug.h> 78#include <nvgpu/debug.h>
74#include <nvgpu/enabled.h> 79#include <nvgpu/enabled.h>
@@ -200,6 +205,23 @@ static const struct gpu_ops gv100_ops = {
200 .isr_nonstall = gp10b_ce_nonstall_isr, 205 .isr_nonstall = gp10b_ce_nonstall_isr,
201 .get_num_pce = gv11b_ce_get_num_pce, 206 .get_num_pce = gv11b_ce_get_num_pce,
202 }, 207 },
208 .fb = {
209 .reset = gv100_fb_reset,
210 .init_hw = gk20a_fb_init_hw,
211 .init_fs_state = gv11b_fb_init_fs_state,
212 .init_cbc = gv11b_fb_init_cbc,
213 .set_mmu_page_size = gm20b_fb_set_mmu_page_size,
214 .set_use_full_comp_tag_line =
215 gm20b_fb_set_use_full_comp_tag_line,
216 .compression_page_size = gp10b_fb_compression_page_size,
217 .compressible_page_size = gp10b_fb_compressible_page_size,
218 .vpr_info_fetch = gm20b_fb_vpr_info_fetch,
219 .dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info,
220 .is_debug_mode_enabled = gm20b_fb_debug_mode_enabled,
221 .set_debug_mode = gm20b_fb_set_debug_mode,
222 .tlb_invalidate = gk20a_fb_tlb_invalidate,
223 .hub_isr = gv11b_fb_hub_isr,
224 },
203 .fifo = { 225 .fifo = {
204 .init_fifo_setup_hw = gv11b_init_fifo_setup_hw, 226 .init_fifo_setup_hw = gv11b_init_fifo_setup_hw,
205 .bind_channel = channel_gm20b_bind, 227 .bind_channel = channel_gm20b_bind,
@@ -424,10 +446,12 @@ int gv100_init_hal(struct gk20a *g)
424 g->bootstrap_owner = LSF_FALCON_ID_SEC2; 446 g->bootstrap_owner = LSF_FALCON_ID_SEC2;
425 447
426 gv11b_init_gr(g); 448 gv11b_init_gr(g);
427 gv100_init_fb(gops);
428 gv100_init_mm(gops); 449 gv100_init_mm(gops);
429 gp106_init_pmu_ops(g); 450 gp106_init_pmu_ops(g);
430 451
452 gv11b_init_uncompressed_kind_map();
453 gv11b_init_kind_attr();
454
431 g->name = "gv10x"; 455 g->name = "gv10x";
432 456
433 c->twod_class = FERMI_TWOD_A; 457 c->twod_class = FERMI_TWOD_A;
diff --git a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c
index 35227576..384dfb20 100644
--- a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c
@@ -75,7 +75,7 @@ static void gv11b_init_nvlink_soc_credits(struct gk20a *g)
75 75
76} 76}
77 77
78static void gv11b_fb_init_fs_state(struct gk20a *g) 78void gv11b_fb_init_fs_state(struct gk20a *g)
79{ 79{
80 nvgpu_log(g, gpu_dbg_fn, "initialize gv11b fb"); 80 nvgpu_log(g, gpu_dbg_fn, "initialize gv11b fb");
81 81
@@ -87,7 +87,7 @@ static void gv11b_fb_init_fs_state(struct gk20a *g)
87 gk20a_readl(g, fb_mmu_num_active_ltcs_r()))); 87 gk20a_readl(g, fb_mmu_num_active_ltcs_r())));
88} 88}
89 89
90static void gv11b_fb_init_cbc(struct gk20a *g, struct gr_gk20a *gr) 90void gv11b_fb_init_cbc(struct gk20a *g, struct gr_gk20a *gr)
91{ 91{
92 u32 max_size = gr->max_comptag_mem; 92 u32 max_size = gr->max_comptag_mem;
93 /* one tag line covers 64KB */ 93 /* one tag line covers 64KB */
@@ -137,7 +137,7 @@ static void gv11b_fb_init_cbc(struct gk20a *g, struct gr_gk20a *gr)
137 137
138} 138}
139 139
140static void gv11b_fb_reset(struct gk20a *g) 140void gv11b_fb_reset(struct gk20a *g)
141{ 141{
142 u32 val; 142 u32 val;
143 143
@@ -251,7 +251,7 @@ static const char *const gpc_client_descs_gv11b[] = {
251 "t1 36", "t1 37", "t1 38", "t1 39", 251 "t1 36", "t1 37", "t1 38", "t1 39",
252}; 252};
253 253
254static noinline_for_stack void gv11b_init_uncompressed_kind_map(void) 254noinline_for_stack void gv11b_init_uncompressed_kind_map(void)
255{ 255{
256 int i; 256 int i;
257 257
@@ -672,7 +672,7 @@ static noinline_for_stack bool gv11b_kind_zbc(u8 k)
672 k <= gmmu_pte_kind_c128_ms8_ms16_2cr_v()); 672 k <= gmmu_pte_kind_c128_ms8_ms16_2cr_v());
673} 673}
674 674
675static void gv11b_init_kind_attr(void) 675void gv11b_init_kind_attr(void)
676{ 676{
677 u16 k; 677 u16 k;
678 678
@@ -1815,7 +1815,7 @@ static void gv11b_fb_handle_mmu_fault(struct gk20a *g, u32 niso_intr)
1815 fb_mmu_fault_status_valid_clear_f()); 1815 fb_mmu_fault_status_valid_clear_f());
1816} 1816}
1817 1817
1818static void gv11b_fb_hub_isr(struct gk20a *g) 1818void gv11b_fb_hub_isr(struct gk20a *g)
1819{ 1819{
1820 u32 status, niso_intr; 1820 u32 status, niso_intr;
1821 1821
@@ -1967,16 +1967,3 @@ static int gv11b_fb_fix_page_fault(struct gk20a *g,
1967 pte[1], pte[0]); 1967 pte[1], pte[0]);
1968 return err; 1968 return err;
1969} 1969}
1970
1971void gv11b_init_fb(struct gpu_ops *gops)
1972{
1973 gp10b_init_fb(gops);
1974 gops->fb.hub_isr = gv11b_fb_hub_isr;
1975 gops->fb.reset = gv11b_fb_reset;
1976 gops->fb.init_fs_state = gv11b_fb_init_fs_state;
1977 gops->fb.init_cbc = gv11b_fb_init_cbc;
1978
1979 gv11b_init_uncompressed_kind_map();
1980 gv11b_init_kind_attr();
1981
1982}
diff --git a/drivers/gpu/nvgpu/gv11b/fb_gv11b.h b/drivers/gpu/nvgpu/gv11b/fb_gv11b.h
index 39cdfb77..3e2dd828 100644
--- a/drivers/gpu/nvgpu/gv11b/fb_gv11b.h
+++ b/drivers/gpu/nvgpu/gv11b/fb_gv11b.h
@@ -42,9 +42,13 @@
42#define FAULT_TYPE_OTHER_AND_NONREPLAY 0 42#define FAULT_TYPE_OTHER_AND_NONREPLAY 0
43#define FAULT_TYPE_REPLAY 1 43#define FAULT_TYPE_REPLAY 1
44 44
45struct gpu_ops; 45struct gk20a;
46
47void gv11b_fb_init_fs_state(struct gk20a *g);
48void gv11b_fb_init_cbc(struct gk20a *g, struct gr_gk20a *gr);
49void gv11b_fb_reset(struct gk20a *g);
50void gv11b_fb_hub_isr(struct gk20a *g);
46 51
47void gv11b_init_fb(struct gpu_ops *gops);
48u32 gv11b_fb_is_fault_buf_enabled(struct gk20a *g, 52u32 gv11b_fb_is_fault_buf_enabled(struct gk20a *g,
49 unsigned int index); 53 unsigned int index);
50void gv11b_fb_fault_buf_set_state_hw(struct gk20a *g, 54void gv11b_fb_fault_buf_set_state_hw(struct gk20a *g,
@@ -56,4 +60,7 @@ void gv11b_fb_disable_hub_intr(struct gk20a *g,
56 unsigned int index, unsigned int intr_type); 60 unsigned int index, unsigned int intr_type);
57void gv11b_fb_fault_buf_configure_hw(struct gk20a *g, unsigned int index); 61void gv11b_fb_fault_buf_configure_hw(struct gk20a *g, unsigned int index);
58bool gv11b_fb_mmu_fault_pending(struct gk20a *g); 62bool gv11b_fb_mmu_fault_pending(struct gk20a *g);
63
64noinline_for_stack void gv11b_init_uncompressed_kind_map(void);
65void gv11b_init_kind_attr(void);
59#endif 66#endif
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 7c38b611..14b7a541 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -29,9 +29,11 @@
29#include "gk20a/bus_gk20a.h" 29#include "gk20a/bus_gk20a.h"
30#include "gk20a/flcn_gk20a.h" 30#include "gk20a/flcn_gk20a.h"
31#include "gk20a/regops_gk20a.h" 31#include "gk20a/regops_gk20a.h"
32#include "gk20a/fb_gk20a.h"
32 33
33#include "gm20b/ltc_gm20b.h" 34#include "gm20b/ltc_gm20b.h"
34#include "gm20b/gr_gm20b.h" 35#include "gm20b/gr_gm20b.h"
36#include "gm20b/fb_gm20b.h"
35#include "gm20b/fifo_gm20b.h" 37#include "gm20b/fifo_gm20b.h"
36 38
37#include "gp10b/ltc_gp10b.h" 39#include "gp10b/ltc_gp10b.h"
@@ -41,6 +43,7 @@
41#include "gp10b/priv_ring_gp10b.h" 43#include "gp10b/priv_ring_gp10b.h"
42#include "gp10b/fifo_gp10b.h" 44#include "gp10b/fifo_gp10b.h"
43#include "gp10b/fecs_trace_gp10b.h" 45#include "gp10b/fecs_trace_gp10b.h"
46#include "gp10b/fb_gp10b.h"
44 47
45#include "hal_gv11b.h" 48#include "hal_gv11b.h"
46#include "gr_gv11b.h" 49#include "gr_gv11b.h"
@@ -178,6 +181,23 @@ static const struct gpu_ops gv11b_ops = {
178 .isr_nonstall = gp10b_ce_nonstall_isr, 181 .isr_nonstall = gp10b_ce_nonstall_isr,
179 .get_num_pce = gv11b_ce_get_num_pce, 182 .get_num_pce = gv11b_ce_get_num_pce,
180 }, 183 },
184 .fb = {
185 .reset = gv11b_fb_reset,
186 .init_hw = gk20a_fb_init_hw,
187 .init_fs_state = gv11b_fb_init_fs_state,
188 .init_cbc = gv11b_fb_init_cbc,
189 .set_mmu_page_size = gm20b_fb_set_mmu_page_size,
190 .set_use_full_comp_tag_line =
191 gm20b_fb_set_use_full_comp_tag_line,
192 .compression_page_size = gp10b_fb_compression_page_size,
193 .compressible_page_size = gp10b_fb_compressible_page_size,
194 .vpr_info_fetch = gm20b_fb_vpr_info_fetch,
195 .dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info,
196 .is_debug_mode_enabled = gm20b_fb_debug_mode_enabled,
197 .set_debug_mode = gm20b_fb_set_debug_mode,
198 .tlb_invalidate = gk20a_fb_tlb_invalidate,
199 .hub_isr = gv11b_fb_hub_isr,
200 },
181 .clock_gating = { 201 .clock_gating = {
182 .slcg_bus_load_gating_prod = 202 .slcg_bus_load_gating_prod =
183 gv11b_slcg_bus_load_gating_prod, 203 gv11b_slcg_bus_load_gating_prod,
@@ -408,6 +428,7 @@ int gv11b_init_hal(struct gk20a *g)
408 428
409 gops->ltc = gv11b_ops.ltc; 429 gops->ltc = gv11b_ops.ltc;
410 gops->ce2 = gv11b_ops.ce2; 430 gops->ce2 = gv11b_ops.ce2;
431 gops->fb = gv11b_ops.fb;
411 gops->clock_gating = gv11b_ops.clock_gating; 432 gops->clock_gating = gv11b_ops.clock_gating;
412 gops->fifo = gv11b_ops.fifo; 433 gops->fifo = gv11b_ops.fifo;
413 gops->gr_ctx = gv11b_ops.gr_ctx; 434 gops->gr_ctx = gv11b_ops.gr_ctx;
@@ -435,10 +456,12 @@ int gv11b_init_hal(struct gk20a *g)
435 __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); 456 __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false);
436 457
437 gv11b_init_gr(g); 458 gv11b_init_gr(g);
438 gv11b_init_fb(gops);
439 gv11b_init_mm(gops); 459 gv11b_init_mm(gops);
440 gv11b_init_pmu_ops(g); 460 gv11b_init_pmu_ops(g);
441 461
462 gv11b_init_uncompressed_kind_map();
463 gv11b_init_kind_attr();
464
442 g->name = "gv11b"; 465 g->name = "gv11b";
443 466
444 c->twod_class = FERMI_TWOD_A; 467 c->twod_class = FERMI_TWOD_A;