From e1438818b90c5b0d73aae800b12bd6b36aec5142 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Thu, 21 Jul 2016 16:51:40 -0700 Subject: 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 Reviewed-on: http://git-master/r/1185206 GVS: Gerrit_Virtual_Submit Reviewed-by: Vladislav Buzov --- drivers/gpu/nvgpu/vgpu/ltc_vgpu.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu/ltc_vgpu.c') 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 @@ static int vgpu_determine_L2_size_bytes(struct gk20a *g) { - struct gk20a_platform *platform = gk20a_get_platform(g->dev); u32 cache_size = 0; gk20a_dbg_fn(""); - if (vgpu_get_attribute(platform->virt_handle, + if (vgpu_get_attribute(vgpu_get_handle(g), TEGRA_VGPU_ATTRIB_L2_SIZE, &cache_size)) dev_err(dev_from_gk20a(g), "unable to get L2 size\n"); @@ -31,22 +30,21 @@ static int vgpu_determine_L2_size_bytes(struct gk20a *g) static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) { - struct gk20a_platform *platform = gk20a_get_platform(g->dev); u32 max_comptag_lines = 0; int err; gk20a_dbg_fn(""); - err = vgpu_get_attribute(platform->virt_handle, + err = vgpu_get_attribute(vgpu_get_handle(g), TEGRA_VGPU_ATTRIB_CACHELINE_SIZE, &gr->cacheline_size); - err |= vgpu_get_attribute(platform->virt_handle, + err |= vgpu_get_attribute(vgpu_get_handle(g), TEGRA_VGPU_ATTRIB_COMPTAGS_PER_CACHELINE, &gr->comptags_per_cacheline); - err |= vgpu_get_attribute(platform->virt_handle, + err |= vgpu_get_attribute(vgpu_get_handle(g), TEGRA_VGPU_ATTRIB_SLICES_PER_LTC, &gr->slices_per_ltc); - err |= vgpu_get_attribute(platform->virt_handle, + err |= vgpu_get_attribute(vgpu_get_handle(g), TEGRA_VGPU_ATTRIB_COMPTAG_LINES, &max_comptag_lines); if (err) { 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) static void vgpu_ltc_init_fs_state(struct gk20a *g) { - struct gk20a_platform *platform = gk20a_get_platform(g->dev); u32 ltc_count = 0; int err; gk20a_dbg_fn(""); - err = vgpu_get_attribute(platform->virt_handle, + err = vgpu_get_attribute(vgpu_get_handle(g), TEGRA_VGPU_ATTRIB_LTC_COUNT, <c_count); WARN_ON(err); g->ltc_count = ltc_count; -- cgit v1.2.2