diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mc_gk20a.c | 28 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mc_gk20a.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/mc_gm20b.c | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/mc_gp10b.c | 26 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/unit.h | 27 |
6 files changed, 86 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 2ede539e..bd93cc33 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -142,6 +142,8 @@ enum gk20a_cbc_op { | |||
142 | 142 | ||
143 | #define nvgpu_get_litter_value(g, v) (g)->ops.get_litter_value((g), v) | 143 | #define nvgpu_get_litter_value(g, v) (g)->ops.get_litter_value((g), v) |
144 | 144 | ||
145 | enum nvgpu_unit; | ||
146 | |||
145 | struct gpu_ops { | 147 | struct gpu_ops { |
146 | struct { | 148 | struct { |
147 | int (*determine_L2_size_bytes)(struct gk20a *gk20a); | 149 | int (*determine_L2_size_bytes)(struct gk20a *gk20a); |
@@ -851,6 +853,7 @@ struct gpu_ops { | |||
851 | void (*disable)(struct gk20a *g, u32 units); | 853 | void (*disable)(struct gk20a *g, u32 units); |
852 | void (*reset)(struct gk20a *g, u32 units); | 854 | void (*reset)(struct gk20a *g, u32 units); |
853 | u32 (*boot_0)(struct gk20a *g, u32 *arch, u32 *impl, u32 *rev); | 855 | u32 (*boot_0)(struct gk20a *g, u32 *arch, u32 *impl, u32 *rev); |
856 | bool (*is_intr1_pending)(struct gk20a *g, enum nvgpu_unit unit, u32 mc_intr_1); | ||
854 | } mc; | 857 | } mc; |
855 | struct { | 858 | struct { |
856 | void (*show_dump)(struct gk20a *g, | 859 | void (*show_dump)(struct gk20a *g, |
diff --git a/drivers/gpu/nvgpu/gk20a/mc_gk20a.c b/drivers/gpu/nvgpu/gk20a/mc_gk20a.c index bc11b14d..2cdcaaeb 100644 --- a/drivers/gpu/nvgpu/gk20a/mc_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mc_gk20a.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <nvgpu/timers.h> | 21 | #include <nvgpu/timers.h> |
22 | #include <nvgpu/atomic.h> | 22 | #include <nvgpu/atomic.h> |
23 | #include <nvgpu/unit.h> | ||
23 | 24 | ||
24 | #include <nvgpu/hw/gk20a/hw_mc_gk20a.h> | 25 | #include <nvgpu/hw/gk20a/hw_mc_gk20a.h> |
25 | 26 | ||
@@ -134,7 +135,7 @@ void mc_gk20a_intr_thread_nonstall(struct gk20a *g, u32 mc_intr_1) | |||
134 | u32 engine_enum = ENGINE_INVAL_GK20A; | 135 | u32 engine_enum = ENGINE_INVAL_GK20A; |
135 | int ops_old, ops_new, ops = 0; | 136 | int ops_old, ops_new, ops = 0; |
136 | 137 | ||
137 | if (mc_intr_1 & mc_intr_0_pfifo_pending_f()) | 138 | if (g->ops.mc.is_intr1_pending(g, NVGPU_UNIT_FIFO, mc_intr_1)) |
138 | ops |= gk20a_fifo_nonstall_isr(g); | 139 | ops |= gk20a_fifo_nonstall_isr(g); |
139 | 140 | ||
140 | for (engine_id_idx = 0; engine_id_idx < g->fifo.num_engines; | 141 | for (engine_id_idx = 0; engine_id_idx < g->fifo.num_engines; |
@@ -287,6 +288,30 @@ u32 gk20a_mc_boot_0(struct gk20a *g, u32 *arch, u32 *impl, u32 *rev) | |||
287 | return val; | 288 | return val; |
288 | } | 289 | } |
289 | 290 | ||
291 | bool mc_gk20a_is_intr1_pending(struct gk20a *g, | ||
292 | enum nvgpu_unit unit, u32 mc_intr_1) | ||
293 | { | ||
294 | u32 mask = 0; | ||
295 | bool is_pending; | ||
296 | |||
297 | switch (unit) { | ||
298 | case NVGPU_UNIT_FIFO: | ||
299 | mask = mc_intr_0_pfifo_pending_f(); | ||
300 | break; | ||
301 | default: | ||
302 | break; | ||
303 | } | ||
304 | |||
305 | if (mask == 0) { | ||
306 | nvgpu_err(g, "unknown unit %d", unit); | ||
307 | is_pending = false; | ||
308 | } else { | ||
309 | is_pending = (mc_intr_1 & mask) ? true : false; | ||
310 | } | ||
311 | |||
312 | return is_pending; | ||
313 | } | ||
314 | |||
290 | void gk20a_init_mc(struct gpu_ops *gops) | 315 | void gk20a_init_mc(struct gpu_ops *gops) |
291 | { | 316 | { |
292 | gops->mc.intr_enable = mc_gk20a_intr_enable; | 317 | gops->mc.intr_enable = mc_gk20a_intr_enable; |
@@ -302,4 +327,5 @@ void gk20a_init_mc(struct gpu_ops *gops) | |||
302 | gops->mc.disable = gk20a_mc_disable; | 327 | gops->mc.disable = gk20a_mc_disable; |
303 | gops->mc.reset = gk20a_mc_reset; | 328 | gops->mc.reset = gk20a_mc_reset; |
304 | gops->mc.boot_0 = gk20a_mc_boot_0; | 329 | gops->mc.boot_0 = gk20a_mc_boot_0; |
330 | gops->mc.is_intr1_pending = mc_gk20a_is_intr1_pending; | ||
305 | } | 331 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/mc_gk20a.h b/drivers/gpu/nvgpu/gk20a/mc_gk20a.h index 2b4a183e..6c0d159a 100644 --- a/drivers/gpu/nvgpu/gk20a/mc_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mc_gk20a.h | |||
@@ -31,4 +31,6 @@ void gk20a_mc_enable(struct gk20a *g, u32 units); | |||
31 | void gk20a_mc_disable(struct gk20a *g, u32 units); | 31 | void gk20a_mc_disable(struct gk20a *g, u32 units); |
32 | void gk20a_mc_reset(struct gk20a *g, u32 units); | 32 | void gk20a_mc_reset(struct gk20a *g, u32 units); |
33 | u32 gk20a_mc_boot_0(struct gk20a *g, u32 *arch, u32 *impl, u32 *rev); | 33 | u32 gk20a_mc_boot_0(struct gk20a *g, u32 *arch, u32 *impl, u32 *rev); |
34 | bool mc_gk20a_is_intr1_pending(struct gk20a *g, | ||
35 | enum nvgpu_unit unit, u32 mc_intr_1); | ||
34 | #endif | 36 | #endif |
diff --git a/drivers/gpu/nvgpu/gm20b/mc_gm20b.c b/drivers/gpu/nvgpu/gm20b/mc_gm20b.c index ebb9780d..7330a027 100644 --- a/drivers/gpu/nvgpu/gm20b/mc_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/mc_gm20b.c | |||
@@ -32,4 +32,5 @@ void gm20b_init_mc(struct gpu_ops *gops) | |||
32 | gops->mc.disable = gk20a_mc_disable; | 32 | gops->mc.disable = gk20a_mc_disable; |
33 | gops->mc.reset = gk20a_mc_reset; | 33 | gops->mc.reset = gk20a_mc_reset; |
34 | gops->mc.boot_0 = gk20a_mc_boot_0; | 34 | gops->mc.boot_0 = gk20a_mc_boot_0; |
35 | gops->mc.is_intr1_pending = mc_gk20a_is_intr1_pending; | ||
35 | } | 36 | } |
diff --git a/drivers/gpu/nvgpu/gp10b/mc_gp10b.c b/drivers/gpu/nvgpu/gp10b/mc_gp10b.c index bfc7a3d4..7ccea370 100644 --- a/drivers/gpu/nvgpu/gp10b/mc_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/mc_gp10b.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "mc_gp10b.h" | 19 | #include "mc_gp10b.h" |
20 | 20 | ||
21 | #include <nvgpu/atomic.h> | 21 | #include <nvgpu/atomic.h> |
22 | #include <nvgpu/unit.h> | ||
22 | 23 | ||
23 | #include <nvgpu/hw/gp10b/hw_mc_gp10b.h> | 24 | #include <nvgpu/hw/gp10b/hw_mc_gp10b.h> |
24 | 25 | ||
@@ -169,6 +170,30 @@ void mc_gp10b_intr_stall_resume(struct gk20a *g) | |||
169 | g->ops.mc.intr_mask_restore[NVGPU_MC_INTR_STALLING]); | 170 | g->ops.mc.intr_mask_restore[NVGPU_MC_INTR_STALLING]); |
170 | } | 171 | } |
171 | 172 | ||
173 | static bool mc_gp10b_is_intr1_pending(struct gk20a *g, | ||
174 | enum nvgpu_unit unit, u32 mc_intr_1) | ||
175 | { | ||
176 | u32 mask = 0; | ||
177 | bool is_pending; | ||
178 | |||
179 | switch (unit) { | ||
180 | case NVGPU_UNIT_FIFO: | ||
181 | mask = mc_intr_pfifo_pending_f(); | ||
182 | break; | ||
183 | default: | ||
184 | break; | ||
185 | } | ||
186 | |||
187 | if (mask == 0) { | ||
188 | nvgpu_err(g, "unknown unit %d", unit); | ||
189 | is_pending = false; | ||
190 | } else { | ||
191 | is_pending = (mc_intr_1 & mask) ? true : false; | ||
192 | } | ||
193 | |||
194 | return is_pending; | ||
195 | } | ||
196 | |||
172 | void gp10b_init_mc(struct gpu_ops *gops) | 197 | void gp10b_init_mc(struct gpu_ops *gops) |
173 | { | 198 | { |
174 | gops->mc.intr_enable = mc_gp10b_intr_enable; | 199 | gops->mc.intr_enable = mc_gp10b_intr_enable; |
@@ -184,4 +209,5 @@ void gp10b_init_mc(struct gpu_ops *gops) | |||
184 | gops->mc.disable = gk20a_mc_disable; | 209 | gops->mc.disable = gk20a_mc_disable; |
185 | gops->mc.reset = gk20a_mc_reset; | 210 | gops->mc.reset = gk20a_mc_reset; |
186 | gops->mc.boot_0 = gk20a_mc_boot_0; | 211 | gops->mc.boot_0 = gk20a_mc_boot_0; |
212 | gops->mc.is_intr1_pending = mc_gp10b_is_intr1_pending; | ||
187 | } | 213 | } |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/unit.h b/drivers/gpu/nvgpu/include/nvgpu/unit.h new file mode 100644 index 00000000..e209eb59 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/unit.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (c) 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_UNITS_H__ | ||
15 | #define __NVGPU_UNITS_H__ | ||
16 | |||
17 | /* | ||
18 | * Enumeration of all units intended to be used by any HAL that requires | ||
19 | * unit as parameter. | ||
20 | * | ||
21 | * Units are added to the enumeration as needed, so it is not complete. | ||
22 | */ | ||
23 | enum nvgpu_unit { | ||
24 | NVGPU_UNIT_FIFO, | ||
25 | }; | ||
26 | |||
27 | #endif | ||