mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: move pmgr debugfs to linux
Move debugfs related part of pmgr to linux files. JIRA NVGPU-603 Change-Id: I478491e06e2e7cdbe3826166aafd8491d1e6c1e7 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1801086 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
bcdac829f4
commit
78b4ab269f
@@ -96,6 +96,7 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
|
|||||||
os/linux/debug_fifo.o \
|
os/linux/debug_fifo.o \
|
||||||
os/linux/debug_ce.o \
|
os/linux/debug_ce.o \
|
||||||
os/linux/debug_pmu.o \
|
os/linux/debug_pmu.o \
|
||||||
|
os/linux/debug_pmgr.o \
|
||||||
os/linux/debug_sched.o \
|
os/linux/debug_sched.o \
|
||||||
os/linux/debug_allocator.o \
|
os/linux/debug_allocator.o \
|
||||||
os/linux/debug_hal.o \
|
os/linux/debug_hal.o \
|
||||||
|
|||||||
104
drivers/gpu/nvgpu/os/linux/debug_pmgr.c
Normal file
104
drivers/gpu/nvgpu/os/linux/debug_pmgr.c
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
|
||||||
|
#include "pmgr/pmgr.h"
|
||||||
|
|
||||||
|
static int pmgr_pwr_devices_get_power_u64(void *data, u64 *p)
|
||||||
|
{
|
||||||
|
struct gk20a *g = (struct gk20a *)data;
|
||||||
|
int err;
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
err = pmgr_pwr_devices_get_power(g, &val);
|
||||||
|
*p = val;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pmgr_pwr_devices_get_current_u64(void *data, u64 *p)
|
||||||
|
{
|
||||||
|
struct gk20a *g = (struct gk20a *)data;
|
||||||
|
int err;
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
err = pmgr_pwr_devices_get_current(g, &val);
|
||||||
|
*p = val;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pmgr_pwr_devices_get_voltage_u64(void *data, u64 *p)
|
||||||
|
{
|
||||||
|
struct gk20a *g = (struct gk20a *)data;
|
||||||
|
int err;
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
err = pmgr_pwr_devices_get_voltage(g, &val);
|
||||||
|
*p = val;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_SIMPLE_ATTRIBUTE(
|
||||||
|
pmgr_power_ctrl_fops, pmgr_pwr_devices_get_power_u64, NULL, "%llu\n");
|
||||||
|
|
||||||
|
DEFINE_SIMPLE_ATTRIBUTE(
|
||||||
|
pmgr_current_ctrl_fops, pmgr_pwr_devices_get_current_u64, NULL, "%llu\n");
|
||||||
|
|
||||||
|
DEFINE_SIMPLE_ATTRIBUTE(
|
||||||
|
pmgr_voltage_ctrl_fops, pmgr_pwr_devices_get_voltage_u64, NULL, "%llu\n");
|
||||||
|
|
||||||
|
static void pmgr_debugfs_init(struct gk20a *g)
|
||||||
|
{
|
||||||
|
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||||
|
struct dentry *dbgentry;
|
||||||
|
|
||||||
|
dbgentry = debugfs_create_file(
|
||||||
|
"power", S_IRUGO, l->debugfs, g, &pmgr_power_ctrl_fops);
|
||||||
|
if (!dbgentry)
|
||||||
|
nvgpu_err(g, "debugfs entry create failed for power");
|
||||||
|
|
||||||
|
dbgentry = debugfs_create_file(
|
||||||
|
"current", S_IRUGO, l->debugfs, g, &pmgr_current_ctrl_fops);
|
||||||
|
if (!dbgentry)
|
||||||
|
nvgpu_err(g, "debugfs entry create failed for current");
|
||||||
|
|
||||||
|
dbgentry = debugfs_create_file(
|
||||||
|
"voltage", S_IRUGO, l->debugfs, g, &pmgr_voltage_ctrl_fops);
|
||||||
|
if (!dbgentry)
|
||||||
|
nvgpu_err(g, "debugfs entry create failed for voltage");
|
||||||
|
}
|
||||||
|
|
||||||
|
int nvgpu_pmgr_init_debugfs_linux(struct nvgpu_os_linux *l)
|
||||||
|
{
|
||||||
|
struct gk20a *g = &l->g;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!nvgpu_is_enabled(g, NVGPU_PMU_PSTATE))
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (!g->ops.clk.support_pmgr_domain)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
pmgr_debugfs_init(g);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
28
drivers/gpu/nvgpu/os/linux/debug_pmgr.h
Normal file
28
drivers/gpu/nvgpu/os/linux/debug_pmgr.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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 __LINUX_DEBUG_PMGR_H
|
||||||
|
#define __LINUX_DEBUG_PMGR_H
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_FS
|
||||||
|
int nvgpu_pmgr_init_debugfs_linux(struct nvgpu_os_linux *l);
|
||||||
|
#else
|
||||||
|
int nvgpu_pmgr_init_debugfs_linux(struct nvgpu_os_linux *l)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
#include "ctxsw_trace.h"
|
#include "ctxsw_trace.h"
|
||||||
#include "driver_common.h"
|
#include "driver_common.h"
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
|
#include "debug_pmgr.h"
|
||||||
|
|
||||||
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
||||||
#include "cde.h"
|
#include "cde.h"
|
||||||
@@ -214,6 +215,12 @@ int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = nvgpu_pmgr_init_debugfs_linux(l);
|
||||||
|
if (err) {
|
||||||
|
nvgpu_err(g, "failed to init linux pmgr debugfs");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
l->init_done = true;
|
l->init_done = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -24,11 +24,6 @@
|
|||||||
#include "pwrdev.h"
|
#include "pwrdev.h"
|
||||||
#include "pmgrpmu.h"
|
#include "pmgrpmu.h"
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
|
||||||
#include <linux/debugfs.h>
|
|
||||||
#include "os/linux/os_linux.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int pmgr_pwr_devices_get_power(struct gk20a *g, u32 *val)
|
int pmgr_pwr_devices_get_power(struct gk20a *g, u32 *val)
|
||||||
{
|
{
|
||||||
struct nv_pmu_pmgr_pwr_devices_query_payload payload;
|
struct nv_pmu_pmgr_pwr_devices_query_payload payload;
|
||||||
@@ -74,74 +69,6 @@ int pmgr_pwr_devices_get_voltage(struct gk20a *g, u32 *val)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
|
||||||
static int pmgr_pwr_devices_get_power_u64(void *data, u64 *p)
|
|
||||||
{
|
|
||||||
struct gk20a *g = (struct gk20a *)data;
|
|
||||||
int err;
|
|
||||||
u32 val;
|
|
||||||
|
|
||||||
err = pmgr_pwr_devices_get_power(g, &val);
|
|
||||||
*p = val;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pmgr_pwr_devices_get_current_u64(void *data, u64 *p)
|
|
||||||
{
|
|
||||||
struct gk20a *g = (struct gk20a *)data;
|
|
||||||
int err;
|
|
||||||
u32 val;
|
|
||||||
|
|
||||||
err = pmgr_pwr_devices_get_current(g, &val);
|
|
||||||
*p = val;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pmgr_pwr_devices_get_voltage_u64(void *data, u64 *p)
|
|
||||||
{
|
|
||||||
struct gk20a *g = (struct gk20a *)data;
|
|
||||||
int err;
|
|
||||||
u32 val;
|
|
||||||
|
|
||||||
err = pmgr_pwr_devices_get_voltage(g, &val);
|
|
||||||
*p = val;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_SIMPLE_ATTRIBUTE(
|
|
||||||
pmgr_power_ctrl_fops, pmgr_pwr_devices_get_power_u64, NULL, "%llu\n");
|
|
||||||
|
|
||||||
DEFINE_SIMPLE_ATTRIBUTE(
|
|
||||||
pmgr_current_ctrl_fops, pmgr_pwr_devices_get_current_u64, NULL, "%llu\n");
|
|
||||||
|
|
||||||
DEFINE_SIMPLE_ATTRIBUTE(
|
|
||||||
pmgr_voltage_ctrl_fops, pmgr_pwr_devices_get_voltage_u64, NULL, "%llu\n");
|
|
||||||
|
|
||||||
static void pmgr_debugfs_init(struct gk20a *g)
|
|
||||||
{
|
|
||||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
|
||||||
struct dentry *dbgentry;
|
|
||||||
|
|
||||||
dbgentry = debugfs_create_file(
|
|
||||||
"power", S_IRUGO, l->debugfs, g, &pmgr_power_ctrl_fops);
|
|
||||||
if (!dbgentry)
|
|
||||||
nvgpu_err(g, "debugfs entry create failed for power");
|
|
||||||
|
|
||||||
dbgentry = debugfs_create_file(
|
|
||||||
"current", S_IRUGO, l->debugfs, g, &pmgr_current_ctrl_fops);
|
|
||||||
if (!dbgentry)
|
|
||||||
nvgpu_err(g, "debugfs entry create failed for current");
|
|
||||||
|
|
||||||
dbgentry = debugfs_create_file(
|
|
||||||
"voltage", S_IRUGO, l->debugfs, g, &pmgr_voltage_ctrl_fops);
|
|
||||||
if (!dbgentry)
|
|
||||||
nvgpu_err(g, "debugfs entry create failed for voltage");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
u32 pmgr_domain_sw_setup(struct gk20a *g)
|
u32 pmgr_domain_sw_setup(struct gk20a *g)
|
||||||
{
|
{
|
||||||
u32 status;
|
u32 status;
|
||||||
@@ -170,10 +97,6 @@ u32 pmgr_domain_sw_setup(struct gk20a *g)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
|
||||||
pmgr_debugfs_init(g);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user