summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Fleury <tfleury@nvidia.com>2018-06-07 17:55:03 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-06-27 10:30:06 -0400
commitc60d8b7520bf14b6002ac93e7a205ff05913ab88 (patch)
tree9e8bb79c4fefaee40dfcdcd092db90ade3b9f0a2 /drivers
parentce5bd347aa43eac519f3f8670c4a8baab0ee4abc (diff)
gpu: nvgpu: add bios debugfs node
Add bios debugfs node to get current VBIOS version. Bug 2113607 Change-Id: I8d52b651f923080000a4ad529e7efa05667563ba Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1743030 Reviewed-by: Richard Zhao <rizhao@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/Makefile1
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug.c5
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug_bios.c60
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug_bios.h21
4 files changed, 86 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index 42d9855f..faf17a91 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -78,6 +78,7 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
78 os/linux/debug_allocator.o \ 78 os/linux/debug_allocator.o \
79 os/linux/debug_hal.o \ 79 os/linux/debug_hal.o \
80 os/linux/debug_clk.o \ 80 os/linux/debug_clk.o \
81 os/linux/debug_bios.o \
81 os/linux/debug_xve.o 82 os/linux/debug_xve.o
82 83
83ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y) 84ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y)
diff --git a/drivers/gpu/nvgpu/os/linux/debug.c b/drivers/gpu/nvgpu/os/linux/debug.c
index 8738f3e7..c4dae9e6 100644
--- a/drivers/gpu/nvgpu/os/linux/debug.c
+++ b/drivers/gpu/nvgpu/os/linux/debug.c
@@ -22,6 +22,7 @@
22#include "debug_sched.h" 22#include "debug_sched.h"
23#include "debug_hal.h" 23#include "debug_hal.h"
24#include "debug_xve.h" 24#include "debug_xve.h"
25#include "debug_bios.h"
25#include "os_linux.h" 26#include "os_linux.h"
26#include "platform_gk20a.h" 27#include "platform_gk20a.h"
27 28
@@ -434,8 +435,10 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
434#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE 435#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE
435 nvgpu_kmem_debugfs_init(g); 436 nvgpu_kmem_debugfs_init(g);
436#endif 437#endif
437 if (g->pci_vendor_id) 438 if (g->pci_vendor_id) {
438 nvgpu_xve_debugfs_init(g); 439 nvgpu_xve_debugfs_init(g);
440 nvgpu_bios_debugfs_init(g);
441 }
439} 442}
440 443
441void gk20a_debug_deinit(struct gk20a *g) 444void gk20a_debug_deinit(struct gk20a *g)
diff --git a/drivers/gpu/nvgpu/os/linux/debug_bios.c b/drivers/gpu/nvgpu/os/linux/debug_bios.c
new file mode 100644
index 00000000..f69ccf38
--- /dev/null
+++ b/drivers/gpu/nvgpu/os/linux/debug_bios.c
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#include <nvgpu/types.h>
16
17#include "debug_bios.h"
18#include "os_linux.h"
19
20#include <linux/debugfs.h>
21#include <linux/uaccess.h>
22
23static int bios_version_show(struct seq_file *s, void *unused)
24{
25 struct gk20a *g = s->private;
26
27 seq_printf(s, "Version %02x.%02x.%02x.%02x.%02x\n",
28 (g->bios.vbios_version >> 24) & 0xFF,
29 (g->bios.vbios_version >> 16) & 0xFF,
30 (g->bios.vbios_version >> 8) & 0xFF,
31 (g->bios.vbios_version >> 0) & 0xFF,
32 (g->bios.vbios_oem_version) & 0xFF);
33
34 return 0;
35}
36
37static int bios_version_open(struct inode *inode, struct file *file)
38{
39 return single_open(file, bios_version_show, inode->i_private);
40}
41
42static const struct file_operations bios_version_fops = {
43 .open = bios_version_open,
44 .read = seq_read,
45 .llseek = seq_lseek,
46 .release = single_release,
47};
48
49
50int nvgpu_bios_debugfs_init(struct gk20a *g)
51{
52 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
53 struct dentry *gpu_root = l->debugfs;
54
55 debugfs_create_file("bios", S_IRUGO,
56 gpu_root, g,
57 &bios_version_fops);
58
59 return 0;
60}
diff --git a/drivers/gpu/nvgpu/os/linux/debug_bios.h b/drivers/gpu/nvgpu/os/linux/debug_bios.h
new file mode 100644
index 00000000..f8e7783c
--- /dev/null
+++ b/drivers/gpu/nvgpu/os/linux/debug_bios.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef __NVGPU_DEBUG_BIOS_H__
16#define __NVGPU_DEBUG_BIOS_H__
17
18struct gk20a;
19int nvgpu_bios_debugfs_init(struct gk20a *g);
20
21#endif /* __NVGPU_DEBUG_BIOS_H__ */