summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/intr.c58
-rw-r--r--drivers/gpu/nvgpu/common/linux/intr.h20
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c5
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c7
4 files changed, 84 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/intr.c b/drivers/gpu/nvgpu/common/linux/intr.c
new file mode 100644
index 00000000..77e44dd9
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/linux/intr.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#include <trace/events/gk20a.h>
15
16#include "gk20a/gk20a.h"
17
18#include <nvgpu/atomic.h>
19
20irqreturn_t nvgpu_intr_stall(struct gk20a *g)
21{
22 u32 mc_intr_0;
23
24 trace_mc_gk20a_intr_stall(g->name);
25
26 if (!g->power_on)
27 return IRQ_NONE;
28
29 /* not from gpu when sharing irq with others */
30 mc_intr_0 = g->ops.mc.intr_stall(g);
31 if (unlikely(!mc_intr_0))
32 return IRQ_NONE;
33
34 g->ops.mc.intr_stall_pause(g);
35
36 atomic_inc(&g->hw_irq_stall_count);
37
38 trace_mc_gk20a_intr_stall_done(g->name);
39
40 return IRQ_WAKE_THREAD;
41}
42
43irqreturn_t nvgpu_intr_thread_stall(struct gk20a *g)
44{
45 gk20a_dbg(gpu_dbg_intr, "interrupt thread launched");
46
47 trace_mc_gk20a_intr_thread_stall(g->name);
48
49 g->ops.mc.isr_stall(g);
50 g->ops.mc.intr_stall_resume(g);
51
52 wake_up_all(&g->sw_irq_stall_last_handled_wq);
53
54 trace_mc_gk20a_intr_thread_stall_done(g->name);
55
56 return IRQ_HANDLED;
57}
58
diff --git a/drivers/gpu/nvgpu/common/linux/intr.h b/drivers/gpu/nvgpu/common/linux/intr.h
new file mode 100644
index 00000000..243d8f51
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/linux/intr.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef __NVGPU_LINUX_INTR_H__
15#define __NVGPU_LINUX_INTR_H__
16struct gk20a;
17
18irqreturn_t nvgpu_intr_stall(struct gk20a *g);
19irqreturn_t nvgpu_intr_thread_stall(struct gk20a *g);
20#endif
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index ab99bef0..5e8af065 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -36,6 +36,7 @@
36#include "gk20a/ctxsw_trace_gk20a.h" 36#include "gk20a/ctxsw_trace_gk20a.h"
37#include "pci.h" 37#include "pci.h"
38#include "module.h" 38#include "module.h"
39#include "intr.h"
39#ifdef CONFIG_TEGRA_19x_GPU 40#ifdef CONFIG_TEGRA_19x_GPU
40#include "nvgpu_gpuid_t19x.h" 41#include "nvgpu_gpuid_t19x.h"
41#endif 42#endif
@@ -482,7 +483,7 @@ static irqreturn_t gk20a_intr_isr_stall(int irq, void *dev_id)
482{ 483{
483 struct gk20a *g = dev_id; 484 struct gk20a *g = dev_id;
484 485
485 return g->ops.mc.isr_stall(g); 486 return nvgpu_intr_stall(g);
486} 487}
487 488
488static irqreturn_t gk20a_intr_isr_nonstall(int irq, void *dev_id) 489static irqreturn_t gk20a_intr_isr_nonstall(int irq, void *dev_id)
@@ -496,7 +497,7 @@ static irqreturn_t gk20a_intr_thread_stall(int irq, void *dev_id)
496{ 497{
497 struct gk20a *g = dev_id; 498 struct gk20a *g = dev_id;
498 499
499 return g->ops.mc.isr_thread_stall(g); 500 return nvgpu_intr_thread_stall(g);
500} 501}
501 502
502void gk20a_remove_support(struct gk20a *g) 503void gk20a_remove_support(struct gk20a *g)
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index d729d273..767e9d47 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -25,6 +25,7 @@
25#include "gk20a/platform_gk20a.h" 25#include "gk20a/platform_gk20a.h"
26#include "clk/clk.h" 26#include "clk/clk.h"
27#include "module.h" 27#include "module.h"
28#include "intr.h"
28 29
29#include "pci.h" 30#include "pci.h"
30 31
@@ -232,7 +233,7 @@ static irqreturn_t nvgpu_pci_isr(int irq, void *dev_id)
232 irqreturn_t ret_stall; 233 irqreturn_t ret_stall;
233 irqreturn_t ret_nonstall; 234 irqreturn_t ret_nonstall;
234 235
235 ret_stall = g->ops.mc.isr_stall(g); 236 ret_stall = nvgpu_intr_stall(g);
236 ret_nonstall = g->ops.mc.isr_nonstall(g); 237 ret_nonstall = g->ops.mc.isr_nonstall(g);
237 238
238#if defined(CONFIG_PCI_MSI) 239#if defined(CONFIG_PCI_MSI)
@@ -248,9 +249,7 @@ static irqreturn_t nvgpu_pci_intr_thread(int irq, void *dev_id)
248{ 249{
249 struct gk20a *g = dev_id; 250 struct gk20a *g = dev_id;
250 251
251 g->ops.mc.isr_thread_stall(g); 252 return nvgpu_intr_thread_stall(g);
252
253 return IRQ_HANDLED;
254} 253}
255 254
256static int nvgpu_pci_init_support(struct pci_dev *pdev) 255static int nvgpu_pci_init_support(struct pci_dev *pdev)