summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/mc_gp10b.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2014-10-27 09:05:45 -0400
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:52:02 -0500
commit0b50f2a2020c81f00999a8f06a67dde4c214821f (patch)
tree2e438a39e825ee8988c15b8063e477943eee2bf0 /drivers/gpu/nvgpu/gp10b/mc_gp10b.c
parent16c511220ecda4a0220976f649fddabcfbee86e0 (diff)
gpu: nvgpu: Implement gp10b intr processing
Bug 1567274 Change-Id: I2a6cef954b56d1f97208d29584e0748ec1c5e29d Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/591628 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/mc_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/mc_gp10b.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/mc_gp10b.c b/drivers/gpu/nvgpu/gp10b/mc_gp10b.c
new file mode 100644
index 00000000..cdafaf56
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/mc_gp10b.c
@@ -0,0 +1,135 @@
1/*
2 * GP20B master
3 *
4 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include <linux/types.h>
17
18#include "gk20a/gk20a.h"
19#include "mc_gp10b.h"
20#include "hw_mc_gp10b.h"
21
22void mc_gp10b_intr_enable(struct gk20a *g)
23{
24 if (!tegra_platform_is_linsim()) {
25 gk20a_writel(g, mc_intr_en_clear_r(0), 0xffffffff);
26 gk20a_writel(g, mc_intr_en_set_r(0),
27 mc_intr_pfifo_pending_f()
28 | mc_intr_pgraph_pending_f());
29 gk20a_writel(g, mc_intr_en_clear_r(1), 0xffffffff);
30 gk20a_writel(g, mc_intr_en_set_r(1),
31 mc_intr_pfifo_pending_f()
32 | mc_intr_pgraph_pending_f()
33 | mc_intr_priv_ring_pending_f()
34 | mc_intr_ltc_pending_f()
35 | mc_intr_pbus_pending_f());
36 }
37}
38
39irqreturn_t mc_gp10b_isr_stall(struct gk20a *g)
40{
41 u32 mc_intr_0;
42
43 if (!g->power_on)
44 return IRQ_NONE;
45
46 /* not from gpu when sharing irq with others */
47 mc_intr_0 = gk20a_readl(g, mc_intr_r(0));
48 if (unlikely(!mc_intr_0))
49 return IRQ_NONE;
50
51 gk20a_writel(g, mc_intr_en_clear_r(0), 0xffffffff);
52
53 return IRQ_WAKE_THREAD;
54}
55
56irqreturn_t mc_gp10b_isr_nonstall(struct gk20a *g)
57{
58 u32 mc_intr_1;
59
60 if (!g->power_on)
61 return IRQ_NONE;
62
63 /* not from gpu when sharing irq with others */
64 mc_intr_1 = gk20a_readl(g, mc_intr_r(1));
65 if (unlikely(!mc_intr_1))
66 return IRQ_NONE;
67
68 gk20a_writel(g, mc_intr_en_clear_r(1), 0xffffffff);
69
70 return IRQ_WAKE_THREAD;
71}
72
73irqreturn_t mc_gp10b_intr_thread_stall(struct gk20a *g)
74{
75 u32 mc_intr_0;
76
77 gk20a_dbg(gpu_dbg_intr, "interrupt thread launched");
78
79 mc_intr_0 = gk20a_readl(g, mc_intr_r(0));
80
81 gk20a_dbg(gpu_dbg_intr, "stall intr %08x\n", mc_intr_0);
82
83 if (mc_intr_0 & mc_intr_pgraph_pending_f())
84 gr_gk20a_elpg_protected_call(g, gk20a_gr_isr(g));
85 if (mc_intr_0 & mc_intr_pfifo_pending_f())
86 gk20a_fifo_isr(g);
87 if (mc_intr_0 & mc_intr_pmu_pending_f())
88 gk20a_pmu_isr(g);
89 if (mc_intr_0 & mc_intr_priv_ring_pending_f())
90 gk20a_priv_ring_isr(g);
91 if (mc_intr_0 & mc_intr_ltc_pending_f())
92 g->ops.ltc.isr(g);
93 if (mc_intr_0 & mc_intr_pbus_pending_f())
94 gk20a_pbus_isr(g);
95
96 gk20a_writel(g, mc_intr_en_set_r(0),
97 mc_intr_pfifo_pending_f()
98 | mc_intr_pgraph_pending_f());
99
100 return IRQ_HANDLED;
101}
102
103irqreturn_t mc_gp10b_intr_thread_nonstall(struct gk20a *g)
104{
105 u32 mc_intr_1;
106
107 gk20a_dbg(gpu_dbg_intr, "interrupt thread launched");
108
109 mc_intr_1 = gk20a_readl(g, mc_intr_r(1));
110
111 gk20a_dbg(gpu_dbg_intr, "non-stall intr %08x\n", mc_intr_1);
112
113 if (mc_intr_1 & mc_intr_pfifo_pending_f())
114 gk20a_fifo_nonstall_isr(g);
115 if (mc_intr_1 & mc_intr_pgraph_pending_f())
116 gk20a_gr_nonstall_isr(g);
117
118 gk20a_writel(g, mc_intr_en_set_r(1),
119 mc_intr_pfifo_pending_f()
120 | mc_intr_pgraph_pending_f()
121 | mc_intr_priv_ring_pending_f()
122 | mc_intr_ltc_pending_f()
123 | mc_intr_pbus_pending_f());
124
125 return IRQ_HANDLED;
126}
127
128void gp10b_init_mc(struct gpu_ops *gops)
129{
130 gops->mc.intr_enable = mc_gp10b_intr_enable;
131 gops->mc.isr_stall = mc_gp10b_isr_stall;
132 gops->mc.isr_nonstall = mc_gp10b_isr_nonstall;
133 gops->mc.isr_thread_stall = mc_gp10b_intr_thread_stall;
134 gops->mc.isr_thread_nonstall = mc_gp10b_intr_thread_nonstall;
135}