summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/gm20b/gr_gm20b.c1
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c2
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.c12
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.h1
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/css_vgpu.c71
-rw-r--r--drivers/gpu/nvgpu/vgpu/css_vgpu.h2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c14
-rw-r--r--drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h1
-rw-r--r--drivers/gpu/nvgpu/vgpu/gm20b/vgpu_hal_gm20b.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c2
11 files changed, 73 insertions, 37 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
index af834b02..a1078b10 100644
--- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
@@ -1130,6 +1130,7 @@ void gr_gm20b_init_cyclestats(struct gk20a *g)
1130 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS; 1130 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS;
1131 g->gpu_characteristics.flags |= 1131 g->gpu_characteristics.flags |=
1132 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS_SNAPSHOT; 1132 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS_SNAPSHOT;
1133 g->gpu_characteristics.max_css_buffer_size = 0xffffffff;
1133#else 1134#else
1134 (void)g; 1135 (void)g;
1135#endif 1136#endif
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index b6f5a4cd..1e81796e 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -289,7 +289,7 @@ static const struct gpu_ops gp106_ops = {
289 .get_max_fbps_count = gr_gm20b_get_max_fbps_count, 289 .get_max_fbps_count = gr_gm20b_get_max_fbps_count,
290 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info, 290 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info,
291 .wait_empty = gr_gp10b_wait_empty, 291 .wait_empty = gr_gp10b_wait_empty,
292 .init_cyclestats = gr_gp10b_init_cyclestats, 292 .init_cyclestats = gr_gm20b_init_cyclestats,
293 .set_sm_debug_mode = gr_gk20a_set_sm_debug_mode, 293 .set_sm_debug_mode = gr_gk20a_set_sm_debug_mode,
294 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs, 294 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs,
295 .bpt_reg_info = gr_gm20b_bpt_reg_info, 295 .bpt_reg_info = gr_gm20b_bpt_reg_info,
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
index 813b8891..a01cfbfa 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
@@ -1615,18 +1615,6 @@ int gr_gp10b_init_fs_state(struct gk20a *g)
1615 return gr_gm20b_init_fs_state(g); 1615 return gr_gm20b_init_fs_state(g);
1616} 1616}
1617 1617
1618void gr_gp10b_init_cyclestats(struct gk20a *g)
1619{
1620#if defined(CONFIG_GK20A_CYCLE_STATS)
1621 g->gpu_characteristics.flags |=
1622 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS;
1623 g->gpu_characteristics.flags |=
1624 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS_SNAPSHOT;
1625#else
1626 (void)g;
1627#endif
1628}
1629
1630void gr_gp10b_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) 1618void gr_gp10b_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index)
1631{ 1619{
1632 nvgpu_tegra_fuse_write_bypass(g, 0x1); 1620 nvgpu_tegra_fuse_write_bypass(g, 0x1);
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
index 9ddc0375..a537f147 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
@@ -115,7 +115,6 @@ void gr_gp10b_commit_global_bundle_cb(struct gk20a *g,
115 struct channel_ctx_gk20a *ch_ctx, 115 struct channel_ctx_gk20a *ch_ctx,
116 u64 addr, u64 size, bool patch); 116 u64 addr, u64 size, bool patch);
117int gr_gp10b_load_smid_config(struct gk20a *g); 117int gr_gp10b_load_smid_config(struct gk20a *g);
118void gr_gp10b_init_cyclestats(struct gk20a *g);
119void gr_gp10b_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index); 118void gr_gp10b_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index);
120void gr_gp10b_get_access_map(struct gk20a *g, 119void gr_gp10b_get_access_map(struct gk20a *g,
121 u32 **whitelist, int *num_entries); 120 u32 **whitelist, int *num_entries);
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index 98e143f0..7b5cc2ac 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -243,7 +243,7 @@ static const struct gpu_ops gp10b_ops = {
243 .get_max_fbps_count = gr_gm20b_get_max_fbps_count, 243 .get_max_fbps_count = gr_gm20b_get_max_fbps_count,
244 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info, 244 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info,
245 .wait_empty = gr_gp10b_wait_empty, 245 .wait_empty = gr_gp10b_wait_empty,
246 .init_cyclestats = gr_gp10b_init_cyclestats, 246 .init_cyclestats = gr_gm20b_init_cyclestats,
247 .set_sm_debug_mode = gr_gk20a_set_sm_debug_mode, 247 .set_sm_debug_mode = gr_gk20a_set_sm_debug_mode,
248 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs, 248 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs,
249 .bpt_reg_info = gr_gm20b_bpt_reg_info, 249 .bpt_reg_info = gr_gm20b_bpt_reg_info,
diff --git a/drivers/gpu/nvgpu/vgpu/css_vgpu.c b/drivers/gpu/nvgpu/vgpu/css_vgpu.c
index bcb01fac..266ce871 100644
--- a/drivers/gpu/nvgpu/vgpu/css_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/css_vgpu.c
@@ -33,39 +33,71 @@
33 33
34static struct tegra_hv_ivm_cookie *css_cookie; 34static struct tegra_hv_ivm_cookie *css_cookie;
35 35
36static int vgpu_css_init_snapshot_buffer(struct gr_gk20a *gr) 36static struct tegra_hv_ivm_cookie *vgpu_css_reserve_mempool(struct gk20a *g)
37{ 37{
38 struct gk20a *g = gr->g;
39 struct device *dev = dev_from_gk20a(g); 38 struct device *dev = dev_from_gk20a(g);
40 struct gk20a_cs_snapshot *data = gr->cs_data;
41 struct device_node *np = dev->of_node; 39 struct device_node *np = dev->of_node;
42 struct of_phandle_args args; 40 struct of_phandle_args args;
43 struct device_node *hv_np; 41 struct device_node *hv_np;
44 void *buf = NULL; 42 struct tegra_hv_ivm_cookie *cookie;
45 u32 mempool; 43 u32 mempool;
46 int err; 44 int err;
47 45
48 gk20a_dbg_fn("");
49
50 if (data->hw_snapshot)
51 return 0;
52
53 err = of_parse_phandle_with_fixed_args(np, 46 err = of_parse_phandle_with_fixed_args(np,
54 "mempool-css", 1, 0, &args); 47 "mempool-css", 1, 0, &args);
55 if (err) { 48 if (err) {
56 nvgpu_info(g, "dt missing mempool-css"); 49 nvgpu_err(g, "dt missing mempool-css");
57 goto fail; 50 return ERR_PTR(err);
58 } 51 }
59 52
60 hv_np = args.np; 53 hv_np = args.np;
61 mempool = args.args[0]; 54 mempool = args.args[0];
62 css_cookie = tegra_hv_mempool_reserve(hv_np, mempool); 55 cookie = tegra_hv_mempool_reserve(hv_np, mempool);
63 if (IS_ERR(css_cookie)) { 56 if (IS_ERR_OR_NULL(cookie)) {
64 nvgpu_info(g, 57 nvgpu_err(g, "mempool %u reserve failed", mempool);
65 "mempool %u reserve failed", mempool); 58 return ERR_PTR(-EINVAL);
66 err = -EINVAL;
67 goto fail;
68 } 59 }
60 return cookie;
61}
62
63u32 vgpu_css_get_buffer_size(struct gk20a *g)
64{
65 struct tegra_hv_ivm_cookie *cookie;
66 u32 size;
67
68 nvgpu_log_fn(g, " ");
69
70 if (css_cookie) {
71 nvgpu_log_info(g, "buffer size = %llu", css_cookie->size);
72 return (u32)css_cookie->size;
73 }
74
75 cookie = vgpu_css_reserve_mempool(g);
76 if (IS_ERR(css_cookie))
77 return 0;
78
79 size = cookie->size;
80
81 tegra_hv_mempool_unreserve(cookie);
82 nvgpu_log_info(g, "buffer size = %u", size);
83 return size;
84}
85
86static int vgpu_css_init_snapshot_buffer(struct gr_gk20a *gr)
87{
88 struct gk20a *g = gr->g;
89 struct gk20a_cs_snapshot *data = gr->cs_data;
90 void *buf = NULL;
91 int err;
92
93 gk20a_dbg_fn("");
94
95 if (data->hw_snapshot)
96 return 0;
97
98 css_cookie = vgpu_css_reserve_mempool(g);
99 if (IS_ERR(css_cookie))
100 return PTR_ERR(css_cookie);
69 101
70 /* Make sure buffer size is large enough */ 102 /* Make sure buffer size is large enough */
71 if (css_cookie->size < CSS_MIN_HW_SNAPSHOT_SIZE) { 103 if (css_cookie->size < CSS_MIN_HW_SNAPSHOT_SIZE) {
@@ -89,8 +121,8 @@ static int vgpu_css_init_snapshot_buffer(struct gr_gk20a *gr)
89 memset(data->hw_snapshot, 0xff, css_cookie->size); 121 memset(data->hw_snapshot, 0xff, css_cookie->size);
90 return 0; 122 return 0;
91fail: 123fail:
92 if (!IS_ERR_OR_NULL(css_cookie)) 124 tegra_hv_mempool_unreserve(css_cookie);
93 tegra_hv_mempool_unreserve(css_cookie); 125 css_cookie = NULL;
94 return err; 126 return err;
95} 127}
96 128
@@ -105,6 +137,7 @@ void vgpu_css_release_snapshot_buffer(struct gr_gk20a *gr)
105 data->hw_snapshot = NULL; 137 data->hw_snapshot = NULL;
106 138
107 tegra_hv_mempool_unreserve(css_cookie); 139 tegra_hv_mempool_unreserve(css_cookie);
140 css_cookie = NULL;
108 141
109 gk20a_dbg_info("cyclestats(vgpu): buffer for snapshots released\n"); 142 gk20a_dbg_info("cyclestats(vgpu): buffer for snapshots released\n");
110} 143}
diff --git a/drivers/gpu/nvgpu/vgpu/css_vgpu.h b/drivers/gpu/nvgpu/vgpu/css_vgpu.h
index b61c9862..8c92d571 100644
--- a/drivers/gpu/nvgpu/vgpu/css_vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/css_vgpu.h
@@ -36,5 +36,5 @@ int vgpu_css_detach(struct channel_gk20a *ch,
36 struct gk20a_cs_snapshot_client *cs_client); 36 struct gk20a_cs_snapshot_client *cs_client);
37int vgpu_css_enable_snapshot_buffer(struct channel_gk20a *ch, 37int vgpu_css_enable_snapshot_buffer(struct channel_gk20a *ch,
38 struct gk20a_cs_snapshot_client *cs_client); 38 struct gk20a_cs_snapshot_client *cs_client);
39 39u32 vgpu_css_get_buffer_size(struct gk20a *g);
40#endif 40#endif
diff --git a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c
index 06962a86..06cc2a4a 100644
--- a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c
+++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c
@@ -21,8 +21,22 @@
21 */ 21 */
22 22
23#include "gk20a/gk20a.h" 23#include "gk20a/gk20a.h"
24#include "gk20a/css_gr_gk20a.h"
25#include "vgpu/css_vgpu.h"
24#include "vgpu_gr_gm20b.h" 26#include "vgpu_gr_gm20b.h"
25 27
28void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g)
29{
30#if defined(CONFIG_GK20A_CYCLE_STATS)
31 g->gpu_characteristics.flags |=
32 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS;
33 g->gpu_characteristics.flags |=
34 NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS_SNAPSHOT;
35 g->gpu_characteristics.max_css_buffer_size =
36 vgpu_css_get_buffer_size(g);
37#endif
38}
39
26int vgpu_gm20b_init_fs_state(struct gk20a *g) 40int vgpu_gm20b_init_fs_state(struct gk20a *g)
27{ 41{
28 struct gr_gk20a *gr = &g->gr; 42 struct gr_gk20a *gr = &g->gr;
diff --git a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h
index 993a8f3d..a0a89579 100644
--- a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h
+++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h
@@ -25,6 +25,7 @@
25 25
26#include "gk20a/gk20a.h" 26#include "gk20a/gk20a.h"
27 27
28void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g);
28int vgpu_gm20b_init_fs_state(struct gk20a *g); 29int vgpu_gm20b_init_fs_state(struct gk20a *g);
29 30
30#endif 31#endif
diff --git a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_hal_gm20b.c b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_hal_gm20b.c
index 38d07ee2..81bcdc21 100644
--- a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_hal_gm20b.c
+++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_hal_gm20b.c
@@ -130,7 +130,7 @@ static const struct gpu_ops vgpu_gm20b_ops = {
130 .get_max_fbps_count = vgpu_gr_get_max_fbps_count, 130 .get_max_fbps_count = vgpu_gr_get_max_fbps_count,
131 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info, 131 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info,
132 .wait_empty = gr_gk20a_wait_idle, 132 .wait_empty = gr_gk20a_wait_idle,
133 .init_cyclestats = gr_gm20b_init_cyclestats, 133 .init_cyclestats = vgpu_gr_gm20b_init_cyclestats,
134 .set_sm_debug_mode = vgpu_gr_set_sm_debug_mode, 134 .set_sm_debug_mode = vgpu_gr_set_sm_debug_mode,
135 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs, 135 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs,
136 .bpt_reg_info = gr_gm20b_bpt_reg_info, 136 .bpt_reg_info = gr_gm20b_bpt_reg_info,
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
index 320aa4a5..04a7349a 100644
--- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
@@ -143,7 +143,7 @@ static const struct gpu_ops vgpu_gp10b_ops = {
143 .get_max_fbps_count = vgpu_gr_get_max_fbps_count, 143 .get_max_fbps_count = vgpu_gr_get_max_fbps_count,
144 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info, 144 .init_sm_dsm_reg_info = gr_gm20b_init_sm_dsm_reg_info,
145 .wait_empty = gr_gp10b_wait_empty, 145 .wait_empty = gr_gp10b_wait_empty,
146 .init_cyclestats = gr_gp10b_init_cyclestats, 146 .init_cyclestats = vgpu_gr_gm20b_init_cyclestats,
147 .set_sm_debug_mode = vgpu_gr_set_sm_debug_mode, 147 .set_sm_debug_mode = vgpu_gr_set_sm_debug_mode,
148 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs, 148 .enable_cde_in_fecs = gr_gm20b_enable_cde_in_fecs,
149 .bpt_reg_info = gr_gm20b_bpt_reg_info, 149 .bpt_reg_info = gr_gm20b_bpt_reg_info,