summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/vgpu.h
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2016-07-21 19:51:40 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-08-15 14:41:16 -0400
commite1438818b90c5b0d73aae800b12bd6b36aec5142 (patch)
treef0582cda23552526c3067e90f4cb74b461d50d73 /drivers/gpu/nvgpu/vgpu/vgpu.h
parent33ff34887f560449828e79170a2a36a97496eeec (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/vgpu.h')
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.h b/drivers/gpu/nvgpu/vgpu/vgpu.h
index f79c8aab..e1fff966 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.h
@@ -21,6 +21,42 @@
21#include "gk20a/gk20a.h" 21#include "gk20a/gk20a.h"
22 22
23#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 23#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
24
25struct vgpu_priv_data {
26 u64 virt_handle;
27 struct task_struct *intr_handler;
28};
29
30static inline
31struct vgpu_priv_data *vgpu_get_priv_data_from_dev(struct device *dev)
32{
33 struct gk20a_platform *plat = gk20a_get_platform(dev);
34
35 return (struct vgpu_priv_data *)plat->vgpu_priv;
36}
37
38static inline struct vgpu_priv_data *vgpu_get_priv_data(struct gk20a *g)
39{
40 return vgpu_get_priv_data_from_dev(g->dev);
41}
42
43static inline u64 vgpu_get_handle_from_dev(struct device *dev)
44{
45 struct vgpu_priv_data *priv = vgpu_get_priv_data_from_dev(dev);
46
47 if (unlikely(!priv)) {
48 dev_err(dev, "invalid vgpu_priv_data in %s\n", __func__);
49 return INT_MAX;
50 }
51
52 return priv->virt_handle;
53}
54
55static inline u64 vgpu_get_handle(struct gk20a *g)
56{
57 return vgpu_get_handle_from_dev(g->dev);
58}
59
24int vgpu_pm_prepare_poweroff(struct device *dev); 60int vgpu_pm_prepare_poweroff(struct device *dev);
25int vgpu_pm_finalize_poweron(struct device *dev); 61int vgpu_pm_finalize_poweron(struct device *dev);
26int vgpu_probe(struct platform_device *dev); 62int vgpu_probe(struct platform_device *dev);