gpu: nvgpu: print enabled_flags after poweron

GPU enabled_flags indicate features supported by nvgpu.
Add nvgpu_print_enabled() to print GPU enabled_flags. Print flag value
after poweron complete to help during debug.
Add verbose function to print flag name and status if gpu_dbg_info is
set.

JIRA NVGPU-5838

Change-Id: I3b0ddb8c6872f4f3b6101050da087ff553c16f84
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2383531
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2020-07-21 22:38:03 -07:00
committed by Alex Waterman
parent 16d54e83bf
commit ae25924393
3 changed files with 220 additions and 258 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -22,8 +22,46 @@
#include <nvgpu/enabled.h>
#include <nvgpu/bitops.h>
#include <nvgpu/log.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/static_analysis.h>
#include <nvgpu/utils.h>
/**
* Array of flag names
*/
#define DEFINE_FLAG(flag, desc) [flag] = nvgpu_stringify(flag)
static const char *enabled_flag_names[NVGPU_MAX_ENABLED_BITS + 1U] = {
ENABLED_FLAGS
};
#undef DEFINE_FLAG
/**
* Array of flag descriptions
*/
#define DEFINE_FLAG(flag, desc) [flag] = desc
static const char *enabled_flag_desc[NVGPU_MAX_ENABLED_BITS + 1U] = {
ENABLED_FLAGS
};
#undef DEFINE_FLAG
void nvgpu_print_enabled_flags(struct gk20a *g)
{
u32 i;
nvgpu_log(g, gpu_dbg_info, "NVGPU support flags status");
nvgpu_log(g, gpu_dbg_info, "%-55.55s %-6.6s %s",
"Flag", "Status", "Description");
nvgpu_log(g, gpu_dbg_info, "%-55.55s %-6.6s %s",
"----", "------", "-----------");
for (i = 0U; i < U32(NVGPU_MAX_ENABLED_BITS); i++) {
nvgpu_log(g, gpu_dbg_info, "%-55.55s %-6.6s %s",
enabled_flag_names[i],
nvgpu_is_enabled(g, i) ? "true" : "false",
enabled_flag_desc[i]);
}
}
int nvgpu_init_enabled_flags(struct gk20a *g)
{
@@ -32,8 +70,8 @@ int nvgpu_init_enabled_flags(struct gk20a *g)
* can be done so during driver init.
*/
g->enabled_flags = nvgpu_kzalloc(g,
BITS_TO_LONGS(NVGPU_MAX_ENABLED_BITS) *
sizeof(unsigned long));
BITS_TO_LONGS(U32(NVGPU_MAX_ENABLED_BITS)) *
sizeof(unsigned long));
if (g->enabled_flags == NULL) {
return -ENOMEM;
}