summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-07-26 13:47:16 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-27 19:34:43 -0400
commit6431ec360bf7b7baf6dd687b1525c40114ede189 (patch)
treef899b3e215bf87cc411cefaf54c9b6011e487eb4 /drivers/gpu/nvgpu/gp10b
parent9907b97985c47003a179c4357274b737cc0699ee (diff)
gpu: nvgpu: Reorg gr_ctx HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the gr_ctx 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: I783d8e8919d8694ad2aa0d285e4c5a2b62580f48 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1527417 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b')
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c12
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.h5
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c7
3 files changed, 12 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c
index 2bb4a313..0c1798c0 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * GM20B Graphics Context 4 * GM20B Graphics Context
5 * 5 *
6 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License, 9 * under the terms and conditions of the GNU General Public License,
@@ -22,7 +22,7 @@
22#include "gk20a/gk20a.h" 22#include "gk20a/gk20a.h"
23#include "gr_ctx_gp10b.h" 23#include "gr_ctx_gp10b.h"
24 24
25static int gr_gp10b_get_netlist_name(struct gk20a *g, int index, char *name) 25int gr_gp10b_get_netlist_name(struct gk20a *g, int index, char *name)
26{ 26{
27 switch (index) { 27 switch (index) {
28#ifdef GP10B_NETLIST_IMAGE_FW_NAME 28#ifdef GP10B_NETLIST_IMAGE_FW_NAME
@@ -57,7 +57,7 @@ static int gr_gp10b_get_netlist_name(struct gk20a *g, int index, char *name)
57 return -1; 57 return -1;
58} 58}
59 59
60static bool gr_gp10b_is_firmware_defined(void) 60bool gr_gp10b_is_firmware_defined(void)
61{ 61{
62#ifdef GP10B_NETLIST_IMAGE_FW_NAME 62#ifdef GP10B_NETLIST_IMAGE_FW_NAME
63 return true; 63 return true;
@@ -65,9 +65,3 @@ static bool gr_gp10b_is_firmware_defined(void)
65 return false; 65 return false;
66#endif 66#endif
67} 67}
68
69void gp10b_init_gr_ctx(struct gpu_ops *gops) {
70 gops->gr_ctx.get_netlist_name = gr_gp10b_get_netlist_name;
71 gops->gr_ctx.is_fw_defined = gr_gp10b_is_firmware_defined;
72 gops->gr_ctx.use_dma_for_fw_bootstrap = true;
73}
diff --git a/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.h
index b5c76d24..45415a01 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B Graphics Context 2 * GP10B Graphics Context
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,
@@ -23,6 +23,7 @@
23/* production netlist, one and only one from below */ 23/* production netlist, one and only one from below */
24#define GP10B_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_A 24#define GP10B_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_A
25 25
26void gp10b_init_gr_ctx(struct gpu_ops *gops); 26int gr_gp10b_get_netlist_name(struct gk20a *g, int index, char *name);
27bool gr_gp10b_is_firmware_defined(void);
27 28
28#endif /*__GR_CTX_GP10B_H__*/ 29#endif /*__GR_CTX_GP10B_H__*/
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index feac284b..80018910 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -279,6 +279,10 @@ static const struct gpu_ops gp10b_ops = {
279 .resetup_ramfc = gp10b_fifo_resetup_ramfc, 279 .resetup_ramfc = gp10b_fifo_resetup_ramfc,
280 .device_info_fault_id = top_device_info_data_fault_id_enum_v, 280 .device_info_fault_id = top_device_info_data_fault_id_enum_v,
281 }, 281 },
282 .gr_ctx = {
283 .get_netlist_name = gr_gp10b_get_netlist_name,
284 .is_fw_defined = gr_gp10b_is_firmware_defined,
285 },
282 .mc = { 286 .mc = {
283 .intr_enable = mc_gp10b_intr_enable, 287 .intr_enable = mc_gp10b_intr_enable,
284 .intr_unit_config = mc_gp10b_intr_unit_config, 288 .intr_unit_config = mc_gp10b_intr_unit_config,
@@ -352,6 +356,7 @@ int gp10b_init_hal(struct gk20a *g)
352 gops->ce2 = gp10b_ops.ce2; 356 gops->ce2 = gp10b_ops.ce2;
353 gops->clock_gating = gp10b_ops.clock_gating; 357 gops->clock_gating = gp10b_ops.clock_gating;
354 gops->fifo = gp10b_ops.fifo; 358 gops->fifo = gp10b_ops.fifo;
359 gops->gr_ctx = gp10b_ops.gr_ctx;
355 gops->mc = gp10b_ops.mc; 360 gops->mc = gp10b_ops.mc;
356 gops->debug = gp10b_ops.debug; 361 gops->debug = gp10b_ops.debug;
357 gops->dbg_session_ops = gp10b_ops.dbg_session_ops; 362 gops->dbg_session_ops = gp10b_ops.dbg_session_ops;
@@ -369,6 +374,7 @@ int gp10b_init_hal(struct gk20a *g)
369 gp10b_ops.chip_init_gpu_characteristics; 374 gp10b_ops.chip_init_gpu_characteristics;
370 gops->get_litter_value = gp10b_ops.get_litter_value; 375 gops->get_litter_value = gp10b_ops.get_litter_value;
371 376
377 __nvgpu_set_enabled(g, NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP, true);
372 __nvgpu_set_enabled(g, NVGPU_PMU_PSTATE, false); 378 __nvgpu_set_enabled(g, NVGPU_PMU_PSTATE, false);
373 379
374#ifdef CONFIG_TEGRA_ACR 380#ifdef CONFIG_TEGRA_ACR
@@ -412,7 +418,6 @@ int gp10b_init_hal(struct gk20a *g)
412 gp10b_init_gr(g); 418 gp10b_init_gr(g);
413 gp10b_init_fecs_trace_ops(gops); 419 gp10b_init_fecs_trace_ops(gops);
414 gp10b_init_fb(gops); 420 gp10b_init_fb(gops);
415 gp10b_init_gr_ctx(gops);
416 gp10b_init_mm(gops); 421 gp10b_init_mm(gops);
417 gp10b_init_pmu_ops(g); 422 gp10b_init_pmu_ops(g);
418 gp10b_init_regops(gops); 423 gp10b_init_regops(gops);