From 2870a4bcecf93133141aee9f4d9007f0df22cfa8 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Thu, 2 Oct 2014 15:09:20 +0300 Subject: 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 Reviewed-on: http://git-master/r/552898 Reviewed-by: Aingara Paramakuru Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 4 --- drivers/gpu/nvgpu/gk20a/gk20a.c | 39 +++++++------------- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 2 +- drivers/gpu/nvgpu/vgpu/vgpu.h | 61 ++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 31 deletions(-) (limited to 'drivers') 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 struct zbc_entry *zbc_val; struct zbc_query_params *zbc_tbl; int i, err = 0; -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION struct gk20a_platform *platform = platform_get_drvdata(dev); -#endif gk20a_dbg_fn(""); @@ -225,10 +223,8 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg case NVGPU_GPU_IOCTL_ZBC_SET_TABLE: set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf; -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION if (platform->virtual_dev) return -ENOMEM; -#endif zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL); 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 @@ #include "gk20a_scale.h" #include "dbg_gpu_gk20a.h" #include "hal.h" -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION #include "vgpu/vgpu.h" -#endif #define CREATE_TRACE_POINTS #include @@ -739,21 +737,17 @@ static int gk20a_init_support(struct platform_device *dev) static int gk20a_init_client(struct platform_device *dev) { struct gk20a *g = get_gk20a(dev); + struct gk20a_platform *platform = gk20a_get_platform(dev); int err; gk20a_dbg_fn(""); -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION - { - struct gk20a_platform *platform = gk20a_get_platform(dev); - - if (platform->virtual_dev) { - err = vgpu_pm_finalize_poweron(&dev->dev); - if (err) - return err; - } + if (platform->virtual_dev) { + err = vgpu_pm_finalize_poweron(&dev->dev); + if (err) + return err; } -#endif + #ifndef CONFIG_PM_RUNTIME gk20a_pm_finalize_poweron(&dev->dev); #endif @@ -769,17 +763,15 @@ static int gk20a_init_client(struct platform_device *dev) static void gk20a_deinit_client(struct platform_device *dev) { + struct gk20a_platform *platform = gk20a_get_platform(dev); + gk20a_dbg_fn(""); -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION - { - struct gk20a_platform *platform = gk20a_get_platform(dev); - if (platform->virtual_dev) { - vgpu_pm_prepare_poweroff(&dev->dev); - return; - } + if (platform->virtual_dev) { + vgpu_pm_prepare_poweroff(&dev->dev); + return; } -#endif + #ifndef CONFIG_PM_RUNTIME gk20a_pm_prepare_poweroff(&dev->dev); #endif @@ -1442,10 +1434,8 @@ static int gk20a_probe(struct platform_device *dev) platform_set_drvdata(dev, platform); -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION if (platform->virtual_dev) return vgpu_probe(dev); -#endif gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL); if (!gk20a) { @@ -1590,15 +1580,12 @@ static int gk20a_probe(struct platform_device *dev) static int __exit gk20a_remove(struct platform_device *dev) { struct gk20a *g = get_gk20a(dev); -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION struct gk20a_platform *platform = gk20a_get_platform(dev); -#endif + gk20a_dbg_fn(""); -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION if (platform->virtual_dev) return vgpu_remove(dev); -#endif #ifdef CONFIG_INPUT_CFBOOST 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 { */ void (*dump_platform_dependencies)(struct platform_device *dev); -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION bool virtual_dev; +#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION u64 virt_handle; struct task_struct *intr_handler; #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 @@ #include #include "gk20a/gk20a.h" +#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION int vgpu_pm_prepare_poweroff(struct device *dev); int vgpu_pm_finalize_poweron(struct device *dev); int vgpu_probe(struct platform_device *dev); @@ -37,5 +38,65 @@ int vgpu_init_fifo_support(struct gk20a *g); int vgpu_get_attribute(u64 handle, u32 attrib, u32 *value); int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in, size_t size_out); +#else +static inline int vgpu_pm_prepare_poweroff(struct device *dev) +{ + return -ENOSYS; +} +static inline int vgpu_pm_finalize_poweron(struct device *dev) +{ + return -ENOSYS; +} +static inline int vgpu_probe(struct platform_device *dev) +{ + return -ENOSYS; +} +static inline int vgpu_remove(struct platform_device *dev) +{ + return -ENOSYS; +} +static inline u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size) +{ + return 0; +} +static inline int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info) +{ + return 0; +} +static inline void vgpu_init_fifo_ops(struct gpu_ops *gops) +{ +} +static inline void vgpu_init_gr_ops(struct gpu_ops *gops) +{ +} +static inline void vgpu_init_ltc_ops(struct gpu_ops *gops) +{ +} +static inline void vgpu_init_mm_ops(struct gpu_ops *gops) +{ +} +static inline int vgpu_init_mm_support(struct gk20a *g) +{ + return -ENOSYS; +} +static inline int vgpu_init_gr_support(struct gk20a *g) +{ + return -ENOSYS; +} +static inline int vgpu_init_fifo_support(struct gk20a *g) +{ + return -ENOSYS; +} + +static inline int vgpu_get_attribute(u64 handle, u32 attrib, u32 *value) +{ + return -ENOSYS; +} +static inline int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in, + size_t size_out) +{ + return -ENOSYS; +} +#endif #endif -- cgit v1.2.2