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/linux/vgpu/gm20b/vgpu_gr_gm20b.c23
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h3
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_hal_gm20b.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c65
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h4
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c6
7 files changed, 78 insertions, 35 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c
index 260ce080..fc39b3f5 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -40,24 +40,3 @@ void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g)
40#endif 40#endif
41} 41}
42 42
43int vgpu_gm20b_init_fs_state(struct gk20a *g)
44{
45 struct gr_gk20a *gr = &g->gr;
46 u32 tpc_index, gpc_index;
47 u32 sm_id = 0;
48
49 gk20a_dbg_fn("");
50
51 for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) {
52 for (tpc_index = 0; tpc_index < gr->gpc_tpc_count[gpc_index];
53 tpc_index++) {
54 g->gr.sm_to_cluster[sm_id].tpc_index = tpc_index;
55 g->gr.sm_to_cluster[sm_id].gpc_index = gpc_index;
56
57 sm_id++;
58 }
59 }
60
61 gr->no_of_sm = sm_id;
62 return 0;
63}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h
index f17de450..77b83cbe 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -20,6 +20,5 @@
20#include "gk20a/gk20a.h" 20#include "gk20a/gk20a.h"
21 21
22void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g); 22void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g);
23int vgpu_gm20b_init_fs_state(struct gk20a *g);
24 23
25#endif 24#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_hal_gm20b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_hal_gm20b.c
index 74fa65f3..eeeccf62 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_hal_gm20b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_hal_gm20b.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -92,7 +92,7 @@ static const struct gpu_ops vgpu_gm20b_ops = {
92 .is_valid_compute_class = gr_gm20b_is_valid_compute_class, 92 .is_valid_compute_class = gr_gm20b_is_valid_compute_class,
93 .get_sm_dsm_perf_regs = gr_gm20b_get_sm_dsm_perf_regs, 93 .get_sm_dsm_perf_regs = gr_gm20b_get_sm_dsm_perf_regs,
94 .get_sm_dsm_perf_ctrl_regs = gr_gm20b_get_sm_dsm_perf_ctrl_regs, 94 .get_sm_dsm_perf_ctrl_regs = gr_gm20b_get_sm_dsm_perf_ctrl_regs,
95 .init_fs_state = vgpu_gm20b_init_fs_state, 95 .init_fs_state = vgpu_gr_init_fs_state,
96 .set_hww_esr_report_mask = gr_gm20b_set_hww_esr_report_mask, 96 .set_hww_esr_report_mask = gr_gm20b_set_hww_esr_report_mask,
97 .falcon_load_ucode = gr_gm20b_load_ctxsw_ucode_segments, 97 .falcon_load_ucode = gr_gm20b_load_ctxsw_ucode_segments,
98 .load_ctxsw_ucode = gr_gk20a_load_ctxsw_ucode, 98 .load_ctxsw_ucode = gr_gk20a_load_ctxsw_ucode,
@@ -145,7 +145,7 @@ static const struct gpu_ops vgpu_gm20b_ops = {
145 .suspend_contexts = vgpu_gr_suspend_contexts, 145 .suspend_contexts = vgpu_gr_suspend_contexts,
146 .resume_contexts = vgpu_gr_resume_contexts, 146 .resume_contexts = vgpu_gr_resume_contexts,
147 .get_preemption_mode_flags = gr_gm20b_get_preemption_mode_flags, 147 .get_preemption_mode_flags = gr_gm20b_get_preemption_mode_flags,
148 .init_sm_id_table = gr_gk20a_init_sm_id_table, 148 .init_sm_id_table = vgpu_gr_init_sm_id_table,
149 .load_smid_config = gr_gm20b_load_smid_config, 149 .load_smid_config = gr_gm20b_load_smid_config,
150 .program_sm_id_numbering = gr_gm20b_program_sm_id_numbering, 150 .program_sm_id_numbering = gr_gm20b_program_sm_id_numbering,
151 .is_ltcs_ltss_addr = gr_gm20b_is_ltcs_ltss_addr, 151 .is_ltcs_ltss_addr = gr_gm20b_is_ltcs_ltss_addr,
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
index 66ef6e00..aa520690 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -106,7 +106,7 @@ static const struct gpu_ops vgpu_gp10b_ops = {
106 .is_valid_compute_class = gr_gp10b_is_valid_compute_class, 106 .is_valid_compute_class = gr_gp10b_is_valid_compute_class,
107 .get_sm_dsm_perf_regs = gr_gm20b_get_sm_dsm_perf_regs, 107 .get_sm_dsm_perf_regs = gr_gm20b_get_sm_dsm_perf_regs,
108 .get_sm_dsm_perf_ctrl_regs = gr_gm20b_get_sm_dsm_perf_ctrl_regs, 108 .get_sm_dsm_perf_ctrl_regs = gr_gm20b_get_sm_dsm_perf_ctrl_regs,
109 .init_fs_state = vgpu_gm20b_init_fs_state, 109 .init_fs_state = vgpu_gr_init_fs_state,
110 .set_hww_esr_report_mask = gr_gm20b_set_hww_esr_report_mask, 110 .set_hww_esr_report_mask = gr_gm20b_set_hww_esr_report_mask,
111 .falcon_load_ucode = gr_gm20b_load_ctxsw_ucode_segments, 111 .falcon_load_ucode = gr_gm20b_load_ctxsw_ucode_segments,
112 .load_ctxsw_ucode = gr_gk20a_load_ctxsw_ucode, 112 .load_ctxsw_ucode = gr_gk20a_load_ctxsw_ucode,
@@ -159,7 +159,7 @@ static const struct gpu_ops vgpu_gp10b_ops = {
159 .suspend_contexts = vgpu_gr_suspend_contexts, 159 .suspend_contexts = vgpu_gr_suspend_contexts,
160 .resume_contexts = vgpu_gr_resume_contexts, 160 .resume_contexts = vgpu_gr_resume_contexts,
161 .get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags, 161 .get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags,
162 .init_sm_id_table = gr_gk20a_init_sm_id_table, 162 .init_sm_id_table = vgpu_gr_init_sm_id_table,
163 .load_smid_config = gr_gp10b_load_smid_config, 163 .load_smid_config = gr_gp10b_load_smid_config,
164 .program_sm_id_numbering = gr_gm20b_program_sm_id_numbering, 164 .program_sm_id_numbering = gr_gm20b_program_sm_id_numbering,
165 .is_ltcs_ltss_addr = gr_gm20b_is_ltcs_ltss_addr, 165 .is_ltcs_ltss_addr = gr_gm20b_is_ltcs_ltss_addr,
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
index fa2010cd..a0662956 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Graphics 2 * Virtualized GPU Graphics
3 * 3 *
4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 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, 7 * under the terms and conditions of the GNU General Public License,
@@ -610,6 +610,7 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
610{ 610{
611 struct vgpu_priv_data *priv = vgpu_get_priv_data(g); 611 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
612 u32 gpc_index; 612 u32 gpc_index;
613 u32 sm_per_tpc;
613 int err = -ENOMEM; 614 int err = -ENOMEM;
614 615
615 gk20a_dbg_fn(""); 616 gk20a_dbg_fn("");
@@ -628,8 +629,10 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
628 if (!gr->gpc_tpc_mask) 629 if (!gr->gpc_tpc_mask)
629 goto cleanup; 630 goto cleanup;
630 631
632 sm_per_tpc = priv->constants.sm_per_tpc;
631 gr->sm_to_cluster = nvgpu_kzalloc(g, gr->gpc_count * 633 gr->sm_to_cluster = nvgpu_kzalloc(g, gr->gpc_count *
632 gr->max_tpc_per_gpc_count * 634 gr->max_tpc_per_gpc_count *
635 sm_per_tpc *
633 sizeof(struct sm_info)); 636 sizeof(struct sm_info));
634 if (!gr->sm_to_cluster) 637 if (!gr->sm_to_cluster)
635 goto cleanup; 638 goto cleanup;
@@ -1215,3 +1218,63 @@ void vgpu_gr_handle_sm_esr_event(struct gk20a *g,
1215 1218
1216 nvgpu_mutex_release(&g->dbg_sessions_lock); 1219 nvgpu_mutex_release(&g->dbg_sessions_lock);
1217} 1220}
1221
1222int vgpu_gr_init_sm_id_table(struct gk20a *g)
1223{
1224 struct tegra_vgpu_cmd_msg msg = {};
1225 struct tegra_vgpu_vsms_mapping_params *p = &msg.params.vsms_mapping;
1226 struct tegra_vgpu_vsms_mapping_entry *entry;
1227 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
1228 struct sm_info *sm_info;
1229 int err;
1230 struct gr_gk20a *gr = &g->gr;
1231 size_t oob_size;
1232 void *handle = NULL;
1233 u32 sm_id;
1234 u32 max_sm;
1235
1236 msg.cmd = TEGRA_VGPU_CMD_GET_VSMS_MAPPING;
1237 msg.handle = vgpu_get_handle(g);
1238 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
1239 err = err ? err : msg.ret;
1240 if (err) {
1241 nvgpu_err(g, "get vsms mapping failed err %d", err);
1242 return err;
1243 }
1244
1245 handle = tegra_gr_comm_oob_get_ptr(TEGRA_GR_COMM_CTX_CLIENT,
1246 tegra_gr_comm_get_server_vmid(),
1247 TEGRA_VGPU_QUEUE_CMD,
1248 (void **)&entry, &oob_size);
1249 if (!handle)
1250 return -EINVAL;
1251
1252 max_sm = gr->gpc_count *
1253 gr->max_tpc_per_gpc_count *
1254 priv->constants.sm_per_tpc;
1255 if (p->num_sm > max_sm)
1256 return -EINVAL;
1257
1258 if ((p->num_sm * sizeof(*entry)) > oob_size)
1259 return -EINVAL;
1260
1261 gr->no_of_sm = p->num_sm;
1262 for (sm_id = 0; sm_id < p->num_sm; sm_id++, entry++) {
1263 sm_info = &gr->sm_to_cluster[sm_id];
1264 sm_info->tpc_index = entry->tpc_index;
1265 sm_info->gpc_index = entry->gpc_index;
1266 sm_info->sm_index = entry->sm_index;
1267 sm_info->global_tpc_index = entry->global_tpc_index;
1268 }
1269 tegra_gr_comm_oob_put_ptr(handle);
1270
1271 return 0;
1272}
1273
1274int vgpu_gr_init_fs_state(struct gk20a *g)
1275{
1276 if (!g->ops.gr.init_sm_id_table)
1277 return -EINVAL;
1278
1279 return g->ops.gr.init_sm_id_table(g);
1280}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h
index 7815201e..16aa92a9 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -60,5 +60,7 @@ int vgpu_gr_resume_contexts(struct gk20a *g,
60 struct dbg_session_gk20a *dbg_s, 60 struct dbg_session_gk20a *dbg_s,
61 int *ctx_resident_ch_fd); 61 int *ctx_resident_ch_fd);
62int vgpu_gr_commit_inst(struct channel_gk20a *c, u64 gpu_va); 62int vgpu_gr_commit_inst(struct channel_gk20a *c, u64 gpu_va);
63int vgpu_gr_init_sm_id_table(struct gk20a *g);
64int vgpu_gr_init_fs_state(struct gk20a *g);
63 65
64#endif 66#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
index 1523c2de..6f85b4ee 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -126,7 +126,7 @@ static const struct gpu_ops vgpu_gv11b_ops = {
126 .is_valid_compute_class = gr_gv11b_is_valid_compute_class, 126 .is_valid_compute_class = gr_gv11b_is_valid_compute_class,
127 .get_sm_dsm_perf_regs = gv11b_gr_get_sm_dsm_perf_regs, 127 .get_sm_dsm_perf_regs = gv11b_gr_get_sm_dsm_perf_regs,
128 .get_sm_dsm_perf_ctrl_regs = gv11b_gr_get_sm_dsm_perf_ctrl_regs, 128 .get_sm_dsm_perf_ctrl_regs = gv11b_gr_get_sm_dsm_perf_ctrl_regs,
129 .init_fs_state = vgpu_gm20b_init_fs_state, 129 .init_fs_state = vgpu_gr_init_fs_state,
130 .set_hww_esr_report_mask = gv11b_gr_set_hww_esr_report_mask, 130 .set_hww_esr_report_mask = gv11b_gr_set_hww_esr_report_mask,
131 .falcon_load_ucode = gr_gm20b_load_ctxsw_ucode_segments, 131 .falcon_load_ucode = gr_gm20b_load_ctxsw_ucode_segments,
132 .load_ctxsw_ucode = gr_gk20a_load_ctxsw_ucode, 132 .load_ctxsw_ucode = gr_gk20a_load_ctxsw_ucode,
@@ -179,7 +179,7 @@ static const struct gpu_ops vgpu_gv11b_ops = {
179 .suspend_contexts = vgpu_gr_suspend_contexts, 179 .suspend_contexts = vgpu_gr_suspend_contexts,
180 .resume_contexts = vgpu_gr_resume_contexts, 180 .resume_contexts = vgpu_gr_resume_contexts,
181 .get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags, 181 .get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags,
182 .init_sm_id_table = gr_gv100_init_sm_id_table, 182 .init_sm_id_table = vgpu_gr_init_sm_id_table,
183 .load_smid_config = gr_gv11b_load_smid_config, 183 .load_smid_config = gr_gv11b_load_smid_config,
184 .program_sm_id_numbering = gr_gv11b_program_sm_id_numbering, 184 .program_sm_id_numbering = gr_gv11b_program_sm_id_numbering,
185 .is_ltcs_ltss_addr = gr_gm20b_is_ltcs_ltss_addr, 185 .is_ltcs_ltss_addr = gr_gm20b_is_ltcs_ltss_addr,