mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: unify nvgpu_has_syncpoints
- move nvgpu_has_syncpoints to common code and only checks flag NVGPU_HAS_SYNCPOINTS - the debugfs node disable_syncpoints also enable/disable the flag NVGPU_HAS_SYNCPOINTS Jira GVSCI-10881 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Change-Id: I8dc5dd17ad404238203a048abf49ff2b434fce11 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2542738 Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
68e11c8bd3
commit
2845f2b66e
@@ -24,6 +24,7 @@
|
|||||||
#define NVGPU_NVHOST_H
|
#define NVGPU_NVHOST_H
|
||||||
|
|
||||||
#include <nvgpu/types.h>
|
#include <nvgpu/types.h>
|
||||||
|
#include <nvgpu/enabled.h>
|
||||||
|
|
||||||
struct gk20a;
|
struct gk20a;
|
||||||
#define NVGPU_INVALID_SYNCPT_ID (~U32(0U))
|
#define NVGPU_INVALID_SYNCPT_ID (~U32(0U))
|
||||||
@@ -87,7 +88,10 @@ void nvgpu_free_nvhost_dev(struct gk20a *g);
|
|||||||
* @retval TRUE For syncpoint support.
|
* @retval TRUE For syncpoint support.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool nvgpu_has_syncpoints(struct gk20a *g);
|
static inline bool nvgpu_has_syncpoints(struct gk20a *g)
|
||||||
|
{
|
||||||
|
return nvgpu_is_enabled(g, NVGPU_HAS_SYNCPOINTS);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
|
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -384,6 +384,48 @@ static const struct file_operations dbg_tsg_timeslice_max_fops = {
|
|||||||
.write = dbg_tsg_timeslice_max_write,
|
.write = dbg_tsg_timeslice_max_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ssize_t disable_syncpts_read(struct file *file,
|
||||||
|
char __user *user_buf, size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
char buf[3];
|
||||||
|
struct gk20a *g = file->private_data;
|
||||||
|
|
||||||
|
if (!nvgpu_is_enabled(g, NVGPU_HAS_SYNCPOINTS))
|
||||||
|
buf[0] = 'Y';
|
||||||
|
else
|
||||||
|
buf[0] = 'N';
|
||||||
|
buf[1] = '\n';
|
||||||
|
buf[2] = 0x00;
|
||||||
|
return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t disable_syncpts_write(struct file *file,
|
||||||
|
const char __user *user_buf, size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
char buf[3];
|
||||||
|
int buf_size;
|
||||||
|
bool disable_syncpts;
|
||||||
|
struct gk20a *g = file->private_data;
|
||||||
|
|
||||||
|
buf_size = min(count, (sizeof(buf)-1));
|
||||||
|
if (copy_from_user(buf, user_buf, buf_size))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
if (!g->nvhost)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
if (strtobool(buf, &disable_syncpts) == 0)
|
||||||
|
nvgpu_set_enabled(g, NVGPU_HAS_SYNCPOINTS, !disable_syncpts);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations disable_syncpts_fops = {
|
||||||
|
.open = simple_open,
|
||||||
|
.read = disable_syncpts_read,
|
||||||
|
.write = disable_syncpts_write,
|
||||||
|
};
|
||||||
|
|
||||||
void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
|
void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
|
||||||
{
|
{
|
||||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||||
@@ -408,8 +450,13 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
|
|||||||
debugfs_create_u32("ch_wdt_init_limit_ms", S_IRUGO|S_IWUSR,
|
debugfs_create_u32("ch_wdt_init_limit_ms", S_IRUGO|S_IWUSR,
|
||||||
l->debugfs, &g->ch_wdt_init_limit_ms);
|
l->debugfs, &g->ch_wdt_init_limit_ms);
|
||||||
|
|
||||||
debugfs_create_bool("disable_syncpoints", S_IRUGO|S_IWUSR,
|
l->debugfs_disable_syncpts =
|
||||||
l->debugfs, &l->disable_syncpoints);
|
debugfs_create_file("disable_syncpoints",
|
||||||
|
S_IRUGO|S_IWUSR,
|
||||||
|
l->debugfs,
|
||||||
|
g,
|
||||||
|
&disable_syncpts_fops);
|
||||||
|
|
||||||
debugfs_create_bool("enable_platform_dbg", S_IRUGO|S_IWUSR,
|
debugfs_create_bool("enable_platform_dbg", S_IRUGO|S_IWUSR,
|
||||||
l->debugfs, &l->enable_platform_dbg);
|
l->debugfs, &l->enable_platform_dbg);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -41,14 +41,6 @@ void nvgpu_free_nvhost_dev(struct gk20a *g)
|
|||||||
nvgpu_kfree(g, g->nvhost);
|
nvgpu_kfree(g, g->nvhost);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nvgpu_has_syncpoints(struct gk20a *g)
|
|
||||||
{
|
|
||||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
|
||||||
|
|
||||||
return nvgpu_is_enabled(g, NVGPU_HAS_SYNCPOINTS) &&
|
|
||||||
!l->disable_syncpoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nvgpu_nvhost_create_symlink(struct gk20a *g)
|
int nvgpu_nvhost_create_symlink(struct gk20a *g)
|
||||||
{
|
{
|
||||||
struct device *dev = dev_from_gk20a(g);
|
struct device *dev = dev_from_gk20a(g);
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ struct nvgpu_os_linux {
|
|||||||
struct dentry *debugfs_timeouts_enabled;
|
struct dentry *debugfs_timeouts_enabled;
|
||||||
struct dentry *debugfs_disable_bigpage;
|
struct dentry *debugfs_disable_bigpage;
|
||||||
struct dentry *debugfs_dbg_tsg_timeslice_max_us;
|
struct dentry *debugfs_dbg_tsg_timeslice_max_us;
|
||||||
|
struct dentry *debugfs_disable_syncpts;
|
||||||
|
|
||||||
struct dentry *debugfs_runlist_interleave;
|
struct dentry *debugfs_runlist_interleave;
|
||||||
struct dentry *debugfs_allocators;
|
struct dentry *debugfs_allocators;
|
||||||
@@ -135,8 +136,6 @@ struct nvgpu_os_linux {
|
|||||||
|
|
||||||
bool init_done;
|
bool init_done;
|
||||||
|
|
||||||
/** Debugfs knob for forcing syncpt support off in runtime. */
|
|
||||||
bool disable_syncpoints;
|
|
||||||
bool enable_platform_dbg;
|
bool enable_platform_dbg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -497,7 +497,6 @@ nvgpu_gr_subctx_alloc
|
|||||||
nvgpu_gr_subctx_free
|
nvgpu_gr_subctx_free
|
||||||
nvgpu_gr_suspend
|
nvgpu_gr_suspend
|
||||||
nvgpu_gr_sw_ready
|
nvgpu_gr_sw_ready
|
||||||
nvgpu_has_syncpoints
|
|
||||||
nvgpu_init_enabled_flags
|
nvgpu_init_enabled_flags
|
||||||
nvgpu_init_errata_flags
|
nvgpu_init_errata_flags
|
||||||
nvgpu_init_hal
|
nvgpu_init_hal
|
||||||
|
|||||||
@@ -513,7 +513,6 @@ nvgpu_gr_subctx_alloc
|
|||||||
nvgpu_gr_subctx_free
|
nvgpu_gr_subctx_free
|
||||||
nvgpu_gr_suspend
|
nvgpu_gr_suspend
|
||||||
nvgpu_gr_sw_ready
|
nvgpu_gr_sw_ready
|
||||||
nvgpu_has_syncpoints
|
|
||||||
nvgpu_init_enabled_flags
|
nvgpu_init_enabled_flags
|
||||||
nvgpu_init_errata_flags
|
nvgpu_init_errata_flags
|
||||||
nvgpu_init_fb_support
|
nvgpu_init_fb_support
|
||||||
|
|||||||
Reference in New Issue
Block a user