summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-07-26 20:37:46 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-27 19:34:45 -0400
commitf0593bb43f3379baffd7bb77b89c9af18842ceef (patch)
tree9d41059c5b1b68a1d12705ae78421ee375dd7cd3
parent9d37d8b78c2dac7fa480493d1ab67b95290b87f1 (diff)
gpu: nvgpu: Reorg pramin HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the pramin 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: I0c0aecfb8f5ea436ef353b874f5e36ff24ebd130 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1527421 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/pramin_gk20a.c11
-rw-r--r--drivers/gpu/nvgpu/gk20a/pramin_gk20a.h10
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c8
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c8
4 files changed, 23 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pramin_gk20a.c b/drivers/gpu/nvgpu/gk20a/pramin_gk20a.c
index a7e8e615..9d19e9e5 100644
--- a/drivers/gpu/nvgpu/gk20a/pramin_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/pramin_gk20a.c
@@ -25,7 +25,7 @@
25#include <nvgpu/hw/gk20a/hw_pram_gk20a.h> 25#include <nvgpu/hw/gk20a/hw_pram_gk20a.h>
26 26
27/* WARNING: returns pramin_window_lock taken, complement with pramin_exit() */ 27/* WARNING: returns pramin_window_lock taken, complement with pramin_exit() */
28static u32 gk20a_pramin_enter(struct gk20a *g, struct nvgpu_mem *mem, 28u32 gk20a_pramin_enter(struct gk20a *g, struct nvgpu_mem *mem,
29 struct page_alloc_chunk *chunk, u32 w) 29 struct page_alloc_chunk *chunk, u32 w)
30{ 30{
31 u64 bufbase = chunk->base; 31 u64 bufbase = chunk->base;
@@ -56,17 +56,10 @@ static u32 gk20a_pramin_enter(struct gk20a *g, struct nvgpu_mem *mem,
56 return lo; 56 return lo;
57} 57}
58 58
59static void gk20a_pramin_exit(struct gk20a *g, struct nvgpu_mem *mem, 59void gk20a_pramin_exit(struct gk20a *g, struct nvgpu_mem *mem,
60 struct page_alloc_chunk *chunk) 60 struct page_alloc_chunk *chunk)
61{ 61{
62 gk20a_dbg(gpu_dbg_mem, "end for %p,%p", mem, chunk); 62 gk20a_dbg(gpu_dbg_mem, "end for %p,%p", mem, chunk);
63 63
64 nvgpu_spinlock_release(&g->mm.pramin_window_lock); 64 nvgpu_spinlock_release(&g->mm.pramin_window_lock);
65} 65}
66
67void gk20a_init_pramin_ops(struct gpu_ops *gops)
68{
69 gops->pramin.enter = gk20a_pramin_enter;
70 gops->pramin.exit = gk20a_pramin_exit;
71 gops->pramin.data032_r = pram_data032_r;
72}
diff --git a/drivers/gpu/nvgpu/gk20a/pramin_gk20a.h b/drivers/gpu/nvgpu/gk20a/pramin_gk20a.h
index 93d1cc75..1a1ac871 100644
--- a/drivers/gpu/nvgpu/gk20a/pramin_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/pramin_gk20a.h
@@ -17,8 +17,12 @@
17#ifndef __PRAMIN_GK20A_H__ 17#ifndef __PRAMIN_GK20A_H__
18#define __PRAMIN_GK20A_H__ 18#define __PRAMIN_GK20A_H__
19 19
20struct gpu_ops; 20struct gk20a;
21 21struct nvgpu_mem;
22void gk20a_init_pramin_ops(struct gpu_ops *ops); 22struct page_alloc_chunk;
23 23
24u32 gk20a_pramin_enter(struct gk20a *g, struct nvgpu_mem *mem,
25 struct page_alloc_chunk *chunk, u32 w);
26void gk20a_pramin_exit(struct gk20a *g, struct nvgpu_mem *mem,
27 struct page_alloc_chunk *chunk);
24#endif 28#endif
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index dd162109..f9368621 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -70,6 +70,7 @@
70#include <nvgpu/hw/gp106/hw_fifo_gp106.h> 70#include <nvgpu/hw/gp106/hw_fifo_gp106.h>
71#include <nvgpu/hw/gp106/hw_ram_gp106.h> 71#include <nvgpu/hw/gp106/hw_ram_gp106.h>
72#include <nvgpu/hw/gp106/hw_top_gp106.h> 72#include <nvgpu/hw/gp106/hw_top_gp106.h>
73#include <nvgpu/hw/gp106/hw_pram_gp106.h>
73 74
74static int gp106_get_litter_value(struct gk20a *g, int value) 75static int gp106_get_litter_value(struct gk20a *g, int value)
75{ 76{
@@ -337,6 +338,11 @@ static const struct gpu_ops gp106_ops = {
337 .max_entries = gk20a_gr_max_entries, 338 .max_entries = gk20a_gr_max_entries,
338 }, 339 },
339#endif /* CONFIG_GK20A_CTXSW_TRACE */ 340#endif /* CONFIG_GK20A_CTXSW_TRACE */
341 .pramin = {
342 .enter = gk20a_pramin_enter,
343 .exit = gk20a_pramin_exit,
344 .data032_r = pram_data032_r,
345 },
340 .mc = { 346 .mc = {
341 .intr_enable = mc_gp10b_intr_enable, 347 .intr_enable = mc_gp10b_intr_enable,
342 .intr_unit_config = mc_gp10b_intr_unit_config, 348 .intr_unit_config = mc_gp10b_intr_unit_config,
@@ -429,6 +435,7 @@ int gp106_init_hal(struct gk20a *g)
429 gops->fifo = gp106_ops.fifo; 435 gops->fifo = gp106_ops.fifo;
430 gops->gr_ctx = gp106_ops.gr_ctx; 436 gops->gr_ctx = gp106_ops.gr_ctx;
431 gops->fecs_trace = gp106_ops.fecs_trace; 437 gops->fecs_trace = gp106_ops.fecs_trace;
438 gops->pramin = gp106_ops.pramin;
432 gops->mc = gp106_ops.mc; 439 gops->mc = gp106_ops.mc;
433 gops->debug = gp106_ops.debug; 440 gops->debug = gp106_ops.debug;
434 gops->dbg_session_ops = gp106_ops.dbg_session_ops; 441 gops->dbg_session_ops = gp106_ops.dbg_session_ops;
@@ -460,7 +467,6 @@ int gp106_init_hal(struct gk20a *g)
460 gp106_init_clk_ops(gops); 467 gp106_init_clk_ops(gops);
461 gp106_init_clk_arb_ops(gops); 468 gp106_init_clk_arb_ops(gops);
462 gp106_init_regops(gops); 469 gp106_init_regops(gops);
463 gk20a_init_pramin_ops(gops);
464 gp106_init_therm_ops(gops); 470 gp106_init_therm_ops(gops);
465 471
466 g->name = "gp10x"; 472 g->name = "gp10x";
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index 1574ac56..3a44f1ef 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -61,6 +61,7 @@
61#include <nvgpu/hw/gp10b/hw_fifo_gp10b.h> 61#include <nvgpu/hw/gp10b/hw_fifo_gp10b.h>
62#include <nvgpu/hw/gp10b/hw_ram_gp10b.h> 62#include <nvgpu/hw/gp10b/hw_ram_gp10b.h>
63#include <nvgpu/hw/gp10b/hw_top_gp10b.h> 63#include <nvgpu/hw/gp10b/hw_top_gp10b.h>
64#include <nvgpu/hw/gp10b/hw_pram_gp10b.h>
64 65
65static int gp10b_get_litter_value(struct gk20a *g, int value) 66static int gp10b_get_litter_value(struct gk20a *g, int value)
66{ 67{
@@ -303,6 +304,11 @@ static const struct gpu_ops gp10b_ops = {
303 .max_entries = gk20a_gr_max_entries, 304 .max_entries = gk20a_gr_max_entries,
304 }, 305 },
305#endif /* CONFIG_GK20A_CTXSW_TRACE */ 306#endif /* CONFIG_GK20A_CTXSW_TRACE */
307 .pramin = {
308 .enter = gk20a_pramin_enter,
309 .exit = gk20a_pramin_exit,
310 .data032_r = pram_data032_r,
311 },
306 .mc = { 312 .mc = {
307 .intr_enable = mc_gp10b_intr_enable, 313 .intr_enable = mc_gp10b_intr_enable,
308 .intr_unit_config = mc_gp10b_intr_unit_config, 314 .intr_unit_config = mc_gp10b_intr_unit_config,
@@ -378,6 +384,7 @@ int gp10b_init_hal(struct gk20a *g)
378 gops->fifo = gp10b_ops.fifo; 384 gops->fifo = gp10b_ops.fifo;
379 gops->gr_ctx = gp10b_ops.gr_ctx; 385 gops->gr_ctx = gp10b_ops.gr_ctx;
380 gops->fecs_trace = gp10b_ops.fecs_trace; 386 gops->fecs_trace = gp10b_ops.fecs_trace;
387 gops->pramin = gp10b_ops.pramin;
381 gops->mc = gp10b_ops.mc; 388 gops->mc = gp10b_ops.mc;
382 gops->debug = gp10b_ops.debug; 389 gops->debug = gp10b_ops.debug;
383 gops->dbg_session_ops = gp10b_ops.dbg_session_ops; 390 gops->dbg_session_ops = gp10b_ops.dbg_session_ops;
@@ -442,7 +449,6 @@ int gp10b_init_hal(struct gk20a *g)
442 gp10b_init_pmu_ops(g); 449 gp10b_init_pmu_ops(g);
443 gp10b_init_regops(gops); 450 gp10b_init_regops(gops);
444 gp10b_init_therm_ops(gops); 451 gp10b_init_therm_ops(gops);
445 gk20a_init_pramin_ops(gops);
446 452
447 g->name = "gp10b"; 453 g->name = "gp10b";
448 454