mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: move therm debugfs to linux
Move debugfs related code of therm from common driver to linux specific part of the driver. gp106_therm_debugfs_init() is updated to use nvgpu_os_linux_ops. This also affects gv100 as gp106_therm_debugfs_init is used for gv100 as well. JIRA NVGPU-603 Change-Id: Ia293d14599bc0c91fd1e917b5a430bd8f3d96e56 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1797906 GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
0406900ca9
commit
bcdac829f4
@@ -101,6 +101,7 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
|
||||
os/linux/debug_hal.o \
|
||||
os/linux/debug_clk_gm20b.o \
|
||||
os/linux/debug_clk_gp106.o \
|
||||
os/linux/debug_therm_gp106.o \
|
||||
os/linux/debug_bios.o \
|
||||
os/linux/debug_ltc.o \
|
||||
os/linux/debug_xve.o
|
||||
|
||||
@@ -21,16 +21,12 @@
|
||||
*/
|
||||
|
||||
#include <nvgpu/io.h>
|
||||
|
||||
#include "gk20a/gk20a.h"
|
||||
|
||||
#include "therm_gp106.h"
|
||||
#include "therm/thrmpmu.h"
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
#include <linux/debugfs.h>
|
||||
#include "os/linux/os_linux.h"
|
||||
#endif
|
||||
|
||||
#include <nvgpu/hw/gp106/hw_therm_gp106.h>
|
||||
|
||||
#include <nvgpu/utils.h>
|
||||
@@ -66,33 +62,6 @@ int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8)
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
|
||||
{
|
||||
struct gk20a *g = (struct gk20a *)data;
|
||||
u32 readval;
|
||||
int err;
|
||||
|
||||
err = gp106_get_internal_sensor_curr_temp(g, &readval);
|
||||
if (!err)
|
||||
*val = readval;
|
||||
|
||||
return err;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n");
|
||||
|
||||
void gp106_therm_debugfs_init(struct gk20a *g)
|
||||
{
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
struct dentry *dbgentry;
|
||||
|
||||
dbgentry = debugfs_create_file(
|
||||
"temp", S_IRUGO, l->debugfs, g, &therm_ctrl_fops);
|
||||
if (!dbgentry)
|
||||
nvgpu_err(g, "debugfs entry create failed for therm_curr_temp");
|
||||
}
|
||||
#endif
|
||||
|
||||
int gp106_elcg_init_idle_filters(struct gk20a *g)
|
||||
{
|
||||
u32 gate_ctrl, idle_filter;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* general thermal control structures & definitions
|
||||
*
|
||||
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -31,9 +31,6 @@ struct gk20a;
|
||||
|
||||
void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8);
|
||||
int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8);
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
void gp106_therm_debugfs_init(struct gk20a *g);
|
||||
#endif
|
||||
int gp106_elcg_init_idle_filters(struct gk20a *g);
|
||||
u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp);
|
||||
|
||||
|
||||
@@ -605,9 +605,6 @@ static const struct gpu_ops gp106_ops = {
|
||||
.data032_r = pram_data032_r,
|
||||
},
|
||||
.therm = {
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
.therm_debugfs_init = gp106_therm_debugfs_init,
|
||||
#endif /* CONFIG_DEBUG_FS */
|
||||
.init_elcg_mode = gm20b_therm_init_elcg_mode,
|
||||
.init_blcg_mode = gm20b_therm_init_blcg_mode,
|
||||
.elcg_init_idle_filters = gp106_elcg_init_idle_filters,
|
||||
|
||||
@@ -702,9 +702,6 @@ static const struct gpu_ops gv100_ops = {
|
||||
.data032_r = pram_data032_r,
|
||||
},
|
||||
.therm = {
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
.therm_debugfs_init = gp106_therm_debugfs_init,
|
||||
#endif /* CONFIG_DEBUG_FS */
|
||||
/* PROD values match with H/W INIT values */
|
||||
.init_elcg_mode = gv11b_therm_init_elcg_mode,
|
||||
.init_blcg_mode = gm20b_therm_init_blcg_mode,
|
||||
|
||||
49
drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c
Normal file
49
drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
|
||||
{
|
||||
struct gk20a *g = (struct gk20a *)data;
|
||||
u32 readval;
|
||||
int err;
|
||||
|
||||
if (!g->ops.therm.get_internal_sensor_curr_temp)
|
||||
return -EINVAL;
|
||||
|
||||
err = g->ops.therm.get_internal_sensor_curr_temp(g, &readval);
|
||||
if (!err)
|
||||
*val = readval;
|
||||
|
||||
return err;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n");
|
||||
|
||||
int gp106_therm_init_debugfs(struct gk20a *g)
|
||||
{
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
struct dentry *dbgentry;
|
||||
|
||||
dbgentry = debugfs_create_file(
|
||||
"temp", S_IRUGO, l->debugfs, g, &therm_ctrl_fops);
|
||||
if (!dbgentry)
|
||||
nvgpu_err(g, "debugfs entry create failed for therm_curr_temp");
|
||||
|
||||
return 0;
|
||||
}
|
||||
29
drivers/gpu/nvgpu/os/linux/debug_therm_gp106.h
Normal file
29
drivers/gpu/nvgpu/os/linux/debug_therm_gp106.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __DEBUG_THERM_GP106_H
|
||||
#define __DEBUG_THERM_GP106_H
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
int gp106_therm_init_debugfs(struct gk20a *g);
|
||||
#else
|
||||
inline int gp106_therm_init_debugfs(struct gk20a *g)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -206,6 +206,14 @@ int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l)
|
||||
}
|
||||
}
|
||||
|
||||
if (l->ops.therm.init_debugfs) {
|
||||
err = l->ops.therm.init_debugfs(g);
|
||||
if (err) {
|
||||
nvgpu_err(g, "failed to init linux therm debugfs");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
l->init_done = true;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -42,6 +42,10 @@ struct nvgpu_os_linux_ops {
|
||||
struct {
|
||||
int (*init_debugfs)(struct gk20a *g);
|
||||
} clk;
|
||||
|
||||
struct {
|
||||
int (*init_debugfs)(struct gk20a *g);
|
||||
} therm;
|
||||
};
|
||||
|
||||
struct nvgpu_os_linux {
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#include "os_ops_gp106.h"
|
||||
#include "os_ops_gv100.h"
|
||||
|
||||
#if defined(CONFIG_TEGRA_GPU_NEXT)
|
||||
#include "nvgpu_gpuid_next.h"
|
||||
#endif
|
||||
|
||||
int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
struct gk20a *g = &l->g;
|
||||
@@ -40,6 +44,11 @@ int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l)
|
||||
case NVGPU_GPUID_GV100:
|
||||
nvgpu_gv100_init_os_ops(l);
|
||||
break;
|
||||
#if defined(CONFIG_TEGRA_GPU_NEXT)
|
||||
case NVGPU_GPUID_NEXT:
|
||||
NVGPU_NEXT_INIT_OS_OPS(l);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -17,14 +17,19 @@
|
||||
#include "os_linux.h"
|
||||
|
||||
#include "debug_clk_gp106.h"
|
||||
#include "debug_therm_gp106.h"
|
||||
|
||||
static struct nvgpu_os_linux_ops gp106_os_linux_ops = {
|
||||
.clk = {
|
||||
.init_debugfs = gp106_clk_init_debugfs,
|
||||
},
|
||||
.therm = {
|
||||
.init_debugfs = gp106_therm_init_debugfs,
|
||||
},
|
||||
};
|
||||
|
||||
void nvgpu_gp106_init_os_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
l->ops.clk = gp106_os_linux_ops.clk;
|
||||
l->ops.therm = gp106_os_linux_ops.therm;
|
||||
}
|
||||
|
||||
@@ -17,14 +17,19 @@
|
||||
#include "os_linux.h"
|
||||
|
||||
#include "debug_clk_gp106.h"
|
||||
#include "debug_therm_gp106.h"
|
||||
|
||||
static struct nvgpu_os_linux_ops gv100_os_linux_ops = {
|
||||
.clk = {
|
||||
.init_debugfs = gp106_clk_init_debugfs,
|
||||
},
|
||||
.therm = {
|
||||
.init_debugfs = gp106_therm_init_debugfs,
|
||||
},
|
||||
};
|
||||
|
||||
void nvgpu_gv100_init_os_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
l->ops.clk = gv100_os_linux_ops.clk;
|
||||
l->ops.therm = gv100_os_linux_ops.therm;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user