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:
Tejal Kudav
2021-09-09 10:12:36 +00:00
committed by mobile promotions
parent c2901b6835
commit 79ee724b04
5 changed files with 53 additions and 12 deletions

View File

@@ -49,6 +49,28 @@ void nvgpu_kernel_restart(void *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)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
@@ -320,6 +342,11 @@ int nvgpu_probe(struct gk20a *g,
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
* need to be removed.