summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c
new file mode 100644
index 00000000..627ad1a8
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c
@@ -0,0 +1,61 @@
1/*
2 * Virtualized GPU L2
3 *
4 * Copyright (c) 2014-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 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "vgpu.h"
20#include "ltc_vgpu.h"
21
22int vgpu_determine_L2_size_bytes(struct gk20a *g)
23{
24 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
25
26 gk20a_dbg_fn("");
27
28 return priv->constants.l2_size;
29}
30
31int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
32{
33 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
34 u32 max_comptag_lines = 0;
35 int err;
36
37 gk20a_dbg_fn("");
38
39 gr->cacheline_size = priv->constants.cacheline_size;
40 gr->comptags_per_cacheline = priv->constants.comptags_per_cacheline;
41 gr->slices_per_ltc = priv->constants.slices_per_ltc;
42 max_comptag_lines = priv->constants.comptag_lines;
43
44 if (max_comptag_lines < 2)
45 return -ENXIO;
46
47 err = gk20a_comptag_allocator_init(g, &gr->comp_tags, max_comptag_lines);
48 if (err)
49 return err;
50
51 return 0;
52}
53
54void vgpu_ltc_init_fs_state(struct gk20a *g)
55{
56 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
57
58 gk20a_dbg_fn("");
59
60 g->ltc_count = priv->constants.ltc_count;
61}