diff options
author | Richard Zhao <rizhao@nvidia.com> | 2016-07-21 19:51:40 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-08-15 14:41:16 -0400 |
commit | e1438818b90c5b0d73aae800b12bd6b36aec5142 (patch) | |
tree | f0582cda23552526c3067e90f4cb74b461d50d73 /drivers/gpu/nvgpu/vgpu/ltc_vgpu.c | |
parent | 33ff34887f560449828e79170a2a36a97496eeec (diff) |
gpu: nvgpu: vgpu: add vgpu private data and helper functions
Move vgpu private data to a dedicated structure and allocate it
at probe time. Also add virt_handle helper function which is used
everywhere.
JIRA VFND-2103
Change-Id: I125911420be72ca9be948125d8357fa85d1d3afd
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: http://git-master/r/1185206
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.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c index 1adb8b22..3e3f67c6 100644 --- a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c | |||
@@ -17,12 +17,11 @@ | |||
17 | 17 | ||
18 | static int vgpu_determine_L2_size_bytes(struct gk20a *g) | 18 | static int vgpu_determine_L2_size_bytes(struct gk20a *g) |
19 | { | 19 | { |
20 | struct gk20a_platform *platform = gk20a_get_platform(g->dev); | ||
21 | u32 cache_size = 0; | 20 | u32 cache_size = 0; |
22 | 21 | ||
23 | gk20a_dbg_fn(""); | 22 | gk20a_dbg_fn(""); |
24 | 23 | ||
25 | if (vgpu_get_attribute(platform->virt_handle, | 24 | if (vgpu_get_attribute(vgpu_get_handle(g), |
26 | TEGRA_VGPU_ATTRIB_L2_SIZE, &cache_size)) | 25 | TEGRA_VGPU_ATTRIB_L2_SIZE, &cache_size)) |
27 | dev_err(dev_from_gk20a(g), "unable to get L2 size\n"); | 26 | dev_err(dev_from_gk20a(g), "unable to get L2 size\n"); |
28 | 27 | ||
@@ -31,22 +30,21 @@ static int vgpu_determine_L2_size_bytes(struct gk20a *g) | |||
31 | 30 | ||
32 | static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | 31 | static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) |
33 | { | 32 | { |
34 | struct gk20a_platform *platform = gk20a_get_platform(g->dev); | ||
35 | u32 max_comptag_lines = 0; | 33 | u32 max_comptag_lines = 0; |
36 | int err; | 34 | int err; |
37 | 35 | ||
38 | gk20a_dbg_fn(""); | 36 | gk20a_dbg_fn(""); |
39 | 37 | ||
40 | err = vgpu_get_attribute(platform->virt_handle, | 38 | err = vgpu_get_attribute(vgpu_get_handle(g), |
41 | TEGRA_VGPU_ATTRIB_CACHELINE_SIZE, | 39 | TEGRA_VGPU_ATTRIB_CACHELINE_SIZE, |
42 | &gr->cacheline_size); | 40 | &gr->cacheline_size); |
43 | err |= vgpu_get_attribute(platform->virt_handle, | 41 | err |= vgpu_get_attribute(vgpu_get_handle(g), |
44 | TEGRA_VGPU_ATTRIB_COMPTAGS_PER_CACHELINE, | 42 | TEGRA_VGPU_ATTRIB_COMPTAGS_PER_CACHELINE, |
45 | &gr->comptags_per_cacheline); | 43 | &gr->comptags_per_cacheline); |
46 | err |= vgpu_get_attribute(platform->virt_handle, | 44 | err |= vgpu_get_attribute(vgpu_get_handle(g), |
47 | TEGRA_VGPU_ATTRIB_SLICES_PER_LTC, | 45 | TEGRA_VGPU_ATTRIB_SLICES_PER_LTC, |
48 | &gr->slices_per_ltc); | 46 | &gr->slices_per_ltc); |
49 | err |= vgpu_get_attribute(platform->virt_handle, | 47 | err |= vgpu_get_attribute(vgpu_get_handle(g), |
50 | TEGRA_VGPU_ATTRIB_COMPTAG_LINES, &max_comptag_lines); | 48 | TEGRA_VGPU_ATTRIB_COMPTAG_LINES, &max_comptag_lines); |
51 | if (err) { | 49 | if (err) { |
52 | dev_err(dev_from_gk20a(g), "failed to get ctags atributes\n"); | 50 | dev_err(dev_from_gk20a(g), "failed to get ctags atributes\n"); |
@@ -65,13 +63,12 @@ static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | |||
65 | 63 | ||
66 | static void vgpu_ltc_init_fs_state(struct gk20a *g) | 64 | static void vgpu_ltc_init_fs_state(struct gk20a *g) |
67 | { | 65 | { |
68 | struct gk20a_platform *platform = gk20a_get_platform(g->dev); | ||
69 | u32 ltc_count = 0; | 66 | u32 ltc_count = 0; |
70 | int err; | 67 | int err; |
71 | 68 | ||
72 | gk20a_dbg_fn(""); | 69 | gk20a_dbg_fn(""); |
73 | 70 | ||
74 | err = vgpu_get_attribute(platform->virt_handle, | 71 | err = vgpu_get_attribute(vgpu_get_handle(g), |
75 | TEGRA_VGPU_ATTRIB_LTC_COUNT, <c_count); | 72 | TEGRA_VGPU_ATTRIB_LTC_COUNT, <c_count); |
76 | WARN_ON(err); | 73 | WARN_ON(err); |
77 | g->ltc_count = ltc_count; | 74 | g->ltc_count = ltc_count; |