diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/ce_gp10b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/ce_gp10b.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/ce_gp10b.c b/drivers/gpu/nvgpu/gp10b/ce_gp10b.c new file mode 100644 index 00000000..86a2b751 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/ce_gp10b.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Pascal GPU series Copy Engine. | ||
3 | * | ||
4 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | |||
25 | #include "gk20a/gk20a.h" | ||
26 | |||
27 | #include "ce_gp10b.h" | ||
28 | |||
29 | #include <nvgpu/hw/gp10b/hw_ce_gp10b.h> | ||
30 | |||
31 | static u32 ce_blockpipe_isr(struct gk20a *g, u32 fifo_intr) | ||
32 | { | ||
33 | gk20a_dbg(gpu_dbg_intr, "ce blocking pipe interrupt\n"); | ||
34 | |||
35 | return ce_intr_status_blockpipe_pending_f(); | ||
36 | } | ||
37 | |||
38 | static u32 ce_launcherr_isr(struct gk20a *g, u32 fifo_intr) | ||
39 | { | ||
40 | gk20a_dbg(gpu_dbg_intr, "ce launch error interrupt\n"); | ||
41 | |||
42 | return ce_intr_status_launcherr_pending_f(); | ||
43 | } | ||
44 | |||
45 | void gp10b_ce_isr(struct gk20a *g, u32 inst_id, u32 pri_base) | ||
46 | { | ||
47 | u32 ce_intr = gk20a_readl(g, ce_intr_status_r(inst_id)); | ||
48 | u32 clear_intr = 0; | ||
49 | |||
50 | gk20a_dbg(gpu_dbg_intr, "ce isr %08x %08x\n", ce_intr, inst_id); | ||
51 | |||
52 | /* clear blocking interrupts: they exibit broken behavior */ | ||
53 | if (ce_intr & ce_intr_status_blockpipe_pending_f()) | ||
54 | clear_intr |= ce_blockpipe_isr(g, ce_intr); | ||
55 | |||
56 | if (ce_intr & ce_intr_status_launcherr_pending_f()) | ||
57 | clear_intr |= ce_launcherr_isr(g, ce_intr); | ||
58 | |||
59 | gk20a_writel(g, ce_intr_status_r(inst_id), clear_intr); | ||
60 | return; | ||
61 | } | ||
62 | |||
63 | int gp10b_ce_nonstall_isr(struct gk20a *g, u32 inst_id, u32 pri_base) | ||
64 | { | ||
65 | int ops = 0; | ||
66 | u32 ce_intr = gk20a_readl(g, ce_intr_status_r(inst_id)); | ||
67 | |||
68 | gk20a_dbg(gpu_dbg_intr, "ce nonstall isr %08x %08x\n", ce_intr, inst_id); | ||
69 | |||
70 | if (ce_intr & ce_intr_status_nonblockpipe_pending_f()) { | ||
71 | gk20a_writel(g, ce_intr_status_r(inst_id), | ||
72 | ce_intr_status_nonblockpipe_pending_f()); | ||
73 | ops |= (gk20a_nonstall_ops_wakeup_semaphore | | ||
74 | gk20a_nonstall_ops_post_events); | ||
75 | } | ||
76 | |||
77 | return ops; | ||
78 | } | ||