summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106
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/gp106
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/gp106')
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c12
-rw-r--r--drivers/gpu/nvgpu/gp106/therm_gp106.c24
-rw-r--r--drivers/gpu/nvgpu/gp106/therm_gp106.h13
3 files changed, 29 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index f9368621..8077c5e1 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -343,6 +343,16 @@ static const struct gpu_ops gp106_ops = {
343 .exit = gk20a_pramin_exit, 343 .exit = gk20a_pramin_exit,
344 .data032_r = pram_data032_r, 344 .data032_r = pram_data032_r,
345 }, 345 },
346 .therm = {
347#ifdef CONFIG_DEBUG_FS
348 .therm_debugfs_init = gp106_therm_debugfs_init,
349#endif /* CONFIG_DEBUG_FS */
350 .elcg_init_idle_filters = gp106_elcg_init_idle_filters,
351 .get_internal_sensor_curr_temp =
352 gp106_get_internal_sensor_curr_temp,
353 .get_internal_sensor_limits = gp106_get_internal_sensor_limits,
354 .configure_therm_alert = gp106_configure_therm_alert,
355 },
346 .mc = { 356 .mc = {
347 .intr_enable = mc_gp10b_intr_enable, 357 .intr_enable = mc_gp10b_intr_enable,
348 .intr_unit_config = mc_gp10b_intr_unit_config, 358 .intr_unit_config = mc_gp10b_intr_unit_config,
@@ -436,6 +446,7 @@ int gp106_init_hal(struct gk20a *g)
436 gops->gr_ctx = gp106_ops.gr_ctx; 446 gops->gr_ctx = gp106_ops.gr_ctx;
437 gops->fecs_trace = gp106_ops.fecs_trace; 447 gops->fecs_trace = gp106_ops.fecs_trace;
438 gops->pramin = gp106_ops.pramin; 448 gops->pramin = gp106_ops.pramin;
449 gops->therm = gp106_ops.therm;
439 gops->mc = gp106_ops.mc; 450 gops->mc = gp106_ops.mc;
440 gops->debug = gp106_ops.debug; 451 gops->debug = gp106_ops.debug;
441 gops->dbg_session_ops = gp106_ops.dbg_session_ops; 452 gops->dbg_session_ops = gp106_ops.dbg_session_ops;
@@ -467,7 +478,6 @@ int gp106_init_hal(struct gk20a *g)
467 gp106_init_clk_ops(gops); 478 gp106_init_clk_ops(gops);
468 gp106_init_clk_arb_ops(gops); 479 gp106_init_clk_arb_ops(gops);
469 gp106_init_regops(gops); 480 gp106_init_regops(gops);
470 gp106_init_therm_ops(gops);
471 481
472 g->name = "gp10x"; 482 g->name = "gp10x";
473 483
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.c b/drivers/gpu/nvgpu/gp106/therm_gp106.c
index dacebe93..4be8e6cd 100644
--- a/drivers/gpu/nvgpu/gp106/therm_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/therm_gp106.c
@@ -11,6 +11,8 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include "gk20a/gk20a.h"
15
14#include "therm_gp106.h" 16#include "therm_gp106.h"
15#include "therm/thrmpmu.h" 17#include "therm/thrmpmu.h"
16 18
@@ -22,13 +24,13 @@
22 24
23#include <nvgpu/hw/gp106/hw_therm_gp106.h> 25#include <nvgpu/hw/gp106/hw_therm_gp106.h>
24 26
25static void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) 27void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8)
26{ 28{
27 *max_24_8 = (0x87 << 8); 29 *max_24_8 = (0x87 << 8);
28 *min_24_8 = ((-216) << 8); 30 *min_24_8 = ((-216) << 8);
29} 31}
30 32
31static int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) 33int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8)
32{ 34{
33 int err = 0; 35 int err = 0;
34 u32 readval; 36 u32 readval;
@@ -68,7 +70,8 @@ static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
68} 70}
69DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n"); 71DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n");
70 72
71static void gp106_therm_debugfs_init(struct gk20a *g) { 73void gp106_therm_debugfs_init(struct gk20a *g)
74{
72 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 75 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g));
73 struct dentry *dbgentry; 76 struct dentry *dbgentry;
74 77
@@ -79,7 +82,7 @@ static void gp106_therm_debugfs_init(struct gk20a *g) {
79} 82}
80#endif 83#endif
81 84
82static int gp106_elcg_init_idle_filters(struct gk20a *g) 85int gp106_elcg_init_idle_filters(struct gk20a *g)
83{ 86{
84 u32 gate_ctrl, idle_filter; 87 u32 gate_ctrl, idle_filter;
85 u32 engine_id; 88 u32 engine_id;
@@ -117,7 +120,7 @@ static int gp106_elcg_init_idle_filters(struct gk20a *g)
117 return 0; 120 return 0;
118} 121}
119 122
120static u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) 123u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp)
121{ 124{
122 u32 err = 0; 125 u32 err = 0;
123 126
@@ -128,14 +131,3 @@ static u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp)
128 131
129 return err; 132 return err;
130} 133}
131
132void gp106_init_therm_ops(struct gpu_ops *gops) {
133#ifdef CONFIG_DEBUG_FS
134 gops->therm.therm_debugfs_init = gp106_therm_debugfs_init;
135#endif
136 gops->therm.elcg_init_idle_filters = gp106_elcg_init_idle_filters;
137 gops->therm.get_internal_sensor_curr_temp = gp106_get_internal_sensor_curr_temp;
138 gops->therm.get_internal_sensor_limits =
139 gp106_get_internal_sensor_limits;
140 gops->therm.configure_therm_alert = gp106_configure_therm_alert;
141}
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.h b/drivers/gpu/nvgpu/gp106/therm_gp106.h
index 6db17c47..2866320b 100644
--- a/drivers/gpu/nvgpu/gp106/therm_gp106.h
+++ b/drivers/gpu/nvgpu/gp106/therm_gp106.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * general thermal control structures & definitions 2 * general thermal control structures & definitions
3 * 3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2016-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,
@@ -16,7 +16,14 @@
16#ifndef NVGPU_THERM_GP106_H 16#ifndef NVGPU_THERM_GP106_H
17#define NVGPU_THERM_GP106_H 17#define NVGPU_THERM_GP106_H
18 18
19#include "gk20a/gk20a.h" 19struct gk20a;
20
21void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8);
22int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8);
23#ifdef CONFIG_DEBUG_FS
24void gp106_therm_debugfs_init(struct gk20a *g);
25#endif
26int gp106_elcg_init_idle_filters(struct gk20a *g);
27u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp);
20 28
21void gp106_init_therm_ops(struct gpu_ops *gops);
22#endif 29#endif