mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: Add knob to control dbg/prof support
On production boards, there is requirement to disable GPU profiler and debugger support. Add DT property 'support-gpu-tools' which can be modified to enable/disable debugger/profiler support. The default behavior is to enable the debugging features and set 'support-gpu-tools' to 1. This property is chosen to be u32 value to be in sync with GPU vserser property by same name. The debugger/profiler support is disabled by skipping the creation of below nodes under /dev/nvgpu/: 1. ctxsw 2. dbg 3. prof 4. prof-dev 5. prof-ctx Bug 200773450 JIRA NVGPU-7109 Change-Id: I86d72d17fa7f5492e117a4c1cd1144623e9b6132 Signed-off-by: Tejal Kudav <tkudav@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2592012 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
c2901b6835
commit
79ee724b04
@@ -851,6 +851,9 @@ struct gk20a {
|
|||||||
|
|
||||||
/** To enable emulate mode */
|
/** To enable emulate mode */
|
||||||
u32 emulate_mode;
|
u32 emulate_mode;
|
||||||
|
|
||||||
|
/** Flag to check if debugger and profiler support is enabled. */
|
||||||
|
u32 support_gpu_tools;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,6 +49,28 @@ void nvgpu_kernel_restart(void *cmd)
|
|||||||
kernel_restart(cmd);
|
kernel_restart(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nvgpu_read_support_gpu_tools(struct gk20a *g)
|
||||||
|
{
|
||||||
|
struct device_node *np;
|
||||||
|
int ret = 0;
|
||||||
|
u32 val = 0;
|
||||||
|
|
||||||
|
np = nvgpu_get_node(g);
|
||||||
|
ret = of_property_read_u32(np, "support-gpu-tools", &val);
|
||||||
|
if (ret != 0) {
|
||||||
|
nvgpu_info(g, "Missing support-gpu-tools property, ret =%d", ret);
|
||||||
|
/* The debugger/profiler support should be enabled by default.
|
||||||
|
* So, set support_gpu_tools to 1 even if the property is missing. */
|
||||||
|
g->support_gpu_tools = 1;
|
||||||
|
} else {
|
||||||
|
if (val != 0U) {
|
||||||
|
g->support_gpu_tools = 1;
|
||||||
|
} else {
|
||||||
|
g->support_gpu_tools = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void nvgpu_init_vars(struct gk20a *g)
|
static void nvgpu_init_vars(struct gk20a *g)
|
||||||
{
|
{
|
||||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||||
@@ -320,6 +342,11 @@ int nvgpu_probe(struct gk20a *g,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read the DT 'support-gpu-tools' property before creating
|
||||||
|
* user nodes (via gk20a_user_nodes_init().
|
||||||
|
*/
|
||||||
|
nvgpu_read_support_gpu_tools(g);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: While removing the legacy nodes the following condition
|
* TODO: While removing the legacy nodes the following condition
|
||||||
* need to be removed.
|
* need to be removed.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2016-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,
|
||||||
@@ -23,5 +23,6 @@ int nvgpu_probe(struct gk20a *g,
|
|||||||
const char *debugfs_symlink);
|
const char *debugfs_symlink);
|
||||||
|
|
||||||
void nvgpu_init_gk20a(struct gk20a *g);
|
void nvgpu_init_gk20a(struct gk20a *g);
|
||||||
|
void nvgpu_read_support_gpu_tools(struct gk20a *g);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -168,22 +168,24 @@ struct nvgpu_dev_node {
|
|||||||
const struct file_operations *fops;
|
const struct file_operations *fops;
|
||||||
/* If node should be created for physical instance in MIG mode */
|
/* If node should be created for physical instance in MIG mode */
|
||||||
bool mig_physical_node;
|
bool mig_physical_node;
|
||||||
|
/* Flag to check if node is used by debugger/profiler. */
|
||||||
|
bool tools_node;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct nvgpu_dev_node dev_node_list[] = {
|
static const struct nvgpu_dev_node dev_node_list[] = {
|
||||||
{"power", &gk20a_power_node_ops, false },
|
{"power", &gk20a_power_node_ops, false, false },
|
||||||
{"as", &gk20a_as_ops, false },
|
{"as", &gk20a_as_ops, false, false },
|
||||||
{"channel", &gk20a_channel_ops, false },
|
{"channel", &gk20a_channel_ops, false, false },
|
||||||
{"ctrl", &gk20a_ctrl_ops, true },
|
{"ctrl", &gk20a_ctrl_ops, true, false },
|
||||||
#if defined(CONFIG_NVGPU_FECS_TRACE)
|
#if defined(CONFIG_NVGPU_FECS_TRACE)
|
||||||
{"ctxsw", &gk20a_ctxsw_ops, false },
|
{"ctxsw", &gk20a_ctxsw_ops, false, true },
|
||||||
#endif
|
#endif
|
||||||
{"dbg", &gk20a_dbg_ops, false },
|
{"dbg", &gk20a_dbg_ops, false, true },
|
||||||
{"prof", &gk20a_prof_ops, false },
|
{"prof", &gk20a_prof_ops, false, true },
|
||||||
{"prof-ctx", &gk20a_prof_ctx_ops, false },
|
{"prof-ctx", &gk20a_prof_ctx_ops, false, true },
|
||||||
{"prof-dev", &gk20a_prof_dev_ops, false },
|
{"prof-dev", &gk20a_prof_dev_ops, false, true },
|
||||||
{"sched", &gk20a_sched_ops, false },
|
{"sched", &gk20a_sched_ops, false, false },
|
||||||
{"tsg", &gk20a_tsg_ops, false },
|
{"tsg", &gk20a_tsg_ops, false, false },
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *nvgpu_devnode(const char *cdev_name)
|
static char *nvgpu_devnode(const char *cdev_name)
|
||||||
@@ -520,6 +522,12 @@ static bool check_valid_dev_node(struct gk20a *g, struct nvgpu_class *class,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do not create nodes used by GPU tools if support for debugger
|
||||||
|
* and profilers is disabled.
|
||||||
|
*/
|
||||||
|
if ((!g->support_gpu_tools) && (node->tools_node)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -401,6 +401,8 @@ int vgpu_probe(struct platform_device *pdev)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvgpu_read_support_gpu_tools(gk20a);
|
||||||
|
|
||||||
vgpu_init_vars(gk20a, platform);
|
vgpu_init_vars(gk20a, platform);
|
||||||
|
|
||||||
init_rwsem(&l->busy_lock);
|
init_rwsem(&l->busy_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user