summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2014-10-02 08:09:20 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:36 -0400
commit2870a4bcecf93133141aee9f4d9007f0df22cfa8 (patch)
tree4494762e8b0710dc37b318b8d3915f547a0d10af
parent17e4b7ff3f48aca2d258f246a1eef4ed32dd53a2 (diff)
gpu: nvgpu: Add no-op stubs for vgpu
Implement empty or -ENOSYS functions for vgpu if CONFIG_TEGRA_GR_VIRTUALIZATION is not enabled, and remove ifdefs around the calling code. Change-Id: Idc75c9bc486d661786bc222bd9e0380aa7766e78 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/552898 Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c39
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.h61
4 files changed, 75 insertions, 31 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
index cd70d7c3..ca587d00 100644
--- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
@@ -161,9 +161,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
161 struct zbc_entry *zbc_val; 161 struct zbc_entry *zbc_val;
162 struct zbc_query_params *zbc_tbl; 162 struct zbc_query_params *zbc_tbl;
163 int i, err = 0; 163 int i, err = 0;
164#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
165 struct gk20a_platform *platform = platform_get_drvdata(dev); 164 struct gk20a_platform *platform = platform_get_drvdata(dev);
166#endif
167 165
168 gk20a_dbg_fn(""); 166 gk20a_dbg_fn("");
169 167
@@ -225,10 +223,8 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
225 case NVGPU_GPU_IOCTL_ZBC_SET_TABLE: 223 case NVGPU_GPU_IOCTL_ZBC_SET_TABLE:
226 set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf; 224 set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf;
227 225
228#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
229 if (platform->virtual_dev) 226 if (platform->virtual_dev)
230 return -ENOMEM; 227 return -ENOMEM;
231#endif
232 228
233 zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL); 229 zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL);
234 if (zbc_val == NULL) 230 if (zbc_val == NULL)
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index ae108875..b0e8b476 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -59,9 +59,7 @@
59#include "gk20a_scale.h" 59#include "gk20a_scale.h"
60#include "dbg_gpu_gk20a.h" 60#include "dbg_gpu_gk20a.h"
61#include "hal.h" 61#include "hal.h"
62#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
63#include "vgpu/vgpu.h" 62#include "vgpu/vgpu.h"
64#endif
65 63
66#define CREATE_TRACE_POINTS 64#define CREATE_TRACE_POINTS
67#include <trace/events/gk20a.h> 65#include <trace/events/gk20a.h>
@@ -739,21 +737,17 @@ static int gk20a_init_support(struct platform_device *dev)
739static int gk20a_init_client(struct platform_device *dev) 737static int gk20a_init_client(struct platform_device *dev)
740{ 738{
741 struct gk20a *g = get_gk20a(dev); 739 struct gk20a *g = get_gk20a(dev);
740 struct gk20a_platform *platform = gk20a_get_platform(dev);
742 int err; 741 int err;
743 742
744 gk20a_dbg_fn(""); 743 gk20a_dbg_fn("");
745 744
746#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 745 if (platform->virtual_dev) {
747 { 746 err = vgpu_pm_finalize_poweron(&dev->dev);
748 struct gk20a_platform *platform = gk20a_get_platform(dev); 747 if (err)
749 748 return err;
750 if (platform->virtual_dev) {
751 err = vgpu_pm_finalize_poweron(&dev->dev);
752 if (err)
753 return err;
754 }
755 } 749 }
756#endif 750
757#ifndef CONFIG_PM_RUNTIME 751#ifndef CONFIG_PM_RUNTIME
758 gk20a_pm_finalize_poweron(&dev->dev); 752 gk20a_pm_finalize_poweron(&dev->dev);
759#endif 753#endif
@@ -769,17 +763,15 @@ static int gk20a_init_client(struct platform_device *dev)
769 763
770static void gk20a_deinit_client(struct platform_device *dev) 764static void gk20a_deinit_client(struct platform_device *dev)
771{ 765{
766 struct gk20a_platform *platform = gk20a_get_platform(dev);
767
772 gk20a_dbg_fn(""); 768 gk20a_dbg_fn("");
773#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
774 {
775 struct gk20a_platform *platform = gk20a_get_platform(dev);
776 769
777 if (platform->virtual_dev) { 770 if (platform->virtual_dev) {
778 vgpu_pm_prepare_poweroff(&dev->dev); 771 vgpu_pm_prepare_poweroff(&dev->dev);
779 return; 772 return;
780 }
781 } 773 }
782#endif 774
783#ifndef CONFIG_PM_RUNTIME 775#ifndef CONFIG_PM_RUNTIME
784 gk20a_pm_prepare_poweroff(&dev->dev); 776 gk20a_pm_prepare_poweroff(&dev->dev);
785#endif 777#endif
@@ -1442,10 +1434,8 @@ static int gk20a_probe(struct platform_device *dev)
1442 1434
1443 platform_set_drvdata(dev, platform); 1435 platform_set_drvdata(dev, platform);
1444 1436
1445#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
1446 if (platform->virtual_dev) 1437 if (platform->virtual_dev)
1447 return vgpu_probe(dev); 1438 return vgpu_probe(dev);
1448#endif
1449 1439
1450 gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL); 1440 gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL);
1451 if (!gk20a) { 1441 if (!gk20a) {
@@ -1590,15 +1580,12 @@ static int gk20a_probe(struct platform_device *dev)
1590static int __exit gk20a_remove(struct platform_device *dev) 1580static int __exit gk20a_remove(struct platform_device *dev)
1591{ 1581{
1592 struct gk20a *g = get_gk20a(dev); 1582 struct gk20a *g = get_gk20a(dev);
1593#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
1594 struct gk20a_platform *platform = gk20a_get_platform(dev); 1583 struct gk20a_platform *platform = gk20a_get_platform(dev);
1595#endif 1584
1596 gk20a_dbg_fn(""); 1585 gk20a_dbg_fn("");
1597 1586
1598#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
1599 if (platform->virtual_dev) 1587 if (platform->virtual_dev)
1600 return vgpu_remove(dev); 1588 return vgpu_remove(dev);
1601#endif
1602 1589
1603#ifdef CONFIG_INPUT_CFBOOST 1590#ifdef CONFIG_INPUT_CFBOOST
1604 if (g->boost_added) 1591 if (g->boost_added)
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
index e6ed9898..ce0209fb 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
@@ -152,8 +152,8 @@ struct gk20a_platform {
152 */ 152 */
153 void (*dump_platform_dependencies)(struct platform_device *dev); 153 void (*dump_platform_dependencies)(struct platform_device *dev);
154 154
155#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
156 bool virtual_dev; 155 bool virtual_dev;
156#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
157 u64 virt_handle; 157 u64 virt_handle;
158 struct task_struct *intr_handler; 158 struct task_struct *intr_handler;
159#endif 159#endif
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.h b/drivers/gpu/nvgpu/vgpu/vgpu.h
index 445a1c90..972c2107 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.h
@@ -20,6 +20,7 @@
20#include <linux/tegra_vgpu.h> 20#include <linux/tegra_vgpu.h>
21#include "gk20a/gk20a.h" 21#include "gk20a/gk20a.h"
22 22
23#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
23int vgpu_pm_prepare_poweroff(struct device *dev); 24int vgpu_pm_prepare_poweroff(struct device *dev);
24int vgpu_pm_finalize_poweron(struct device *dev); 25int vgpu_pm_finalize_poweron(struct device *dev);
25int vgpu_probe(struct platform_device *dev); 26int vgpu_probe(struct platform_device *dev);
@@ -37,5 +38,65 @@ int vgpu_init_fifo_support(struct gk20a *g);
37int vgpu_get_attribute(u64 handle, u32 attrib, u32 *value); 38int vgpu_get_attribute(u64 handle, u32 attrib, u32 *value);
38int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in, 39int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in,
39 size_t size_out); 40 size_t size_out);
41#else
42static inline int vgpu_pm_prepare_poweroff(struct device *dev)
43{
44 return -ENOSYS;
45}
46static inline int vgpu_pm_finalize_poweron(struct device *dev)
47{
48 return -ENOSYS;
49}
50static inline int vgpu_probe(struct platform_device *dev)
51{
52 return -ENOSYS;
53}
54static inline int vgpu_remove(struct platform_device *dev)
55{
56 return -ENOSYS;
57}
58static inline u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size)
59{
60 return 0;
61}
62static inline int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info)
63{
64 return 0;
65}
66static inline void vgpu_init_fifo_ops(struct gpu_ops *gops)
67{
68}
69static inline void vgpu_init_gr_ops(struct gpu_ops *gops)
70{
71}
72static inline void vgpu_init_ltc_ops(struct gpu_ops *gops)
73{
74}
75static inline void vgpu_init_mm_ops(struct gpu_ops *gops)
76{
77}
78static inline int vgpu_init_mm_support(struct gk20a *g)
79{
80 return -ENOSYS;
81}
82static inline int vgpu_init_gr_support(struct gk20a *g)
83{
84 return -ENOSYS;
85}
86static inline int vgpu_init_fifo_support(struct gk20a *g)
87{
88 return -ENOSYS;
89}
90
91static inline int vgpu_get_attribute(u64 handle, u32 attrib, u32 *value)
92{
93 return -ENOSYS;
94}
95static inline int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in,
96 size_t size_out)
97{
98 return -ENOSYS;
99}
100#endif
40 101
41#endif 102#endif