From 6431ec360bf7b7baf6dd687b1525c40114ede189 Mon Sep 17 00:00:00 2001 From: Sunny He Date: Wed, 26 Jul 2017 10:47:16 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1527417 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.c | 12 +++--------- drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.h | 5 +++-- drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 7 ++++++- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b') diff --git a/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.c index e22acbe3..555c1409 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.c @@ -3,7 +3,7 @@ * * GM20B Graphics Context * - * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -22,7 +22,7 @@ #include "gk20a/gk20a.h" #include "gr_ctx_gm20b.h" -static int gr_gm20b_get_netlist_name(struct gk20a *g, int index, char *name) +int gr_gm20b_get_netlist_name(struct gk20a *g, int index, char *name) { switch (index) { #ifdef GM20B_NETLIST_IMAGE_FW_NAME @@ -57,7 +57,7 @@ static int gr_gm20b_get_netlist_name(struct gk20a *g, int index, char *name) return -1; } -static bool gr_gm20b_is_firmware_defined(void) +bool gr_gm20b_is_firmware_defined(void) { #ifdef GM20B_NETLIST_IMAGE_FW_NAME return true; @@ -65,9 +65,3 @@ static bool gr_gm20b_is_firmware_defined(void) return false; #endif } - -void gm20b_init_gr_ctx(struct gpu_ops *gops) { - gops->gr_ctx.get_netlist_name = gr_gm20b_get_netlist_name; - gops->gr_ctx.is_fw_defined = gr_gm20b_is_firmware_defined; - gops->gr_ctx.use_dma_for_fw_bootstrap = true; -} diff --git a/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.h b/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.h index 9172e151..414634da 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/gr_ctx_gm20b.h @@ -1,7 +1,7 @@ /* * GM20B Graphics Context * - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -24,6 +24,7 @@ /*#undef GM20B_NETLIST_IMAGE_FW_NAME*/ #define GM20B_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_B -void gm20b_init_gr_ctx(struct gpu_ops *gops); +int gr_gm20b_get_netlist_name(struct gk20a *g, int index, char *name); +bool gr_gm20b_is_firmware_defined(void); #endif /*__GR_CTX_GM20B_H__*/ diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index c89f3746..1a11b11c 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c @@ -268,6 +268,10 @@ static const struct gpu_ops gm20b_ops = { .get_syncpt_incr_cmd_size = gk20a_fifo_get_syncpt_incr_cmd_size, #endif }, + .gr_ctx = { + .get_netlist_name = gr_gm20b_get_netlist_name, + .is_fw_defined = gr_gm20b_is_firmware_defined, + }, .mc = { .intr_enable = mc_gk20a_intr_enable, .intr_unit_config = mc_gk20a_intr_unit_config, @@ -339,6 +343,7 @@ int gm20b_init_hal(struct gk20a *g) gops->ce2 = gm20b_ops.ce2; gops->clock_gating = gm20b_ops.clock_gating; gops->fifo = gm20b_ops.fifo; + gops->gr_ctx = gm20b_ops.gr_ctx; gops->mc = gm20b_ops.mc; gops->dbg_session_ops = gm20b_ops.dbg_session_ops; gops->debug = gm20b_ops.debug; @@ -356,6 +361,7 @@ int gm20b_init_hal(struct gk20a *g) gm20b_ops.chip_init_gpu_characteristics; gops->get_litter_value = gm20b_ops.get_litter_value; + __nvgpu_set_enabled(g, NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP, true); __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); __nvgpu_set_enabled(g, NVGPU_PMU_PSTATE, false); @@ -389,7 +395,6 @@ int gm20b_init_hal(struct gk20a *g) g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT; gm20b_init_gr(g); gm20b_init_fb(gops); - gm20b_init_gr_ctx(gops); gm20b_init_mm(gops); gm20b_init_pmu_ops(g); gm20b_init_clk_ops(gops); -- cgit v1.2.2