diff options
author | Sunny He <suhe@nvidia.com> | 2017-06-22 19:46:48 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-27 13:44:06 -0400 |
commit | a64984e7592bcd60a2dad1be8f1d24700a2e54de (patch) | |
tree | 0cef2667ea3d4e23a97da55173718bb9fe7717d3 /drivers/gpu/nvgpu/gv11b | |
parent | 5572bfa86a6afc7ae3c2f4a61e568f8e759c6ecc (diff) |
gpu: nvgpu: Reorganize ltc HAL initialization
Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the ltc
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: If8760efb7d8e94b63dc6f1fe9efec4ddf49c0b29
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master/r/1507563
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 24 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/ltc_gv11b.c | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/ltc_gv11b.h | 10 |
3 files changed, 32 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c index 0cdb471b..35b1fdc5 100644 --- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c | |||
@@ -25,8 +25,10 @@ | |||
25 | #include "gk20a/bus_gk20a.h" | 25 | #include "gk20a/bus_gk20a.h" |
26 | #include "gk20a/flcn_gk20a.h" | 26 | #include "gk20a/flcn_gk20a.h" |
27 | 27 | ||
28 | #include "gm20b/ltc_gm20b.h" | ||
28 | #include "gm20b/gr_gm20b.h" | 29 | #include "gm20b/gr_gm20b.h" |
29 | 30 | ||
31 | #include "gp10b/ltc_gp10b.h" | ||
30 | #include "gp10b/priv_ring_gp10b.h" | 32 | #include "gp10b/priv_ring_gp10b.h" |
31 | 33 | ||
32 | #include "hal_gv11b.h" | 34 | #include "hal_gv11b.h" |
@@ -50,9 +52,23 @@ | |||
50 | 52 | ||
51 | #include <nvgpu/hw/gv11b/hw_proj_gv11b.h> | 53 | #include <nvgpu/hw/gv11b/hw_proj_gv11b.h> |
52 | 54 | ||
53 | static struct gpu_ops gv11b_ops; | 55 | static const struct gpu_ops gv11b_ops = { |
54 | 56 | .ltc = { | |
55 | static struct gpu_ops gv11b_ops = { | 57 | .determine_L2_size_bytes = gp10b_determine_L2_size_bytes, |
58 | .set_zbc_s_entry = gv11b_ltc_set_zbc_stencil_entry, | ||
59 | .set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry, | ||
60 | .set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry, | ||
61 | .init_cbc = NULL, | ||
62 | .init_fs_state = gv11b_ltc_init_fs_state, | ||
63 | .init_comptags = gp10b_ltc_init_comptags, | ||
64 | .cbc_ctrl = gm20b_ltc_cbc_ctrl, | ||
65 | .isr = gv11b_ltc_isr, | ||
66 | .cbc_fix_config = gv11b_ltc_cbc_fix_config, | ||
67 | .flush = gm20b_flush_ltc, | ||
68 | #ifdef CONFIG_DEBUG_FS | ||
69 | .sync_debugfs = gp10b_ltc_sync_debugfs, | ||
70 | #endif | ||
71 | }, | ||
56 | .clock_gating = { | 72 | .clock_gating = { |
57 | .slcg_bus_load_gating_prod = | 73 | .slcg_bus_load_gating_prod = |
58 | gv11b_slcg_bus_load_gating_prod, | 74 | gv11b_slcg_bus_load_gating_prod, |
@@ -187,6 +203,7 @@ int gv11b_init_hal(struct gk20a *g) | |||
187 | struct gpu_ops *gops = &g->ops; | 203 | struct gpu_ops *gops = &g->ops; |
188 | struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; | 204 | struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; |
189 | 205 | ||
206 | gops->ltc = gv11b_ops.ltc; | ||
190 | gops->clock_gating = gv11b_ops.clock_gating; | 207 | gops->clock_gating = gv11b_ops.clock_gating; |
191 | 208 | ||
192 | /* boot in non-secure modes for time beeing */ | 209 | /* boot in non-secure modes for time beeing */ |
@@ -196,7 +213,6 @@ int gv11b_init_hal(struct gk20a *g) | |||
196 | gv11b_init_bus(gops); | 213 | gv11b_init_bus(gops); |
197 | gv11b_init_mc(gops); | 214 | gv11b_init_mc(gops); |
198 | gp10b_init_priv_ring(gops); | 215 | gp10b_init_priv_ring(gops); |
199 | gv11b_init_ltc(gops); | ||
200 | gv11b_init_gr(gops); | 216 | gv11b_init_gr(gops); |
201 | gv11b_init_fecs_trace_ops(gops); | 217 | gv11b_init_fecs_trace_ops(gops); |
202 | gv11b_init_fb(gops); | 218 | gv11b_init_fb(gops); |
diff --git a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c index 38986382..b1d85c5a 100644 --- a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "gk20a/gk20a.h" | 16 | #include "gk20a/gk20a.h" |
17 | |||
18 | #include "gp10b/ltc_gp10b.h" | 17 | #include "gp10b/ltc_gp10b.h" |
19 | 18 | ||
20 | #include "ltc_gv11b.h" | 19 | #include "ltc_gv11b.h" |
@@ -28,7 +27,7 @@ | |||
28 | /* | 27 | /* |
29 | * Sets the ZBC stencil for the passed index. | 28 | * Sets the ZBC stencil for the passed index. |
30 | */ | 29 | */ |
31 | static void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g, | 30 | void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g, |
32 | struct zbc_entry *stencil_val, | 31 | struct zbc_entry *stencil_val, |
33 | u32 index) | 32 | u32 index) |
34 | { | 33 | { |
@@ -43,7 +42,7 @@ static void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g, | |||
43 | gk20a_readl(g, ltc_ltcs_ltss_dstg_zbc_index_r()); | 42 | gk20a_readl(g, ltc_ltcs_ltss_dstg_zbc_index_r()); |
44 | } | 43 | } |
45 | 44 | ||
46 | static void gv11b_ltc_init_fs_state(struct gk20a *g) | 45 | void gv11b_ltc_init_fs_state(struct gk20a *g) |
47 | { | 46 | { |
48 | u32 ltc_intr; | 47 | u32 ltc_intr; |
49 | u32 reg; | 48 | u32 reg; |
@@ -79,7 +78,7 @@ static void gv11b_ltc_init_fs_state(struct gk20a *g) | |||
79 | ltc_intr); | 78 | ltc_intr); |
80 | } | 79 | } |
81 | 80 | ||
82 | static void gv11b_ltc_isr(struct gk20a *g) | 81 | void gv11b_ltc_isr(struct gk20a *g) |
83 | { | 82 | { |
84 | u32 mc_intr, ltc_intr3; | 83 | u32 mc_intr, ltc_intr3; |
85 | unsigned int ltc, slice; | 84 | unsigned int ltc, slice; |
@@ -184,7 +183,7 @@ static void gv11b_ltc_isr(struct gk20a *g) | |||
184 | gp10b_ltc_isr(g); | 183 | gp10b_ltc_isr(g); |
185 | } | 184 | } |
186 | 185 | ||
187 | static u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base) | 186 | u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base) |
188 | { | 187 | { |
189 | u32 val = gk20a_readl(g, ltc_ltcs_ltss_cbc_num_active_ltcs_r()); | 188 | u32 val = gk20a_readl(g, ltc_ltcs_ltss_cbc_num_active_ltcs_r()); |
190 | 189 | ||
@@ -195,14 +194,3 @@ static u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base) | |||
195 | } | 194 | } |
196 | return base; | 195 | return base; |
197 | } | 196 | } |
198 | |||
199 | |||
200 | void gv11b_init_ltc(struct gpu_ops *gops) | ||
201 | { | ||
202 | gp10b_init_ltc(gops); | ||
203 | gops->ltc.set_zbc_s_entry = gv11b_ltc_set_zbc_stencil_entry; | ||
204 | gops->ltc.init_fs_state = gv11b_ltc_init_fs_state; | ||
205 | gops->ltc.cbc_fix_config = gv11b_ltc_cbc_fix_config; | ||
206 | gops->ltc.isr = gv11b_ltc_isr; | ||
207 | gops->ltc.init_cbc = NULL; | ||
208 | } | ||
diff --git a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h index 0b8b9459..e371afea 100644 --- a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2016-2017, 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, |
@@ -15,5 +15,11 @@ | |||
15 | #define LTC_GV11B_H | 15 | #define LTC_GV11B_H |
16 | struct gk20a; | 16 | struct gk20a; |
17 | 17 | ||
18 | void gv11b_init_ltc(struct gpu_ops *gops); | 18 | void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g, |
19 | struct zbc_entry *stencil_val, | ||
20 | u32 index); | ||
21 | void gv11b_ltc_init_fs_state(struct gk20a *g); | ||
22 | void gv11b_ltc_isr(struct gk20a *g); | ||
23 | u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base); | ||
24 | |||
19 | #endif | 25 | #endif |