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>
This commit is contained in:
Konsta Holtta
2014-10-02 15:09:20 +03:00
committed by Dan Willemsen
parent 17e4b7ff3f
commit 2870a4bcec
4 changed files with 76 additions and 32 deletions

View File

@@ -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)

View File

@@ -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 <trace/events/gk20a.h>
@@ -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)
{
gk20a_dbg_fn("");
#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
{
struct gk20a_platform *platform = gk20a_get_platform(dev);
struct gk20a_platform *platform = gk20a_get_platform(dev);
if (platform->virtual_dev) {
vgpu_pm_prepare_poweroff(&dev->dev);
return;
}
gk20a_dbg_fn("");
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)

View File

@@ -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

View File

@@ -20,6 +20,7 @@
#include <linux/tegra_vgpu.h>
#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