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/vgpu.h | |
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/vgpu.h')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/vgpu.h | 36 |
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 | |||
25 | struct vgpu_priv_data { | ||
26 | u64 virt_handle; | ||
27 | struct task_struct *intr_handler; | ||
28 | }; | ||
29 | |||
30 | static inline | ||
31 | struct 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 | |||
38 | static 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 | |||
43 | static 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 | |||
55 | static inline u64 vgpu_get_handle(struct gk20a *g) | ||
56 | { | ||
57 | return vgpu_get_handle_from_dev(g->dev); | ||
58 | } | ||
59 | |||
24 | int vgpu_pm_prepare_poweroff(struct device *dev); | 60 | int vgpu_pm_prepare_poweroff(struct device *dev); |
25 | int vgpu_pm_finalize_poweron(struct device *dev); | 61 | int vgpu_pm_finalize_poweron(struct device *dev); |
26 | int vgpu_probe(struct platform_device *dev); | 62 | int vgpu_probe(struct platform_device *dev); |