summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/intr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/intr.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/intr.c58
1 files changed, 58 insertions, 0 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