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/fb/fb_gv100.c4
-rw-r--r--drivers/gpu/nvgpu/common/fb/fb_gv11b.c1
-rw-r--r--drivers/gpu/nvgpu/common/mc/mc_gm20b.c49
-rw-r--r--drivers/gpu/nvgpu/common/mc/mc_gm20b.h3
-rw-r--r--drivers/gpu/nvgpu/common/mc/mc_gv100.c34
-rw-r--r--drivers/gpu/nvgpu/common/mc/mc_gv100.h2
6 files changed, 90 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/fb/fb_gv100.c b/drivers/gpu/nvgpu/common/fb/fb_gv100.c
index 3bfac676..1088ca90 100644
--- a/drivers/gpu/nvgpu/common/fb/fb_gv100.c
+++ b/drivers/gpu/nvgpu/common/fb/fb_gv100.c
@@ -39,11 +39,11 @@
39#include <nvgpu/utils.h> 39#include <nvgpu/utils.h>
40#include <nvgpu/timers.h> 40#include <nvgpu/timers.h>
41#include <nvgpu/gk20a.h> 41#include <nvgpu/gk20a.h>
42#include <nvgpu/unit.h>
42 43
43#include "fb_gv100.h" 44#include "fb_gv100.h"
44 45
45#include <nvgpu/hw/gv100/hw_fb_gv100.h> 46#include <nvgpu/hw/gv100/hw_fb_gv100.h>
46#include <nvgpu/hw/gv100/hw_mc_gv100.h>
47 47
48#define HW_SCRUB_TIMEOUT_DEFAULT 100 /* usec */ 48#define HW_SCRUB_TIMEOUT_DEFAULT 100 /* usec */
49#define HW_SCRUB_TIMEOUT_MAX 2000000 /* usec */ 49#define HW_SCRUB_TIMEOUT_MAX 2000000 /* usec */
@@ -160,7 +160,7 @@ int gv100_fb_memory_unlock(struct gk20a *g)
160 } 160 }
161 161
162 /* Enable nvdec */ 162 /* Enable nvdec */
163 g->ops.mc.enable(g, mc_enable_nvdec_enabled_f()); 163 g->ops.mc.enable(g, g->ops.mc.reset_mask(g, NVGPU_UNIT_NVDEC));
164 164
165 /* nvdec falcon reset */ 165 /* nvdec falcon reset */
166 nvgpu_flcn_reset(&g->nvdec_flcn); 166 nvgpu_flcn_reset(&g->nvdec_flcn);
diff --git a/drivers/gpu/nvgpu/common/fb/fb_gv11b.c b/drivers/gpu/nvgpu/common/fb/fb_gv11b.c
index a03c7da7..75968ba6 100644
--- a/drivers/gpu/nvgpu/common/fb/fb_gv11b.c
+++ b/drivers/gpu/nvgpu/common/fb/fb_gv11b.c
@@ -46,7 +46,6 @@
46#include "fb_gv11b.h" 46#include "fb_gv11b.h"
47 47
48#include <nvgpu/hw/gv11b/hw_fb_gv11b.h> 48#include <nvgpu/hw/gv11b/hw_fb_gv11b.h>
49#include <nvgpu/hw/gv11b/hw_mc_gv11b.h>
50#include <nvgpu/hw/gv11b/hw_gmmu_gv11b.h> 49#include <nvgpu/hw/gv11b/hw_gmmu_gv11b.h>
51 50
52static int gv11b_fb_fix_page_fault(struct gk20a *g, 51static int gv11b_fb_fix_page_fault(struct gk20a *g,
diff --git a/drivers/gpu/nvgpu/common/mc/mc_gm20b.c b/drivers/gpu/nvgpu/common/mc/mc_gm20b.c
index c4e682ec..1194be85 100644
--- a/drivers/gpu/nvgpu/common/mc/mc_gm20b.c
+++ b/drivers/gpu/nvgpu/common/mc/mc_gm20b.c
@@ -28,6 +28,7 @@
28#include <nvgpu/io.h> 28#include <nvgpu/io.h>
29#include <nvgpu/mc.h> 29#include <nvgpu/mc.h>
30#include <nvgpu/gk20a.h> 30#include <nvgpu/gk20a.h>
31#include <nvgpu/bug.h>
31 32
32#include "mc_gm20b.h" 33#include "mc_gm20b.h"
33 34
@@ -292,3 +293,51 @@ void gm20b_mc_log_pending_intrs(struct gk20a *g)
292 } 293 }
293} 294}
294 295
296u32 gm20b_mc_reset_mask(struct gk20a *g, enum nvgpu_unit unit)
297{
298 u32 mask = 0;
299
300 switch(unit) {
301 case NVGPU_UNIT_FIFO:
302 mask = mc_enable_pfifo_enabled_f();
303 break;
304 case NVGPU_UNIT_PERFMON:
305 mask = mc_enable_perfmon_enabled_f();
306 break;
307 case NVGPU_UNIT_GRAPH:
308 mask = mc_enable_pgraph_enabled_f();
309 break;
310 case NVGPU_UNIT_BLG:
311 mask = mc_enable_blg_enabled_f();
312 break;
313 case NVGPU_UNIT_PWR:
314 mask = mc_enable_pwr_enabled_f();
315 break;
316 default:
317 nvgpu_err(g, "unknown reset unit %d", unit);
318 BUG();
319 break;
320 }
321
322 return mask;
323}
324
325bool gm20b_mc_is_enabled(struct gk20a *g, enum nvgpu_unit unit)
326{
327 u32 mask = g->ops.mc.reset_mask(g, unit);
328
329 return (nvgpu_readl(g, mc_enable_r()) & mask) != 0U;
330}
331
332void gm20b_mc_fb_reset(struct gk20a *g)
333{
334 u32 val;
335
336 nvgpu_log_info(g, "reset gk20a fb");
337
338 val = gk20a_readl(g, mc_elpg_enable_r());
339 val |= mc_elpg_enable_xbar_enabled_f()
340 | mc_elpg_enable_pfb_enabled_f()
341 | mc_elpg_enable_hub_enabled_f();
342 gk20a_writel(g, mc_elpg_enable_r(), val);
343}
diff --git a/drivers/gpu/nvgpu/common/mc/mc_gm20b.h b/drivers/gpu/nvgpu/common/mc/mc_gm20b.h
index 6700a48c..fcf02077 100644
--- a/drivers/gpu/nvgpu/common/mc/mc_gm20b.h
+++ b/drivers/gpu/nvgpu/common/mc/mc_gm20b.h
@@ -47,5 +47,8 @@ bool gm20b_mc_is_intr1_pending(struct gk20a *g,
47 enum nvgpu_unit unit, u32 mc_intr_1); 47 enum nvgpu_unit unit, u32 mc_intr_1);
48void gm20b_mc_log_pending_intrs(struct gk20a *g); 48void gm20b_mc_log_pending_intrs(struct gk20a *g);
49void gm20b_mc_handle_intr_nonstall(struct gk20a *g, u32 ops); 49void gm20b_mc_handle_intr_nonstall(struct gk20a *g, u32 ops);
50u32 gm20b_mc_reset_mask(struct gk20a *g, enum nvgpu_unit unit);
51bool gm20b_mc_is_enabled(struct gk20a *g, enum nvgpu_unit unit);
52void gm20b_mc_fb_reset(struct gk20a *g);
50 53
51#endif /* NVGPU_MC_GM20B_H */ 54#endif /* NVGPU_MC_GM20B_H */
diff --git a/drivers/gpu/nvgpu/common/mc/mc_gv100.c b/drivers/gpu/nvgpu/common/mc/mc_gv100.c
index b67f9bbe..77155d14 100644
--- a/drivers/gpu/nvgpu/common/mc/mc_gv100.c
+++ b/drivers/gpu/nvgpu/common/mc/mc_gv100.c
@@ -26,6 +26,8 @@
26#include <nvgpu/io.h> 26#include <nvgpu/io.h>
27#include <nvgpu/mc.h> 27#include <nvgpu/mc.h>
28#include <nvgpu/gk20a.h> 28#include <nvgpu/gk20a.h>
29#include <nvgpu/unit.h>
30#include <nvgpu/bug.h>
29 31
30#include "mc_gp10b.h" 32#include "mc_gp10b.h"
31#include "mc_gv100.h" 33#include "mc_gv100.h"
@@ -88,3 +90,35 @@ bool gv100_mc_is_stall_and_eng_intr_pending(struct gk20a *g, u32 act_eng_id,
88 90
89 return (mc_intr_0 & (eng_intr_mask | stall_intr)) != 0U; 91 return (mc_intr_0 & (eng_intr_mask | stall_intr)) != 0U;
90} 92}
93
94u32 gv100_mc_reset_mask(struct gk20a *g, enum nvgpu_unit unit)
95{
96 u32 mask = 0;
97
98 switch(unit) {
99 case NVGPU_UNIT_FIFO:
100 mask = mc_enable_pfifo_enabled_f();
101 break;
102 case NVGPU_UNIT_PERFMON:
103 mask = mc_enable_perfmon_enabled_f();
104 break;
105 case NVGPU_UNIT_GRAPH:
106 mask = mc_enable_pgraph_enabled_f();
107 break;
108 case NVGPU_UNIT_BLG:
109 mask = mc_enable_blg_enabled_f();
110 break;
111 case NVGPU_UNIT_PWR:
112 mask = mc_enable_pwr_enabled_f();
113 break;
114 case NVGPU_UNIT_NVDEC:
115 mask = mc_enable_nvdec_enabled_f();
116 break;
117 default:
118 nvgpu_err(g, "unknown reset unit %d", unit);
119 BUG();
120 break;
121 }
122
123 return mask;
124}
diff --git a/drivers/gpu/nvgpu/common/mc/mc_gv100.h b/drivers/gpu/nvgpu/common/mc/mc_gv100.h
index c0a16ad9..764d59b1 100644
--- a/drivers/gpu/nvgpu/common/mc/mc_gv100.h
+++ b/drivers/gpu/nvgpu/common/mc/mc_gv100.h
@@ -31,4 +31,6 @@ void mc_gv100_intr_enable(struct gk20a *g);
31bool gv100_mc_is_intr_nvlink_pending(struct gk20a *g, u32 mc_intr_0); 31bool gv100_mc_is_intr_nvlink_pending(struct gk20a *g, u32 mc_intr_0);
32bool gv100_mc_is_stall_and_eng_intr_pending(struct gk20a *g, u32 act_eng_id, 32bool gv100_mc_is_stall_and_eng_intr_pending(struct gk20a *g, u32 act_eng_id,
33 u32 *eng_intr_pending); 33 u32 *eng_intr_pending);
34u32 gv100_mc_reset_mask(struct gk20a *g, enum nvgpu_unit unit);
35
34#endif 36#endif