From f391f53c089ec12fcc501c491430380b668e3cbf Mon Sep 17 00:00:00 2001 From: Sunny He Date: Wed, 26 Jul 2017 18:08:00 -0700 Subject: gpu: nvgpu: Reorg therm HAL initialization Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the therm 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: Ic9d03304d3dcde0365cbf22af2dbe1e7eb0e04bb Signed-off-by: Sunny He Reviewed-on: https://git-master.nvidia.com/r/1527422 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 7 ++++++- drivers/gpu/nvgpu/gm20b/therm_gm20b.c | 10 ++-------- drivers/gpu/nvgpu/gm20b/therm_gm20b.h | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b') diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 1a11b11c..407a442a 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c @@ -17,6 +17,7 @@ #include "gk20a/ce2_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" #include "gk20a/fifo_gk20a.h" +#include "gk20a/therm_gk20a.h" #include "gk20a/css_gr_gk20a.h" #include "gk20a/mc_gk20a.h" #include "gk20a/bus_gk20a.h" @@ -272,6 +273,10 @@ static const struct gpu_ops gm20b_ops = { .get_netlist_name = gr_gm20b_get_netlist_name, .is_fw_defined = gr_gm20b_is_firmware_defined, }, + .therm = { + .init_therm_setup_hw = gm20b_init_therm_setup_hw, + .elcg_init_idle_filters = gk20a_elcg_init_idle_filters, + }, .mc = { .intr_enable = mc_gk20a_intr_enable, .intr_unit_config = mc_gk20a_intr_unit_config, @@ -344,6 +349,7 @@ int gm20b_init_hal(struct gk20a *g) gops->clock_gating = gm20b_ops.clock_gating; gops->fifo = gm20b_ops.fifo; gops->gr_ctx = gm20b_ops.gr_ctx; + gops->therm = gm20b_ops.therm; gops->mc = gm20b_ops.mc; gops->dbg_session_ops = gm20b_ops.dbg_session_ops; gops->debug = gm20b_ops.debug; @@ -399,7 +405,6 @@ int gm20b_init_hal(struct gk20a *g) gm20b_init_pmu_ops(g); gm20b_init_clk_ops(gops); gm20b_init_regops(gops); - gm20b_init_therm_ops(gops); g->name = "gm20b"; diff --git a/drivers/gpu/nvgpu/gm20b/therm_gm20b.c b/drivers/gpu/nvgpu/gm20b/therm_gm20b.c index 84c1a071..a999151f 100644 --- a/drivers/gpu/nvgpu/gm20b/therm_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/therm_gm20b.c @@ -1,7 +1,7 @@ /* * GM20B THERMAL * - * Copyright (c) 2015-2016, 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, @@ -19,7 +19,7 @@ #include -static int gm20b_init_therm_setup_hw(struct gk20a *g) +int gm20b_init_therm_setup_hw(struct gk20a *g) { u32 v; @@ -67,9 +67,3 @@ static int gm20b_init_therm_setup_hw(struct gk20a *g) return 0; } - -void gm20b_init_therm_ops(struct gpu_ops *gops) -{ - gops->therm.init_therm_setup_hw = gm20b_init_therm_setup_hw; - gops->therm.elcg_init_idle_filters = gk20a_elcg_init_idle_filters; -} diff --git a/drivers/gpu/nvgpu/gm20b/therm_gm20b.h b/drivers/gpu/nvgpu/gm20b/therm_gm20b.h index c346c4f2..65147a64 100644 --- a/drivers/gpu/nvgpu/gm20b/therm_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/therm_gm20b.h @@ -1,7 +1,7 @@ /* * GM20B THERMAL * - * 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, @@ -15,7 +15,7 @@ #ifndef THERM_GM20B_H #define THERM_GM20B_H -struct gpu_ops; -void gm20b_init_therm_ops(struct gpu_ops *gops); +struct gk20a; +int gm20b_init_therm_setup_hw(struct gk20a *g); #endif /* THERM_GM20B_H */ -- cgit v1.2.2