gpu: nvgpu: debugfs node to enable/disable ltc_illegal_compstat intr

Added debugfs node under ltc directory with name:
intr_illegal_compstat_enable

Enabling/disabling of ltc_illegal_compstat intr is
possible through debugfs node.

Since ltc state is lost with rail gate, this setting is
cached and will be populated during ltc initialization.

Bug 2099406

Change-Id: I4bf62228dfd2bbb94f87f923f9f4f6e5ad0b07f0
Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1774683
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
seshendra Gadagottu
2018-07-09 16:25:40 -07:00
committed by mobile promotions
parent 2c2d9e6671
commit 69be500c0b
10 changed files with 147 additions and 2 deletions

View File

@@ -86,6 +86,7 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
os/linux/debug_hal.o \
os/linux/debug_clk.o \
os/linux/debug_bios.o \
os/linux/debug_ltc.o \
os/linux/debug_xve.o
ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y)

View File

@@ -189,6 +189,7 @@ struct gpu_ops {
void (*isr)(struct gk20a *g);
u32 (*cbc_fix_config)(struct gk20a *g, int base);
void (*flush)(struct gk20a *g);
void (*intr_en_illegal_compstat)(struct gk20a *g, bool enable);
} ltc;
struct {
void (*isr_stall)(struct gk20a *g, u32 inst_id, u32 pri_base);
@@ -1547,6 +1548,8 @@ struct gk20a {
struct gk20a_ce_app ce_app;
bool ltc_intr_en_illegal_compstat;
/* PCI device identifier */
u16 pci_vendor_id, pci_device_id;
u16 pci_subsystem_vendor_id, pci_subsystem_device_id;

View File

@@ -283,6 +283,7 @@ static const struct gpu_ops gv100_ops = {
.cbc_fix_config = NULL,
.flush = gm20b_flush_ltc,
.set_enabled = gp10b_ltc_set_enabled,
.intr_en_illegal_compstat = gv11b_ltc_intr_en_illegal_compstat,
},
.ce2 = {
.isr_stall = gv11b_ce_isr,

View File

@@ -241,6 +241,7 @@ static const struct gpu_ops gv11b_ops = {
.isr = gv11b_ltc_isr,
.flush = gm20b_flush_ltc,
.set_enabled = gp10b_ltc_set_enabled,
.intr_en_illegal_compstat = gv11b_ltc_intr_en_illegal_compstat,
},
.ce2 = {
.isr_stall = gv11b_ce_isr,

View File

@@ -70,10 +70,13 @@ void gv11b_ltc_init_fs_state(struct gk20a *g)
/* Disable LTC interrupts */
reg = gk20a_readl(g, ltc_ltcs_ltss_intr_r());
reg &= ~ltc_ltcs_ltss_intr_en_evicted_cb_m();
reg &= ~ltc_ltcs_ltss_intr_en_illegal_compstat_m();
reg &= ~ltc_ltcs_ltss_intr_en_illegal_compstat_access_m();
nvgpu_writel_check(g, ltc_ltcs_ltss_intr_r(), reg);
if (g->ops.ltc.intr_en_illegal_compstat)
g->ops.ltc.intr_en_illegal_compstat(g,
g->ltc_intr_en_illegal_compstat);
/* Enable ECC interrupts */
ltc_intr = gk20a_readl(g, ltc_ltcs_ltss_intr_r());
ltc_intr |= ltc_ltcs_ltss_intr_en_ecc_sec_error_enabled_f() |
@@ -82,6 +85,24 @@ void gv11b_ltc_init_fs_state(struct gk20a *g)
ltc_intr);
}
void gv11b_ltc_intr_en_illegal_compstat(struct gk20a *g, bool enable)
{
u32 val;
/* disble/enble illegal_compstat interrupt */
val = gk20a_readl(g, ltc_ltcs_ltss_intr_r());
if (enable)
val = set_field(val,
ltc_ltcs_ltss_intr_en_illegal_compstat_m(),
ltc_ltcs_ltss_intr_en_illegal_compstat_enabled_f());
else
val = set_field(val,
ltc_ltcs_ltss_intr_en_illegal_compstat_m(),
ltc_ltcs_ltss_intr_en_illegal_compstat_disabled_f());
gk20a_writel(g, ltc_ltcs_ltss_intr_r(), val);
}
void gv11b_ltc_isr(struct gk20a *g)
{
u32 mc_intr, ltc_intr3;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2016-2018, 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"),
@@ -28,6 +28,7 @@ void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g,
struct zbc_entry *stencil_val,
u32 index);
void gv11b_ltc_init_fs_state(struct gk20a *g);
void gv11b_ltc_intr_en_illegal_compstat(struct gk20a *g, bool enable);
void gv11b_ltc_isr(struct gk20a *g);
#endif

View File

@@ -22,6 +22,7 @@
#include "debug_sched.h"
#include "debug_hal.h"
#include "debug_xve.h"
#include "debug_ltc.h"
#include "debug_bios.h"
#include "os_linux.h"
#include "platform_gk20a.h"
@@ -435,6 +436,7 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE
nvgpu_kmem_debugfs_init(g);
#endif
nvgpu_ltc_debugfs_init(g);
if (g->pci_vendor_id) {
nvgpu_xve_debugfs_init(g);
nvgpu_bios_debugfs_init(g);

View File

@@ -0,0 +1,93 @@
/*
* Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "debug_ltc.h"
#include "os_linux.h"
#include "gk20a/gk20a.h"
#include <linux/debugfs.h>
#include <linux/uaccess.h>
static ssize_t ltc_intr_illegal_compstat_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
char buf[3];
struct gk20a *g = file->private_data;
if (g->ltc_intr_en_illegal_compstat)
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 ltc_intr_illegal_compstat_write(struct file *file,
const char __user *user_buf, size_t count, loff_t *ppos)
{
char buf[3];
int buf_size;
bool intr_illegal_compstat_enabled;
struct gk20a *g = file->private_data;
int err;
if (!g->ops.ltc.intr_en_illegal_compstat)
return -EINVAL;
buf_size = min(count, (sizeof(buf)-1));
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
err = gk20a_busy(g);
if (err)
return err;
if (strtobool(buf, &intr_illegal_compstat_enabled) == 0) {
g->ops.ltc.intr_en_illegal_compstat(g,
intr_illegal_compstat_enabled);
g->ltc_intr_en_illegal_compstat = intr_illegal_compstat_enabled;
}
gk20a_idle(g);
return buf_size;
}
static const struct file_operations ltc_intr_illegal_compstat_fops = {
.open = simple_open,
.read = ltc_intr_illegal_compstat_read,
.write = ltc_intr_illegal_compstat_write,
};
int nvgpu_ltc_debugfs_init(struct gk20a *g)
{
struct dentry *d;
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
struct dentry *gpu_root = l->debugfs;
l->debugfs_ltc = debugfs_create_dir("ltc", gpu_root);
if (IS_ERR_OR_NULL(l->debugfs_ltc))
return -ENODEV;
/* Debug fs node to enable/disable illegal_compstat */
d = debugfs_create_file("intr_illegal_compstat_enable", 0600,
l->debugfs_ltc, g,
&ltc_intr_illegal_compstat_fops);
if (!d)
return -ENOMEM;
return 0;
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __NVGPU_DEBUG_LTC_H__
#define __NVGPU_DEBUG_LTC_H__
struct gk20a;
int nvgpu_ltc_debugfs_init(struct gk20a *g);
#endif /* __NVGPU_DEBUG_LTC_H__ */

View File

@@ -135,6 +135,7 @@ struct nvgpu_os_linux {
struct dentry *debugfs_xve;
struct dentry *debugfs_kmem;
struct dentry *debugfs_hal;
struct dentry *debugfs_ltc;
struct dentry *debugfs_force_preemption_cilp;
struct dentry *debugfs_force_preemption_gfxp;