summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2016-07-25 14:19:21 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-08-15 14:41:21 -0400
commit233862859a759b14353d743c0bce7d0df18e49ca (patch)
tree11bf4894ec20d9fc67e3842269b48e748261a8ef /drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
parent47fe8460e96413c10ec84261895418d6b59bc690 (diff)
gpu: nvgpu: vgpu: add getting ltc constants
move below attributes to constants: TEGRA_VGPU_ATTRIB_COMPTAG_LINES TEGRA_VGPU_ATTRIB_L2_SIZE TEGRA_VGPU_ATTRIB_CACHELINE_SIZE TEGRA_VGPU_ATTRIB_COMPTAGS_PER_CACHELINE TEGRA_VGPU_ATTRIB_SLICES_PER_LTC TEGRA_VGPU_ATTRIB_LTC_COUNT JIRA VFND-2103 Change-Id: Iecf9717ee553a16ffe8de445be5bfe5a99c3a094 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: http://git-master/r/1190480 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Vladislav Buzov <vbuzov@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/ltc_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/ltc_vgpu.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
index 3e3f67c6..dc4d47cb 100644
--- a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
@@ -17,39 +17,25 @@
17 17
18static int vgpu_determine_L2_size_bytes(struct gk20a *g) 18static int vgpu_determine_L2_size_bytes(struct gk20a *g)
19{ 19{
20 u32 cache_size = 0; 20 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
21 21
22 gk20a_dbg_fn(""); 22 gk20a_dbg_fn("");
23 23
24 if (vgpu_get_attribute(vgpu_get_handle(g), 24 return priv->constants.l2_size;
25 TEGRA_VGPU_ATTRIB_L2_SIZE, &cache_size))
26 dev_err(dev_from_gk20a(g), "unable to get L2 size\n");
27
28 return cache_size;
29} 25}
30 26
31static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) 27static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
32{ 28{
29 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
33 u32 max_comptag_lines = 0; 30 u32 max_comptag_lines = 0;
34 int err; 31 int err;
35 32
36 gk20a_dbg_fn(""); 33 gk20a_dbg_fn("");
37 34
38 err = vgpu_get_attribute(vgpu_get_handle(g), 35 gr->cacheline_size = priv->constants.cacheline_size;
39 TEGRA_VGPU_ATTRIB_CACHELINE_SIZE, 36 gr->comptags_per_cacheline = priv->constants.comptags_per_cacheline;
40 &gr->cacheline_size); 37 gr->slices_per_ltc = priv->constants.slices_per_ltc;
41 err |= vgpu_get_attribute(vgpu_get_handle(g), 38 max_comptag_lines = priv->constants.comptag_lines;
42 TEGRA_VGPU_ATTRIB_COMPTAGS_PER_CACHELINE,
43 &gr->comptags_per_cacheline);
44 err |= vgpu_get_attribute(vgpu_get_handle(g),
45 TEGRA_VGPU_ATTRIB_SLICES_PER_LTC,
46 &gr->slices_per_ltc);
47 err |= vgpu_get_attribute(vgpu_get_handle(g),
48 TEGRA_VGPU_ATTRIB_COMPTAG_LINES, &max_comptag_lines);
49 if (err) {
50 dev_err(dev_from_gk20a(g), "failed to get ctags atributes\n");
51 return -ENXIO;
52 }
53 39
54 if (max_comptag_lines < 2) 40 if (max_comptag_lines < 2)
55 return -ENXIO; 41 return -ENXIO;
@@ -63,15 +49,11 @@ static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
63 49
64static void vgpu_ltc_init_fs_state(struct gk20a *g) 50static void vgpu_ltc_init_fs_state(struct gk20a *g)
65{ 51{
66 u32 ltc_count = 0; 52 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
67 int err;
68 53
69 gk20a_dbg_fn(""); 54 gk20a_dbg_fn("");
70 55
71 err = vgpu_get_attribute(vgpu_get_handle(g), 56 g->ltc_count = priv->constants.ltc_count;
72 TEGRA_VGPU_ATTRIB_LTC_COUNT, &ltc_count);
73 WARN_ON(err);
74 g->ltc_count = ltc_count;
75} 57}
76 58
77void vgpu_init_ltc_ops(struct gpu_ops *gops) 59void vgpu_init_ltc_ops(struct gpu_ops *gops)