summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/ltc_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/ltc_vgpu.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
index 211e34b5..199e880b 100644
--- a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU L2 2 * Virtualized GPU L2
3 * 3 *
4 * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015 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,
@@ -24,7 +24,7 @@ static int vgpu_determine_L2_size_bytes(struct gk20a *g)
24 24
25 if (vgpu_get_attribute(platform->virt_handle, 25 if (vgpu_get_attribute(platform->virt_handle,
26 TEGRA_VGPU_ATTRIB_L2_SIZE, &cache_size)) 26 TEGRA_VGPU_ATTRIB_L2_SIZE, &cache_size))
27 dev_err(dev_from_gk20a(g), "unable to get L2 size"); 27 dev_err(dev_from_gk20a(g), "unable to get L2 size\n");
28 28
29 return cache_size; 29 return cache_size;
30} 30}
@@ -33,11 +33,26 @@ static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
33{ 33{
34 struct gk20a_platform *platform = gk20a_get_platform(g->dev); 34 struct gk20a_platform *platform = gk20a_get_platform(g->dev);
35 u32 max_comptag_lines = 0; 35 u32 max_comptag_lines = 0;
36 int err;
36 37
37 gk20a_dbg_fn(""); 38 gk20a_dbg_fn("");
38 39
39 vgpu_get_attribute(platform->virt_handle, 40 err = vgpu_get_attribute(platform->virt_handle,
41 TEGRA_VGPU_ATTRIB_CACHELINE_SIZE,
42 &gr->cacheline_size);
43 err |= vgpu_get_attribute(platform->virt_handle,
44 TEGRA_VGPU_ATTRIB_COMPTAGS_PER_CACHELINE,
45 &gr->comptags_per_cacheline);
46 err |= vgpu_get_attribute(platform->virt_handle,
47 TEGRA_VGPU_ATTRIB_SLICES_PER_LTC,
48 &gr->slices_per_ltc);
49 err |= vgpu_get_attribute(platform->virt_handle,
40 TEGRA_VGPU_ATTRIB_COMPTAG_LINES, &max_comptag_lines); 50 TEGRA_VGPU_ATTRIB_COMPTAG_LINES, &max_comptag_lines);
51 if (err) {
52 dev_err(dev_from_gk20a(g), "failed to get ctags atributes\n");
53 return -ENXIO;
54 }
55
41 if (max_comptag_lines < 2) 56 if (max_comptag_lines < 2)
42 return -ENXIO; 57 return -ENXIO;
43 58
@@ -46,8 +61,23 @@ static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
46 return 0; 61 return 0;
47} 62}
48 63
64static void vgpu_ltc_init_fs_state(struct gk20a *g)
65{
66 struct gk20a_platform *platform = gk20a_get_platform(g->dev);
67 u32 ltc_count = 0;
68 int err;
69
70 gk20a_dbg_fn("");
71
72 err = vgpu_get_attribute(platform->virt_handle,
73 TEGRA_VGPU_ATTRIB_LTC_COUNT, &ltc_count);
74 WARN_ON(err);
75 g->ltc_count = ltc_count;
76}
77
49void vgpu_init_ltc_ops(struct gpu_ops *gops) 78void vgpu_init_ltc_ops(struct gpu_ops *gops)
50{ 79{
51 gops->ltc.determine_L2_size_bytes = vgpu_determine_L2_size_bytes; 80 gops->ltc.determine_L2_size_bytes = vgpu_determine_L2_size_bytes;
52 gops->ltc.init_comptags = vgpu_ltc_init_comptags; 81 gops->ltc.init_comptags = vgpu_ltc_init_comptags;
82 gops->ltc.init_fs_state = vgpu_ltc_init_fs_state;
53} 83}