summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-07-26 21:08:00 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-27 19:34:45 -0400
commitf391f53c089ec12fcc501c491430380b668e3cbf (patch)
treecc7dde1ab600dedb48c1b712094c16ceafaf5cdc /drivers/gpu/nvgpu/gm20b
parentf0593bb43f3379baffd7bb77b89c9af18842ceef (diff)
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 <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1527422 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c7
-rw-r--r--drivers/gpu/nvgpu/gm20b/therm_gm20b.c10
-rw-r--r--drivers/gpu/nvgpu/gm20b/therm_gm20b.h6
3 files changed, 11 insertions, 12 deletions
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 @@
17#include "gk20a/ce2_gk20a.h" 17#include "gk20a/ce2_gk20a.h"
18#include "gk20a/dbg_gpu_gk20a.h" 18#include "gk20a/dbg_gpu_gk20a.h"
19#include "gk20a/fifo_gk20a.h" 19#include "gk20a/fifo_gk20a.h"
20#include "gk20a/therm_gk20a.h"
20#include "gk20a/css_gr_gk20a.h" 21#include "gk20a/css_gr_gk20a.h"
21#include "gk20a/mc_gk20a.h" 22#include "gk20a/mc_gk20a.h"
22#include "gk20a/bus_gk20a.h" 23#include "gk20a/bus_gk20a.h"
@@ -272,6 +273,10 @@ static const struct gpu_ops gm20b_ops = {
272 .get_netlist_name = gr_gm20b_get_netlist_name, 273 .get_netlist_name = gr_gm20b_get_netlist_name,
273 .is_fw_defined = gr_gm20b_is_firmware_defined, 274 .is_fw_defined = gr_gm20b_is_firmware_defined,
274 }, 275 },
276 .therm = {
277 .init_therm_setup_hw = gm20b_init_therm_setup_hw,
278 .elcg_init_idle_filters = gk20a_elcg_init_idle_filters,
279 },
275 .mc = { 280 .mc = {
276 .intr_enable = mc_gk20a_intr_enable, 281 .intr_enable = mc_gk20a_intr_enable,
277 .intr_unit_config = mc_gk20a_intr_unit_config, 282 .intr_unit_config = mc_gk20a_intr_unit_config,
@@ -344,6 +349,7 @@ int gm20b_init_hal(struct gk20a *g)
344 gops->clock_gating = gm20b_ops.clock_gating; 349 gops->clock_gating = gm20b_ops.clock_gating;
345 gops->fifo = gm20b_ops.fifo; 350 gops->fifo = gm20b_ops.fifo;
346 gops->gr_ctx = gm20b_ops.gr_ctx; 351 gops->gr_ctx = gm20b_ops.gr_ctx;
352 gops->therm = gm20b_ops.therm;
347 gops->mc = gm20b_ops.mc; 353 gops->mc = gm20b_ops.mc;
348 gops->dbg_session_ops = gm20b_ops.dbg_session_ops; 354 gops->dbg_session_ops = gm20b_ops.dbg_session_ops;
349 gops->debug = gm20b_ops.debug; 355 gops->debug = gm20b_ops.debug;
@@ -399,7 +405,6 @@ int gm20b_init_hal(struct gk20a *g)
399 gm20b_init_pmu_ops(g); 405 gm20b_init_pmu_ops(g);
400 gm20b_init_clk_ops(gops); 406 gm20b_init_clk_ops(gops);
401 gm20b_init_regops(gops); 407 gm20b_init_regops(gops);
402 gm20b_init_therm_ops(gops);
403 408
404 g->name = "gm20b"; 409 g->name = "gm20b";
405 410
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 @@
1/* 1/*
2 * GM20B THERMAL 2 * GM20B THERMAL
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,
@@ -19,7 +19,7 @@
19 19
20#include <nvgpu/hw/gm20b/hw_therm_gm20b.h> 20#include <nvgpu/hw/gm20b/hw_therm_gm20b.h>
21 21
22static int gm20b_init_therm_setup_hw(struct gk20a *g) 22int gm20b_init_therm_setup_hw(struct gk20a *g)
23{ 23{
24 u32 v; 24 u32 v;
25 25
@@ -67,9 +67,3 @@ static int gm20b_init_therm_setup_hw(struct gk20a *g)
67 67
68 return 0; 68 return 0;
69} 69}
70
71void gm20b_init_therm_ops(struct gpu_ops *gops)
72{
73 gops->therm.init_therm_setup_hw = gm20b_init_therm_setup_hw;
74 gops->therm.elcg_init_idle_filters = gk20a_elcg_init_idle_filters;
75}
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 @@
1/* 1/*
2 * GM20B THERMAL 2 * GM20B THERMAL
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,
@@ -15,7 +15,7 @@
15#ifndef THERM_GM20B_H 15#ifndef THERM_GM20B_H
16#define THERM_GM20B_H 16#define THERM_GM20B_H
17 17
18struct gpu_ops; 18struct gk20a;
19void gm20b_init_therm_ops(struct gpu_ops *gops); 19int gm20b_init_therm_setup_hw(struct gk20a *g);
20 20
21#endif /* THERM_GM20B_H */ 21#endif /* THERM_GM20B_H */