summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-06-30 13:31:31 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-07 13:35:24 -0400
commit858a204362a385f076b057b6196fd89f7edb839b (patch)
treeb0f8dc16d297b406e398f02d2ae4b8077cf65fe0
parent997ea5cef3dcd55b2281a7a8dcf452b743bc01f3 (diff)
gpu: nvgpu: Reorg cde HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the cde 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: I9343ce4985eb941a2610f5f11e8f01269ab68481 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master/r/1511673 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gm20b/cde_gm20b.c9
-rw-r--r--drivers/gpu/nvgpu/gm20b/cde_gm20b.h8
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c5
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c7
-rw-r--r--drivers/gpu/nvgpu/gp10b/cde_gp10b.c15
-rw-r--r--drivers/gpu/nvgpu/gp10b/cde_gp10b.h15
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c7
7 files changed, 39 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/cde_gm20b.c b/drivers/gpu/nvgpu/gm20b/cde_gm20b.c
index d23ba8c5..f8267d1d 100644
--- a/drivers/gpu/nvgpu/gm20b/cde_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/cde_gm20b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GM20B CDE 2 * GM20B CDE
3 * 3 *
4 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -26,7 +26,7 @@ enum programs {
26 PROG_PASSTHROUGH = 6, 26 PROG_PASSTHROUGH = 6,
27}; 27};
28 28
29static void gm20b_cde_get_program_numbers(struct gk20a *g, 29void gm20b_cde_get_program_numbers(struct gk20a *g,
30 u32 block_height_log2, 30 u32 block_height_log2,
31 int *hprog_out, int *vprog_out) 31 int *hprog_out, int *vprog_out)
32{ 32{
@@ -46,8 +46,3 @@ static void gm20b_cde_get_program_numbers(struct gk20a *g,
46 *hprog_out = hprog; 46 *hprog_out = hprog;
47 *vprog_out = vprog; 47 *vprog_out = vprog;
48} 48}
49
50void gm20b_init_cde_ops(struct gpu_ops *gops)
51{
52 gops->cde.get_program_numbers = gm20b_cde_get_program_numbers;
53}
diff --git a/drivers/gpu/nvgpu/gm20b/cde_gm20b.h b/drivers/gpu/nvgpu/gm20b/cde_gm20b.h
index 66e303f5..f2ea20a0 100644
--- a/drivers/gpu/nvgpu/gm20b/cde_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/cde_gm20b.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GM20B CDE 2 * GM20B CDE
3 * 3 *
4 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -16,8 +16,10 @@
16#ifndef _NVHOST_GM20B_CDE 16#ifndef _NVHOST_GM20B_CDE
17#define _NVHOST_GM20B_CDE 17#define _NVHOST_GM20B_CDE
18 18
19struct gpu_ops; 19struct gk20a;
20 20
21void gm20b_init_cde_ops(struct gpu_ops *gops); 21void gm20b_cde_get_program_numbers(struct gk20a *g,
22 u32 block_height_log2,
23 int *hprog_out, int *vprog_out);
22 24
23#endif 25#endif
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
index 4d2e56d5..b16289f9 100644
--- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
@@ -199,6 +199,9 @@ static const struct gpu_ops gm20b_ops = {
199 .pg_gr_load_gating_prod = 199 .pg_gr_load_gating_prod =
200 gr_gm20b_pg_gr_load_gating_prod, 200 gr_gm20b_pg_gr_load_gating_prod,
201 }, 201 },
202 .cde = {
203 .get_program_numbers = gm20b_cde_get_program_numbers
204 },
202 .chip_init_gpu_characteristics = gk20a_init_gpu_characteristics, 205 .chip_init_gpu_characteristics = gk20a_init_gpu_characteristics,
203 .get_litter_value = gm20b_get_litter_value, 206 .get_litter_value = gm20b_get_litter_value,
204}; 207};
@@ -211,6 +214,7 @@ int gm20b_init_hal(struct gk20a *g)
211 214
212 gops->ltc = gm20b_ops.ltc; 215 gops->ltc = gm20b_ops.ltc;
213 gops->clock_gating = gm20b_ops.clock_gating; 216 gops->clock_gating = gm20b_ops.clock_gating;
217 gops->cde = gm20b_ops.cde;
214 218
215 /* Lone functions */ 219 /* Lone functions */
216 gops->chip_init_gpu_characteristics = 220 gops->chip_init_gpu_characteristics =
@@ -261,7 +265,6 @@ int gm20b_init_hal(struct gk20a *g)
261 gm20b_init_regops(gops); 265 gm20b_init_regops(gops);
262 gk20a_init_debug_ops(gops); 266 gk20a_init_debug_ops(gops);
263 gk20a_init_dbg_session_ops(gops); 267 gk20a_init_dbg_session_ops(gops);
264 gm20b_init_cde_ops(gops);
265 gm20b_init_therm_ops(gops); 268 gm20b_init_therm_ops(gops);
266 gk20a_init_tsg_ops(gops); 269 gk20a_init_tsg_ops(gops);
267#if defined(CONFIG_GK20A_CYCLE_STATS) 270#if defined(CONFIG_GK20A_CYCLE_STATS)
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index a13889ad..555a2192 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -239,6 +239,11 @@ static const struct gpu_ops gp106_ops = {
239 .pg_gr_load_gating_prod = 239 .pg_gr_load_gating_prod =
240 gr_gp106_pg_gr_load_gating_prod, 240 gr_gp106_pg_gr_load_gating_prod,
241 }, 241 },
242 .cde = {
243 .get_program_numbers = gp10b_cde_get_program_numbers,
244 .need_scatter_buffer = gp10b_need_scatter_buffer,
245 .populate_scatter_buffer = gp10b_populate_scatter_buffer,
246 },
242 .xve = { 247 .xve = {
243 .sw_init = xve_sw_init_gp106, 248 .sw_init = xve_sw_init_gp106,
244 .get_speed = xve_get_speed_gp106, 249 .get_speed = xve_get_speed_gp106,
@@ -268,6 +273,7 @@ int gp106_init_hal(struct gk20a *g)
268 273
269 gops->ltc = gp106_ops.ltc; 274 gops->ltc = gp106_ops.ltc;
270 gops->clock_gating = gp106_ops.clock_gating; 275 gops->clock_gating = gp106_ops.clock_gating;
276 gops->cde = gp106_ops.cde;
271 gops->xve = gp106_ops.xve; 277 gops->xve = gp106_ops.xve;
272 278
273 /* Lone functions */ 279 /* Lone functions */
@@ -296,7 +302,6 @@ int gp106_init_hal(struct gk20a *g)
296 gp106_init_clk_ops(gops); 302 gp106_init_clk_ops(gops);
297 gp106_init_clk_arb_ops(gops); 303 gp106_init_clk_arb_ops(gops);
298 gp106_init_regops(gops); 304 gp106_init_regops(gops);
299 gp10b_init_cde_ops(gops);
300 gk20a_init_tsg_ops(gops); 305 gk20a_init_tsg_ops(gops);
301 gk20a_init_pramin_ops(gops); 306 gk20a_init_pramin_ops(gops);
302#if defined(CONFIG_GK20A_CYCLE_STATS) 307#if defined(CONFIG_GK20A_CYCLE_STATS)
diff --git a/drivers/gpu/nvgpu/gp10b/cde_gp10b.c b/drivers/gpu/nvgpu/gp10b/cde_gp10b.c
index 1af5b01c..685ddbc4 100644
--- a/drivers/gpu/nvgpu/gp10b/cde_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/cde_gp10b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B CDE 2 * GP10B CDE
3 * 3 *
4 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -30,7 +30,7 @@ enum gp10b_programs {
30 GP10B_PROG_PASSTHROUGH = 8, 30 GP10B_PROG_PASSTHROUGH = 8,
31}; 31};
32 32
33static void gp10b_cde_get_program_numbers(struct gk20a *g, 33void gp10b_cde_get_program_numbers(struct gk20a *g,
34 u32 block_height_log2, 34 u32 block_height_log2,
35 int *hprog_out, int *vprog_out) 35 int *hprog_out, int *vprog_out)
36{ 36{
@@ -60,7 +60,7 @@ static void gp10b_cde_get_program_numbers(struct gk20a *g,
60 *vprog_out = vprog; 60 *vprog_out = vprog;
61} 61}
62 62
63static bool gp10b_need_scatter_buffer(struct gk20a *g) 63bool gp10b_need_scatter_buffer(struct gk20a *g)
64{ 64{
65 return g->mm.bypass_smmu; 65 return g->mm.bypass_smmu;
66} 66}
@@ -74,7 +74,7 @@ static u8 parity(u32 a)
74 return (0x6996u >> a) & 1u; 74 return (0x6996u >> a) & 1u;
75} 75}
76 76
77static int gp10b_populate_scatter_buffer(struct gk20a *g, 77int gp10b_populate_scatter_buffer(struct gk20a *g,
78 struct sg_table *sgt, 78 struct sg_table *sgt,
79 size_t surface_size, 79 size_t surface_size,
80 void *scatter_buffer_ptr, 80 void *scatter_buffer_ptr,
@@ -140,10 +140,3 @@ static int gp10b_populate_scatter_buffer(struct gk20a *g,
140 140
141 return 0; 141 return 0;
142} 142}
143
144void gp10b_init_cde_ops(struct gpu_ops *gops)
145{
146 gops->cde.get_program_numbers = gp10b_cde_get_program_numbers;
147 gops->cde.need_scatter_buffer = gp10b_need_scatter_buffer;
148 gops->cde.populate_scatter_buffer = gp10b_populate_scatter_buffer;
149}
diff --git a/drivers/gpu/nvgpu/gp10b/cde_gp10b.h b/drivers/gpu/nvgpu/gp10b/cde_gp10b.h
index 52f785f1..3ee6027c 100644
--- a/drivers/gpu/nvgpu/gp10b/cde_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/cde_gp10b.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B CDE 2 * GP10B CDE
3 * 3 *
4 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -16,8 +16,17 @@
16#ifndef _NVHOST_GP10B_CDE 16#ifndef _NVHOST_GP10B_CDE
17#define _NVHOST_GP10B_CDE 17#define _NVHOST_GP10B_CDE
18 18
19struct gpu_ops; 19struct gk20a;
20struct sg_table;
20 21
21void gp10b_init_cde_ops(struct gpu_ops *gops); 22void gp10b_cde_get_program_numbers(struct gk20a *g,
23 u32 block_height_log2,
24 int *hprog_out, int *vprog_out);
25bool gp10b_need_scatter_buffer(struct gk20a *g);
26int gp10b_populate_scatter_buffer(struct gk20a *g,
27 struct sg_table *sgt,
28 size_t surface_size,
29 void *scatter_buffer_ptr,
30 size_t scatter_buffer_size);
22 31
23#endif 32#endif
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index 98ff55cc..8609605b 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -207,6 +207,11 @@ static const struct gpu_ops gp10b_ops = {
207 .pg_gr_load_gating_prod = 207 .pg_gr_load_gating_prod =
208 gr_gp10b_pg_gr_load_gating_prod, 208 gr_gp10b_pg_gr_load_gating_prod,
209 }, 209 },
210 .cde = {
211 .get_program_numbers = gp10b_cde_get_program_numbers,
212 .need_scatter_buffer = gp10b_need_scatter_buffer,
213 .populate_scatter_buffer = gp10b_populate_scatter_buffer,
214 },
210 .chip_init_gpu_characteristics = gp10b_init_gpu_characteristics, 215 .chip_init_gpu_characteristics = gp10b_init_gpu_characteristics,
211 .get_litter_value = gp10b_get_litter_value, 216 .get_litter_value = gp10b_get_litter_value,
212}; 217};
@@ -219,6 +224,7 @@ int gp10b_init_hal(struct gk20a *g)
219 224
220 gops->ltc = gp10b_ops.ltc; 225 gops->ltc = gp10b_ops.ltc;
221 gops->clock_gating = gp10b_ops.clock_gating; 226 gops->clock_gating = gp10b_ops.clock_gating;
227 gops->cde = gp10b_ops.cde;
222 228
223 /* Lone Functions */ 229 /* Lone Functions */
224 gops->chip_init_gpu_characteristics = 230 gops->chip_init_gpu_characteristics =
@@ -278,7 +284,6 @@ int gp10b_init_hal(struct gk20a *g)
278 gk20a_init_debug_ops(gops); 284 gk20a_init_debug_ops(gops);
279 gk20a_init_dbg_session_ops(gops); 285 gk20a_init_dbg_session_ops(gops);
280 gp10b_init_regops(gops); 286 gp10b_init_regops(gops);
281 gp10b_init_cde_ops(gops);
282 gp10b_init_therm_ops(gops); 287 gp10b_init_therm_ops(gops);
283 gk20a_init_tsg_ops(gops); 288 gk20a_init_tsg_ops(gops);
284 gk20a_init_pramin_ops(gops); 289 gk20a_init_pramin_ops(gops);