summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv100/fb_gv100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gv100/fb_gv100.c')
-rw-r--r--drivers/gpu/nvgpu/gv100/fb_gv100.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv100/fb_gv100.c b/drivers/gpu/nvgpu/gv100/fb_gv100.c
new file mode 100644
index 00000000..a3785266
--- /dev/null
+++ b/drivers/gpu/nvgpu/gv100/fb_gv100.c
@@ -0,0 +1,58 @@
1/*
2 * GV100 FB
3 *
4 * Copyright (c) 2017, 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 <nvgpu/types.h>
17
18#include <nvgpu/dma.h>
19#include <nvgpu/log.h>
20#include <nvgpu/enabled.h>
21#include <nvgpu/gmmu.h>
22
23#include "gk20a/gk20a.h"
24#include "gv11b/fb_gv11b.h"
25#include "gv100/fb_gv100.h"
26
27#include <nvgpu/hw/gv100/hw_fb_gv100.h>
28
29#define HW_SCRUB_TIMEOUT_DEFAULT 100 /* usec */
30#define HW_SCRUB_TIMEOUT_MAX 2000000 /* usec */
31
32static void gv100_fb_reset(struct gk20a *g)
33{
34 u32 val;
35 int retries = HW_SCRUB_TIMEOUT_MAX / HW_SCRUB_TIMEOUT_DEFAULT;
36
37 nvgpu_info(g, "reset gv100 fb");
38
39 /* wait for memory to be accessible */
40 do {
41 u32 w = gk20a_readl(g, fb_niso_scrub_status_r());
42 if (fb_niso_scrub_status_flag_v(w)) {
43 nvgpu_info(g, "done");
44 break;
45 }
46 nvgpu_udelay(HW_SCRUB_TIMEOUT_DEFAULT);
47 } while (--retries);
48
49 val = gk20a_readl(g, fb_mmu_priv_level_mask_r());
50 val &= ~fb_mmu_priv_level_mask_write_violation_m();
51 gk20a_writel(g, fb_mmu_priv_level_mask_r(), val);
52}
53
54void gv100_init_fb(struct gpu_ops *gops)
55{
56 gv11b_init_fb(gops);
57 gops->fb.reset = gv100_fb_reset;
58}