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:
Nitin Kumbhar
2018-08-13 10:09:04 +05:30
committed by mobile promotions
parent 0406900ca9
commit bcdac829f4
12 changed files with 112 additions and 42 deletions

View File

@@ -101,6 +101,7 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
os/linux/debug_hal.o \ os/linux/debug_hal.o \
os/linux/debug_clk_gm20b.o \ os/linux/debug_clk_gm20b.o \
os/linux/debug_clk_gp106.o \ os/linux/debug_clk_gp106.o \
os/linux/debug_therm_gp106.o \
os/linux/debug_bios.o \ os/linux/debug_bios.o \
os/linux/debug_ltc.o \ os/linux/debug_ltc.o \
os/linux/debug_xve.o os/linux/debug_xve.o

View File

@@ -21,16 +21,12 @@
*/ */
#include <nvgpu/io.h> #include <nvgpu/io.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "therm_gp106.h" #include "therm_gp106.h"
#include "therm/thrmpmu.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/hw/gp106/hw_therm_gp106.h>
#include <nvgpu/utils.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; 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) int gp106_elcg_init_idle_filters(struct gk20a *g)
{ {
u32 gate_ctrl, idle_filter; u32 gate_ctrl, idle_filter;

View File

@@ -1,7 +1,7 @@
/* /*
* general thermal control structures & definitions * 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 * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * 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); 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); 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); int gp106_elcg_init_idle_filters(struct gk20a *g);
u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp); u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp);

View File

@@ -605,9 +605,6 @@ static const struct gpu_ops gp106_ops = {
.data032_r = pram_data032_r, .data032_r = pram_data032_r,
}, },
.therm = { .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_elcg_mode = gm20b_therm_init_elcg_mode,
.init_blcg_mode = gm20b_therm_init_blcg_mode, .init_blcg_mode = gm20b_therm_init_blcg_mode,
.elcg_init_idle_filters = gp106_elcg_init_idle_filters, .elcg_init_idle_filters = gp106_elcg_init_idle_filters,

View File

@@ -702,9 +702,6 @@ static const struct gpu_ops gv100_ops = {
.data032_r = pram_data032_r, .data032_r = pram_data032_r,
}, },
.therm = { .therm = {
#ifdef CONFIG_DEBUG_FS
.therm_debugfs_init = gp106_therm_debugfs_init,
#endif /* CONFIG_DEBUG_FS */
/* PROD values match with H/W INIT values */ /* PROD values match with H/W INIT values */
.init_elcg_mode = gv11b_therm_init_elcg_mode, .init_elcg_mode = gv11b_therm_init_elcg_mode,
.init_blcg_mode = gm20b_therm_init_blcg_mode, .init_blcg_mode = gm20b_therm_init_blcg_mode,

View 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;
}

View 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

View File

@@ -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; l->init_done = true;
return 0; return 0;

View File

@@ -42,6 +42,10 @@ struct nvgpu_os_linux_ops {
struct { struct {
int (*init_debugfs)(struct gk20a *g); int (*init_debugfs)(struct gk20a *g);
} clk; } clk;
struct {
int (*init_debugfs)(struct gk20a *g);
} therm;
}; };
struct nvgpu_os_linux { struct nvgpu_os_linux {

View File

@@ -21,6 +21,10 @@
#include "os_ops_gp106.h" #include "os_ops_gp106.h"
#include "os_ops_gv100.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) int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l)
{ {
struct gk20a *g = &l->g; struct gk20a *g = &l->g;
@@ -40,6 +44,11 @@ int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l)
case NVGPU_GPUID_GV100: case NVGPU_GPUID_GV100:
nvgpu_gv100_init_os_ops(l); nvgpu_gv100_init_os_ops(l);
break; break;
#if defined(CONFIG_TEGRA_GPU_NEXT)
case NVGPU_GPUID_NEXT:
NVGPU_NEXT_INIT_OS_OPS(l);
break;
#endif
default: default:
break; break;
} }

View File

@@ -17,14 +17,19 @@
#include "os_linux.h" #include "os_linux.h"
#include "debug_clk_gp106.h" #include "debug_clk_gp106.h"
#include "debug_therm_gp106.h"
static struct nvgpu_os_linux_ops gp106_os_linux_ops = { static struct nvgpu_os_linux_ops gp106_os_linux_ops = {
.clk = { .clk = {
.init_debugfs = gp106_clk_init_debugfs, .init_debugfs = gp106_clk_init_debugfs,
}, },
.therm = {
.init_debugfs = gp106_therm_init_debugfs,
},
}; };
void nvgpu_gp106_init_os_ops(struct nvgpu_os_linux *l) void nvgpu_gp106_init_os_ops(struct nvgpu_os_linux *l)
{ {
l->ops.clk = gp106_os_linux_ops.clk; l->ops.clk = gp106_os_linux_ops.clk;
l->ops.therm = gp106_os_linux_ops.therm;
} }

View File

@@ -17,14 +17,19 @@
#include "os_linux.h" #include "os_linux.h"
#include "debug_clk_gp106.h" #include "debug_clk_gp106.h"
#include "debug_therm_gp106.h"
static struct nvgpu_os_linux_ops gv100_os_linux_ops = { static struct nvgpu_os_linux_ops gv100_os_linux_ops = {
.clk = { .clk = {
.init_debugfs = gp106_clk_init_debugfs, .init_debugfs = gp106_clk_init_debugfs,
}, },
.therm = {
.init_debugfs = gp106_therm_init_debugfs,
},
}; };
void nvgpu_gv100_init_os_ops(struct nvgpu_os_linux *l) void nvgpu_gv100_init_os_ops(struct nvgpu_os_linux *l)
{ {
l->ops.clk = gv100_os_linux_ops.clk; l->ops.clk = gv100_os_linux_ops.clk;
l->ops.therm = gv100_os_linux_ops.therm;
} }