diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index ae169a1db..418b7ea34 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -163,23 +163,34 @@ nvgpu-$(CONFIG_GK20A_PCI) += common/linux/pci.o \
nvgpu-$(CONFIG_TEGRA_GK20A_NVHOST) += common/linux/nvhost.o
nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
+ vgpu/ltc_vgpu.o \
+ vgpu/gr_vgpu.o \
+ vgpu/fifo_vgpu.o \
+ vgpu/ce2_vgpu.o \
+ vgpu/mm_vgpu.o \
+ vgpu/vgpu.o \
+ vgpu/dbg_vgpu.o \
+ vgpu/tsg_vgpu.o \
+ vgpu/gm20b/vgpu_gr_gm20b.o \
+ vgpu/gp10b/vgpu_hal_gp10b.o \
+ vgpu/gp10b/vgpu_gr_gp10b.o \
+ vgpu/gp10b/vgpu_fuse_gp10b.o \
+ vgpu/gp10b/vgpu_mm_gp10b.o \
+ vgpu/gv11b/vgpu_gv11b.o \
+ vgpu/gv11b/vgpu_hal_gv11b.o \
+ vgpu/gv11b/vgpu_gr_gv11b.o \
+ vgpu/gv11b/vgpu_fifo_gv11b.o \
+ vgpu/gv11b/vgpu_subctx_gv11b.o \
+ vgpu/gv11b/vgpu_tsg_gv11b.o \
common/linux/vgpu/platform_vgpu_tegra.o \
- common/linux/vgpu/ltc_vgpu.o \
- common/linux/vgpu/gr_vgpu.o \
- common/linux/vgpu/fifo_vgpu.o \
- common/linux/vgpu/ce2_vgpu.o \
- common/linux/vgpu/mm_vgpu.o \
- common/linux/vgpu/vgpu.o \
- common/linux/vgpu/dbg_vgpu.o \
common/linux/vgpu/fecs_trace_vgpu.o \
- common/linux/vgpu/tsg_vgpu.o \
common/linux/vgpu/clk_vgpu.o \
common/linux/vgpu/css_vgpu.o \
- common/linux/vgpu/gm20b/vgpu_gr_gm20b.o \
common/linux/vgpu/sysfs_vgpu.o \
common/linux/vgpu/vgpu_ivc.o \
common/linux/vgpu/vgpu_ivm.o \
- common/linux/vgpu/vgpu_linux.o
+ common/linux/vgpu/vgpu_linux.o \
+ common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.o
nvgpu-$(CONFIG_COMMON_CLK) += \
common/linux/clk.o
@@ -287,22 +298,6 @@ nvgpu-y += \
lpwr/rppg.o \
lpwr/lpwr.o
-
-nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
- common/linux/vgpu/gp10b/vgpu_hal_gp10b.o \
- common/linux/vgpu/gp10b/vgpu_gr_gp10b.o \
- common/linux/vgpu/gp10b/vgpu_fuse_gp10b.o \
- common/linux/vgpu/gp10b/vgpu_mm_gp10b.o
-
-nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
- common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.o \
- common/linux/vgpu/gv11b/vgpu_gv11b.o \
- common/linux/vgpu/gv11b/vgpu_hal_gv11b.o \
- common/linux/vgpu/gv11b/vgpu_gr_gv11b.o \
- common/linux/vgpu/gv11b/vgpu_fifo_gv11b.o \
- common/linux/vgpu/gv11b/vgpu_subctx_gv11b.o \
- common/linux/vgpu/gv11b/vgpu_tsg_gv11b.o
-
nvgpu-$(CONFIG_NVGPU_SUPPORT_CDE) += \
common/linux/cde.o \
common/linux/cde_gm20b.o \
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/ce2_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/ce2_vgpu.c
deleted file mode 100644
index 5da6f88a0..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/ce2_vgpu.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Virtualized GPU CE2
- *
- * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "vgpu.h"
-#include "gk20a/channel_gk20a.h"
-
-#include
-
-int vgpu_ce2_nonstall_isr(struct gk20a *g,
- struct tegra_vgpu_ce2_nonstall_intr_info *info)
-{
- gk20a_dbg_fn("");
-
- switch (info->type) {
- case TEGRA_VGPU_CE2_NONSTALL_INTR_NONBLOCKPIPE:
- gk20a_channel_semaphore_wakeup(g, true);
- break;
- default:
- WARN_ON(1);
- break;
- }
-
- return 0;
-}
-
-u32 vgpu_ce_get_num_pce(struct gk20a *g)
-{
- struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
-
- return priv->constants.num_pce;
-}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/clk_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/clk_vgpu.c
index 285cd481d..0bd8e2bc9 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/clk_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/clk_vgpu.c
@@ -16,8 +16,9 @@
* along with this program. If not, see .
*/
+#include
+
#include "gk20a/gk20a.h"
-#include "vgpu.h"
#include "clk_vgpu.h"
#include "ctrl/ctrlclk.h"
#include "common/linux/platform_gk20a.h"
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.c
index bace705d3..fe9dc670f 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.c
@@ -18,14 +18,14 @@
#include
#include
#include
+#include
#include "gk20a/gk20a.h"
#include "gk20a/channel_gk20a.h"
#include "gk20a/css_gr_gk20a.h"
#include "common/linux/platform_gk20a.h"
-#include "common/linux/vgpu/vgpu.h"
-#include "common/linux/vgpu/css_vgpu.h"
#include "common/linux/os_linux.h"
+#include "vgpu/css_vgpu.h"
static struct tegra_hv_ivm_cookie *css_cookie;
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.h
deleted file mode 100644
index df95e775f..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _CSS_VGPU_H_
-#define _CSS_VGPU_H_
-
-#include
-
-struct gr_gk20a;
-struct channel_gk20a;
-struct gk20a_cs_snapshot_client;
-
-void vgpu_css_release_snapshot_buffer(struct gr_gk20a *gr);
-int vgpu_css_flush_snapshots(struct channel_gk20a *ch,
- u32 *pending, bool *hw_overflow);
-int vgpu_css_detach(struct channel_gk20a *ch,
- struct gk20a_cs_snapshot_client *cs_client);
-int vgpu_css_enable_snapshot_buffer(struct channel_gk20a *ch,
- struct gk20a_cs_snapshot_client *cs_client);
-u32 vgpu_css_get_buffer_size(struct gk20a *g);
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.h
deleted file mode 100644
index 178767a23..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _DBG_VGPU_H_
-#define _DBG_VGPU_H_
-
-struct dbg_session_gk20a;
-struct nvgpu_dbg_reg_op;
-struct dbg_profiler_object_data;
-struct gk20a;
-
-int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s,
- struct nvgpu_dbg_reg_op *ops,
- u64 num_ops);
-int vgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate);
-bool vgpu_check_and_set_global_reservation(
- struct dbg_session_gk20a *dbg_s,
- struct dbg_profiler_object_data *prof_obj);
-bool vgpu_check_and_set_context_reservation(
- struct dbg_session_gk20a *dbg_s,
- struct dbg_profiler_object_data *prof_obj);
-
-void vgpu_release_profiler_reservation(
- struct dbg_session_gk20a *dbg_s,
- struct dbg_profiler_object_data *prof_obj);
-int vgpu_perfbuffer_enable(struct gk20a *g, u64 offset, u32 size);
-int vgpu_perfbuffer_disable(struct gk20a *g);
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
index f05581062..31d898532 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
@@ -22,11 +22,11 @@
#include
#include
#include
+#include
#include "gk20a/gk20a.h"
#include "common/linux/os_linux.h"
-#include "vgpu.h"
-#include "fecs_trace_vgpu.h"
+#include "vgpu/fecs_trace_vgpu.h"
struct vgpu_fecs_trace {
struct tegra_hv_ivm_cookie *cookie;
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.h
deleted file mode 100644
index c375b841a..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef __FECS_TRACE_VGPU_H
-#define __FECS_TRACE_VGPU_H
-
-#include
-
-struct gk20a;
-struct vm_area_struct;
-struct nvgpu_ctxsw_trace_filter;
-
-void vgpu_fecs_trace_data_update(struct gk20a *g);
-int vgpu_fecs_trace_init(struct gk20a *g);
-int vgpu_fecs_trace_deinit(struct gk20a *g);
-int vgpu_fecs_trace_enable(struct gk20a *g);
-int vgpu_fecs_trace_disable(struct gk20a *g);
-bool vgpu_fecs_trace_is_enabled(struct gk20a *g);
-int vgpu_fecs_trace_poll(struct gk20a *g);
-int vgpu_alloc_user_buffer(struct gk20a *g, void **buf, size_t *size);
-int vgpu_free_user_buffer(struct gk20a *g);
-int vgpu_mmap_user_buffer(struct gk20a *g, struct vm_area_struct *vma);
-int vgpu_fecs_trace_max_entries(struct gk20a *g,
- struct nvgpu_ctxsw_trace_filter *filter);
-int vgpu_fecs_trace_set_filter(struct gk20a *g,
- struct nvgpu_ctxsw_trace_filter *filter);
-
-#endif /* __FECS_TRACE_VGPU_H */
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c
deleted file mode 100644
index fc39b3f55..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include
-
-#include "gk20a/gk20a.h"
-#include "gk20a/css_gr_gk20a.h"
-#include "common/linux/vgpu/css_vgpu.h"
-#include "vgpu_gr_gm20b.h"
-
-void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g)
-{
-#if defined(CONFIG_GK20A_CYCLE_STATS)
- bool snapshots_supported = true;
-
- /* cyclestats not supported on vgpu */
- __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false);
-
- g->gr.max_css_buffer_size = vgpu_css_get_buffer_size(g);
-
- /* snapshots not supported if the buffer size is 0 */
- if (g->gr.max_css_buffer_size == 0)
- snapshots_supported = false;
-
- __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT,
- snapshots_supported);
-#endif
-}
-
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h
deleted file mode 100644
index 77b83cbea..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef __VGPU_GR_GM20B_H__
-#define __VGPU_GR_GM20B_H__
-
-#include "gk20a/gk20a.h"
-
-void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fifo_gp10b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fifo_gp10b.c
deleted file mode 100644
index cc006f766..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fifo_gp10b.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "vgpu_fifo_gp10b.h"
-
-void vgpu_gp10b_init_fifo_ops(struct gpu_ops *gops)
-{
- /* syncpoint protection not supported yet */
- gops->fifo.resetup_ramfc = NULL;
- gops->fifo.reschedule_runlist = NULL;
-}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.h
deleted file mode 100644
index 559bd2270..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef __VGPU_GR_GP10B_H__
-#define __VGPU_GR_GP10B_H__
-
-#include "gk20a/gk20a.h"
-
-int vgpu_gr_gp10b_alloc_gr_ctx(struct gk20a *g,
- struct nvgpu_gr_ctx *gr_ctx,
- struct vm_gk20a *vm,
- u32 class,
- u32 flags);
-int vgpu_gr_gp10b_set_ctxsw_preemption_mode(struct gk20a *g,
- struct nvgpu_gr_ctx *gr_ctx,
- struct vm_gk20a *vm, u32 class,
- u32 graphics_preempt_mode,
- u32 compute_preempt_mode);
-int vgpu_gr_gp10b_set_preemption_mode(struct channel_gk20a *ch,
- u32 graphics_preempt_mode,
- u32 compute_preempt_mode);
-int vgpu_gr_gp10b_init_ctx_state(struct gk20a *g);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.h
deleted file mode 100644
index 0a477dd0a..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef __VGPU_MM_GP10B_H__
-#define __VGPU_MM_GP10B_H__
-
-#include "gk20a/gk20a.h"
-
-u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm,
- u64 map_offset,
- struct nvgpu_sgt *sgt,
- u64 buffer_offset,
- u64 size,
- int pgsz_idx,
- u8 kind_v,
- u32 ctag_offset,
- u32 flags,
- int rw_flag,
- bool clear_ctags,
- bool sparse,
- bool priv,
- struct vm_gk20a_mapping_batch *batch,
- enum nvgpu_aperture aperture);
-int vgpu_gp10b_init_mm_setup_hw(struct gk20a *g);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.h
deleted file mode 100644
index 66f482af8..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _VGPU_FIFO_GV11B_H_
-#define _VGPU_FIFO_GV11B_H_
-
-struct gk20a;
-
-int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g);
-int vgpu_gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
- u32 syncpt_id, struct nvgpu_mem *syncpt_buf);
-int vgpu_gv11b_fifo_get_sync_ro_map(struct vm_gk20a *vm,
- u64 *base_gpuva, u32 *sync_size);
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.c
deleted file mode 100644
index 69e5b2ce2..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "gk20a/gk20a.h"
-#include "common/linux/vgpu/gr_vgpu.h"
-#include "vgpu_subctx_gv11b.h"
-
-int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va)
-{
- int err;
-
- err = vgpu_gv11b_alloc_subctx_header(c);
- if (err)
- return err;
-
- err = vgpu_gr_commit_inst(c, gpu_va);
- if (err)
- vgpu_gv11b_free_subctx_header(c);
-
- return err;
-}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.h
deleted file mode 100644
index 0208012d8..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _VGPU_GR_GV11B_H_
-#define _VGPU_GR_GV11B_H_
-
-struct channel_gk20a;
-
-int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.c
deleted file mode 100644
index 155e31b63..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "gk20a/gk20a.h"
-
-#include
-
-#include "common/linux/vgpu/vgpu.h"
-#include "vgpu_gv11b.h"
-
-int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g)
-{
- int err;
-
- gk20a_dbg_fn("");
-
- err = vgpu_init_gpu_characteristics(g);
- if (err) {
- nvgpu_err(g, "vgpu_init_gpu_characteristics failed, err %d\n", err);
- return err;
- }
-
- __nvgpu_set_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS, true);
- __nvgpu_set_enabled(g, NVGPU_SUPPORT_IO_COHERENCE, true);
- __nvgpu_set_enabled(g, NVGPU_SUPPORT_SCG, true);
- __nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNCPOINT_ADDRESS, true);
-
- return 0;
-}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.h
deleted file mode 100644
index 84ebfa175..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _VGPU_GV11B_H_
-#define _VGPU_GV11B_H_
-
-struct gk20a;
-
-int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.h
deleted file mode 100644
index dfd7109ee..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _VGPU_SUBCTX_GV11B_H_
-#define _VGPU_SUBCTX_GV11B_H_
-
-struct channel_gk20a;
-
-int vgpu_gv11b_alloc_subctx_header(struct channel_gk20a *c);
-void vgpu_gv11b_free_subctx_header(struct channel_gk20a *c);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c
deleted file mode 100644
index 82a3db8f4..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include
-#include "gk20a/gk20a.h"
-#include "common/linux/vgpu/vgpu.h"
-
-#include "vgpu_tsg_gv11b.h"
-
-int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
- struct channel_gk20a *ch)
-{
- struct tegra_vgpu_cmd_msg msg = {};
- struct tegra_vgpu_tsg_bind_channel_ex_params *p =
- &msg.params.tsg_bind_channel_ex;
- int err;
-
- gk20a_dbg_fn("");
-
- err = gk20a_tsg_bind_channel(tsg, ch);
- if (err)
- return err;
-
- msg.cmd = TEGRA_VGPU_CMD_TSG_BIND_CHANNEL_EX;
- msg.handle = vgpu_get_handle(tsg->g);
- p->tsg_id = tsg->tsgid;
- p->ch_handle = ch->virt_ctx;
- p->subctx_id = ch->subctx_id;
- p->runqueue_sel = ch->runqueue_sel;
- err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
- err = err ? err : msg.ret;
- if (err) {
- nvgpu_err(tsg->g,
- "vgpu_gv11b_tsg_bind_channel failed, ch %d tsgid %d",
- ch->chid, tsg->tsgid);
- gk20a_tsg_unbind_channel(ch);
- }
-
- return err;
-}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.h
deleted file mode 100644
index 6334cdbb5..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _VGPU_TSG_GV11B_H_
-#define _VGPU_TSG_GV11B_H_
-
-int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
- struct channel_gk20a *ch);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c
deleted file mode 100644
index eacbbf9ef..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Virtualized GPU L2
- *
- * Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "gk20a/gk20a.h"
-#include "vgpu.h"
-#include "ltc_vgpu.h"
-
-int vgpu_determine_L2_size_bytes(struct gk20a *g)
-{
- struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
-
- gk20a_dbg_fn("");
-
- return priv->constants.l2_size;
-}
-
-int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
-{
- struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
- u32 max_comptag_lines = 0;
- int err;
-
- gk20a_dbg_fn("");
-
- gr->cacheline_size = priv->constants.cacheline_size;
- gr->comptags_per_cacheline = priv->constants.comptags_per_cacheline;
- gr->slices_per_ltc = priv->constants.slices_per_ltc;
- max_comptag_lines = priv->constants.comptag_lines;
-
- if (max_comptag_lines < 2)
- return -ENXIO;
-
- err = gk20a_comptag_allocator_init(g, &gr->comp_tags, max_comptag_lines);
- if (err)
- return err;
-
- return 0;
-}
-
-void vgpu_ltc_init_fs_state(struct gk20a *g)
-{
- struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
-
- gk20a_dbg_fn("");
-
- g->ltc_count = priv->constants.ltc_count;
-}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.h
deleted file mode 100644
index 7b368ef5e..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _LTC_VGPU_H_
-#define _LTC_VGPU_H_
-
-struct gk20a;
-struct gr_gk20a;
-
-int vgpu_determine_L2_size_bytes(struct gk20a *g);
-int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr);
-void vgpu_ltc_init_fs_state(struct gk20a *g);
-
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.h
deleted file mode 100644
index b0937495f..000000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef _MM_VGPU_H_
-#define _MM_VGPU_H_
-
-struct nvgpu_mem;
-struct channel_gk20a;
-struct vm_gk20a_mapping_batch;
-struct gk20a_as_share;
-
-void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm,
- u64 vaddr,
- u64 size,
- int pgsz_idx,
- bool va_allocated,
- int rw_flag,
- bool sparse,
- struct vm_gk20a_mapping_batch *batch);
-int vgpu_vm_bind_channel(struct gk20a_as_share *as_share,
- struct channel_gk20a *ch);
-int vgpu_mm_fb_flush(struct gk20a *g);
-void vgpu_mm_l2_invalidate(struct gk20a *g);
-void vgpu_mm_l2_flush(struct gk20a *g, bool invalidate);
-void vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb);
-void vgpu_mm_mmu_set_debug_mode(struct gk20a *g, bool enable);
-#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/sysfs_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/sysfs_vgpu.c
index c8435efdf..5a8ed9fd2 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/sysfs_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/sysfs_vgpu.c
@@ -15,8 +15,8 @@
*/
#include
+#include
-#include "vgpu.h"
#include "common/linux/platform_gk20a.h"
static ssize_t vgpu_load_show(struct device *dev,
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.c
index 0f2209ee7..1e5efa381 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.c
@@ -32,9 +32,8 @@
#include
#include
-#include "vgpu.h"
#include "vgpu_linux.h"
-#include "fecs_trace_vgpu.h"
+#include "vgpu/fecs_trace_vgpu.h"
#include "clk_vgpu.h"
#include "gk20a/tsg_gk20a.h"
#include "gk20a/channel_gk20a.h"
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.h b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.h
index 8fcc121f6..38379cf24 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.h
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.h
@@ -24,7 +24,7 @@ struct platform_device;
#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
-#include "vgpu.h"
+#include
int vgpu_pm_prepare_poweroff(struct device *dev);
int vgpu_pm_finalize_poweron(struct device *dev);
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h b/drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h
similarity index 73%
rename from drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
rename to drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h
index 8fa1a0f8f..1e608d969 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h
@@ -1,17 +1,23 @@
/*
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#ifndef __VGPU_COMMON_H__
diff --git a/drivers/gpu/nvgpu/vgpu/ce2_vgpu.c b/drivers/gpu/nvgpu/vgpu/ce2_vgpu.c
new file mode 100644
index 000000000..914041ff7
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/ce2_vgpu.c
@@ -0,0 +1,52 @@
+/*
+ * Virtualized GPU CE2
+ *
+ * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "gk20a/channel_gk20a.h"
+
+#include
+#include
+
+int vgpu_ce2_nonstall_isr(struct gk20a *g,
+ struct tegra_vgpu_ce2_nonstall_intr_info *info)
+{
+ gk20a_dbg_fn("");
+
+ switch (info->type) {
+ case TEGRA_VGPU_CE2_NONSTALL_INTR_NONBLOCKPIPE:
+ gk20a_channel_semaphore_wakeup(g, true);
+ break;
+ default:
+ WARN_ON(1);
+ break;
+ }
+
+ return 0;
+}
+
+u32 vgpu_ce_get_num_pce(struct gk20a *g)
+{
+ struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
+
+ return priv->constants.num_pce;
+}
diff --git a/drivers/gpu/nvgpu/vgpu/css_vgpu.h b/drivers/gpu/nvgpu/vgpu/css_vgpu.h
new file mode 100644
index 000000000..de4466f30
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/css_vgpu.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _CSS_VGPU_H_
+#define _CSS_VGPU_H_
+
+#include
+
+struct gr_gk20a;
+struct channel_gk20a;
+struct gk20a_cs_snapshot_client;
+
+void vgpu_css_release_snapshot_buffer(struct gr_gk20a *gr);
+int vgpu_css_flush_snapshots(struct channel_gk20a *ch,
+ u32 *pending, bool *hw_overflow);
+int vgpu_css_detach(struct channel_gk20a *ch,
+ struct gk20a_cs_snapshot_client *cs_client);
+int vgpu_css_enable_snapshot_buffer(struct channel_gk20a *ch,
+ struct gk20a_cs_snapshot_client *cs_client);
+u32 vgpu_css_get_buffer_size(struct gk20a *g);
+#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.c b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c
similarity index 82%
rename from drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.c
rename to drivers/gpu/nvgpu/vgpu/dbg_vgpu.c
index 11ebe84b6..092954ed0 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c
@@ -1,31 +1,36 @@
/*
* Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
#include
+#include
+#include
#include "gk20a/gk20a.h"
#include "gk20a/channel_gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h"
#include "gk20a/regops_gk20a.h"
-#include "vgpu.h"
#include "dbg_vgpu.h"
-#include
-
int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s,
struct nvgpu_dbg_reg_op *ops,
u64 num_ops)
diff --git a/drivers/gpu/nvgpu/vgpu/dbg_vgpu.h b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.h
new file mode 100644
index 000000000..90645e596
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _DBG_VGPU_H_
+#define _DBG_VGPU_H_
+
+struct dbg_session_gk20a;
+struct nvgpu_dbg_reg_op;
+struct dbg_profiler_object_data;
+struct gk20a;
+
+int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s,
+ struct nvgpu_dbg_reg_op *ops,
+ u64 num_ops);
+int vgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate);
+bool vgpu_check_and_set_global_reservation(
+ struct dbg_session_gk20a *dbg_s,
+ struct dbg_profiler_object_data *prof_obj);
+bool vgpu_check_and_set_context_reservation(
+ struct dbg_session_gk20a *dbg_s,
+ struct dbg_profiler_object_data *prof_obj);
+
+void vgpu_release_profiler_reservation(
+ struct dbg_session_gk20a *dbg_s,
+ struct dbg_profiler_object_data *prof_obj);
+int vgpu_perfbuffer_enable(struct gk20a *g, u64 offset, u32 size);
+int vgpu_perfbuffer_disable(struct gk20a *g);
+#endif
diff --git a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.h b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.h
new file mode 100644
index 000000000..b957a363f
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __FECS_TRACE_VGPU_H
+#define __FECS_TRACE_VGPU_H
+
+#include
+
+struct gk20a;
+struct vm_area_struct;
+struct nvgpu_ctxsw_trace_filter;
+
+void vgpu_fecs_trace_data_update(struct gk20a *g);
+int vgpu_fecs_trace_init(struct gk20a *g);
+int vgpu_fecs_trace_deinit(struct gk20a *g);
+int vgpu_fecs_trace_enable(struct gk20a *g);
+int vgpu_fecs_trace_disable(struct gk20a *g);
+bool vgpu_fecs_trace_is_enabled(struct gk20a *g);
+int vgpu_fecs_trace_poll(struct gk20a *g);
+int vgpu_alloc_user_buffer(struct gk20a *g, void **buf, size_t *size);
+int vgpu_free_user_buffer(struct gk20a *g);
+int vgpu_mmap_user_buffer(struct gk20a *g, struct vm_area_struct *vma);
+int vgpu_fecs_trace_max_entries(struct gk20a *g,
+ struct nvgpu_ctxsw_trace_filter *filter);
+int vgpu_fecs_trace_set_filter(struct gk20a *g,
+ struct nvgpu_ctxsw_trace_filter *filter);
+
+#endif /* __FECS_TRACE_VGPU_H */
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
similarity index 94%
rename from drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c
rename to drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
index fde113e0e..580bfb607 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
@@ -3,17 +3,23 @@
*
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
@@ -25,9 +31,9 @@
#include
#include
#include
+#include
#include "gk20a/gk20a.h"
-#include "vgpu.h"
#include "fifo_vgpu.h"
#include
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.h
similarity index 59%
rename from drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h
rename to drivers/gpu/nvgpu/vgpu/fifo_vgpu.h
index 92789dddd..20205d3c1 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.h
@@ -1,17 +1,23 @@
/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#ifndef _FIFO_VGPU_H_
diff --git a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c
new file mode 100644
index 000000000..e83980a6e
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include
+
+#include "gk20a/gk20a.h"
+#include "gk20a/css_gr_gk20a.h"
+#include "vgpu/css_vgpu.h"
+#include "vgpu_gr_gm20b.h"
+
+void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g)
+{
+#if defined(CONFIG_GK20A_CYCLE_STATS)
+ bool snapshots_supported = true;
+
+ /* cyclestats not supported on vgpu */
+ __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false);
+
+ g->gr.max_css_buffer_size = vgpu_css_get_buffer_size(g);
+
+ /* snapshots not supported if the buffer size is 0 */
+ if (g->gr.max_css_buffer_size == 0)
+ snapshots_supported = false;
+
+ __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT,
+ snapshots_supported);
+#endif
+}
+
diff --git a/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h
new file mode 100644
index 000000000..007594335
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VGPU_GR_GM20B_H__
+#define __VGPU_GR_GM20B_H__
+
+#include "gk20a/gk20a.h"
+
+void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g);
+
+#endif
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fifo_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fifo_gp10b.c
new file mode 100644
index 000000000..ac1872277
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fifo_gp10b.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "vgpu_fifo_gp10b.h"
+
+void vgpu_gp10b_init_fifo_ops(struct gpu_ops *gops)
+{
+ /* syncpoint protection not supported yet */
+ gops->fifo.resetup_ramfc = NULL;
+ gops->fifo.reschedule_runlist = NULL;
+}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c
similarity index 95%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c
rename to drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c
index 5ee5d1f6d..52b2aee53 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.h b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.h
similarity index 94%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.h
rename to drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.h
index 2ec8f2849..12334f23a 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.h
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c
similarity index 86%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.c
rename to drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c
index 9adf20d19..ab35dc673 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c
@@ -1,25 +1,31 @@
/*
- * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
#include
#include
+#include
-#include "common/linux/vgpu/vgpu.h"
-#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h"
+#include "vgpu/gm20b/vgpu_gr_gm20b.h"
#include "gp10b/gr_gp10b.h"
#include "vgpu_gr_gp10b.h"
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.h b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.h
new file mode 100644
index 000000000..0dc539823
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VGPU_GR_GP10B_H__
+#define __VGPU_GR_GP10B_H__
+
+#include "gk20a/gk20a.h"
+
+int vgpu_gr_gp10b_alloc_gr_ctx(struct gk20a *g,
+ struct nvgpu_gr_ctx *gr_ctx,
+ struct vm_gk20a *vm,
+ u32 class,
+ u32 flags);
+int vgpu_gr_gp10b_set_ctxsw_preemption_mode(struct gk20a *g,
+ struct nvgpu_gr_ctx *gr_ctx,
+ struct vm_gk20a *vm, u32 class,
+ u32 graphics_preempt_mode,
+ u32 compute_preempt_mode);
+int vgpu_gr_gp10b_set_preemption_mode(struct channel_gk20a *ch,
+ u32 graphics_preempt_mode,
+ u32 compute_preempt_mode);
+int vgpu_gr_gp10b_init_ctx_state(struct gk20a *g);
+
+#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
similarity index 94%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
rename to drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
index 39b92263b..f1ced1c81 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
@@ -1,30 +1,35 @@
/*
* Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
-#include "common/linux/vgpu/vgpu.h"
-#include "common/linux/vgpu/fifo_vgpu.h"
-#include "common/linux/vgpu/gr_vgpu.h"
-#include "common/linux/vgpu/ltc_vgpu.h"
-#include "common/linux/vgpu/mm_vgpu.h"
-#include "common/linux/vgpu/dbg_vgpu.h"
-#include "common/linux/vgpu/fecs_trace_vgpu.h"
-#include "common/linux/vgpu/css_vgpu.h"
+#include "vgpu/fifo_vgpu.h"
+#include "vgpu/gr_vgpu.h"
+#include "vgpu/ltc_vgpu.h"
+#include "vgpu/mm_vgpu.h"
+#include "vgpu/dbg_vgpu.h"
+#include "vgpu/fecs_trace_vgpu.h"
+#include "vgpu/css_vgpu.h"
#include "gp10b/gp10b.h"
#include "gp10b/hal_gp10b.h"
-#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h"
+#include "vgpu/gm20b/vgpu_gr_gm20b.h"
#include "vgpu_gr_gp10b.h"
#include "vgpu_mm_gp10b.h"
#include "vgpu_fuse_gp10b.h"
@@ -58,6 +63,7 @@
#include "gm20b/mm_gm20b.h"
#include
+#include
#include
#include
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c
similarity index 80%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.c
rename to drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c
index 26ce891fa..cf9a28c76 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c
@@ -3,26 +3,32 @@
*
* Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
-#include "common/linux/vgpu/vgpu.h"
#include "vgpu_mm_gp10b.h"
#include "gk20a/mm_gk20a.h"
#include
#include
#include
+#include
int vgpu_gp10b_init_mm_setup_hw(struct gk20a *g)
{
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.h b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.h
new file mode 100644
index 000000000..44072dd67
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VGPU_MM_GP10B_H__
+#define __VGPU_MM_GP10B_H__
+
+#include "gk20a/gk20a.h"
+
+u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm,
+ u64 map_offset,
+ struct nvgpu_sgt *sgt,
+ u64 buffer_offset,
+ u64 size,
+ int pgsz_idx,
+ u8 kind_v,
+ u32 ctag_offset,
+ u32 flags,
+ int rw_flag,
+ bool clear_ctags,
+ bool sparse,
+ bool priv,
+ struct vm_gk20a_mapping_batch *batch,
+ enum nvgpu_aperture aperture);
+int vgpu_gp10b_init_mm_setup_hw(struct gk20a *g);
+
+#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
similarity index 96%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
rename to drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index f455763b4..ee5a5d362 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -3,17 +3,23 @@
*
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
@@ -22,8 +28,8 @@
#include
#include
#include
+#include
-#include "vgpu.h"
#include "gr_vgpu.h"
#include "gk20a/gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h"
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h b/drivers/gpu/nvgpu/vgpu/gr_vgpu.h
similarity index 65%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h
rename to drivers/gpu/nvgpu/vgpu/gr_vgpu.h
index efd9e09b4..1f55823cf 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.h
@@ -1,17 +1,23 @@
/*
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#ifndef _GR_VGPU_H_
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
similarity index 74%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c
rename to drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
index c2129e4b6..18d2de704 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
@@ -1,26 +1,32 @@
/*
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
-
-#include "common/linux/vgpu/vgpu.h"
-#include "gv11b/fifo_gv11b.h"
+#include
#include
#include
+#include "gv11b/fifo_gv11b.h"
+
#ifdef CONFIG_TEGRA_GK20A_NVHOST
static int set_syncpt_ro_map_gpu_va_locked(struct vm_gk20a *vm)
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.h b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.h
new file mode 100644
index 000000000..6d8f8f60b
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VGPU_FIFO_GV11B_H_
+#define _VGPU_FIFO_GV11B_H_
+
+struct gk20a;
+
+int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g);
+int vgpu_gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
+ u32 syncpt_id, struct nvgpu_mem *syncpt_buf);
+int vgpu_gv11b_fifo_get_sync_ro_map(struct vm_gk20a *vm,
+ u64 *base_gpuva, u32 *sync_size);
+#endif
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c
new file mode 100644
index 000000000..3c93c5815
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "gk20a/gk20a.h"
+#include "vgpu/gr_vgpu.h"
+#include "vgpu_subctx_gv11b.h"
+
+int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va)
+{
+ int err;
+
+ err = vgpu_gv11b_alloc_subctx_header(c);
+ if (err)
+ return err;
+
+ err = vgpu_gr_commit_inst(c, gpu_va);
+ if (err)
+ vgpu_gv11b_free_subctx_header(c);
+
+ return err;
+}
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.h b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.h
new file mode 100644
index 000000000..2433dcd92
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VGPU_GR_GV11B_H_
+#define _VGPU_GR_GV11B_H_
+
+struct channel_gk20a;
+
+int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va);
+
+#endif
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.c
new file mode 100644
index 000000000..a303a3a20
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include
+#include
+
+#include "gk20a/gk20a.h"
+#include "vgpu_gv11b.h"
+
+int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g)
+{
+ int err;
+
+ gk20a_dbg_fn("");
+
+ err = vgpu_init_gpu_characteristics(g);
+ if (err) {
+ nvgpu_err(g, "vgpu_init_gpu_characteristics failed, err %d\n", err);
+ return err;
+ }
+
+ __nvgpu_set_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS, true);
+ __nvgpu_set_enabled(g, NVGPU_SUPPORT_IO_COHERENCE, true);
+ __nvgpu_set_enabled(g, NVGPU_SUPPORT_SCG, true);
+ __nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNCPOINT_ADDRESS, true);
+
+ return 0;
+}
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.h b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.h
new file mode 100644
index 000000000..8b2175d92
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VGPU_GV11B_H_
+#define _VGPU_GV11B_H_
+
+struct gk20a;
+
+int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g);
+
+#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
similarity index 94%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
rename to drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
index 987dd1868..76f7b3891 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
@@ -1,33 +1,39 @@
/*
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
#include
+#include
-#include "common/linux/vgpu/vgpu.h"
-#include "common/linux/vgpu/fifo_vgpu.h"
-#include "common/linux/vgpu/gr_vgpu.h"
-#include "common/linux/vgpu/ltc_vgpu.h"
-#include "common/linux/vgpu/mm_vgpu.h"
-#include "common/linux/vgpu/dbg_vgpu.h"
-#include "common/linux/vgpu/fecs_trace_vgpu.h"
-#include "common/linux/vgpu/css_vgpu.h"
-#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h"
-#include "common/linux/vgpu/gp10b/vgpu_mm_gp10b.h"
-#include "common/linux/vgpu/gp10b/vgpu_gr_gp10b.h"
+#include "vgpu/fifo_vgpu.h"
+#include "vgpu/gr_vgpu.h"
+#include "vgpu/ltc_vgpu.h"
+#include "vgpu/mm_vgpu.h"
+#include "vgpu/dbg_vgpu.h"
+#include "vgpu/fecs_trace_vgpu.h"
+#include "vgpu/css_vgpu.h"
+#include "vgpu/gm20b/vgpu_gr_gm20b.h"
+#include "vgpu/gp10b/vgpu_mm_gp10b.h"
+#include "vgpu/gp10b/vgpu_gr_gp10b.h"
#include
#include
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c
similarity index 60%
rename from drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
rename to drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c
index 5fbc7bbed..ba92c8d54 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c
@@ -1,21 +1,28 @@
/*
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include "gk20a/gk20a.h"
-#include "common/linux/vgpu/vgpu.h"
+
+#include
#include
#include
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.h b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.h
new file mode 100644
index 000000000..4bd0c2de4
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VGPU_SUBCTX_GV11B_H_
+#define _VGPU_SUBCTX_GV11B_H_
+
+struct channel_gk20a;
+
+int vgpu_gv11b_alloc_subctx_header(struct channel_gk20a *c);
+void vgpu_gv11b_free_subctx_header(struct channel_gk20a *c);
+
+#endif
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.c
new file mode 100644
index 000000000..b249b5af7
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include
+#include
+
+#include "gk20a/gk20a.h"
+#include "vgpu_tsg_gv11b.h"
+
+int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
+ struct channel_gk20a *ch)
+{
+ struct tegra_vgpu_cmd_msg msg = {};
+ struct tegra_vgpu_tsg_bind_channel_ex_params *p =
+ &msg.params.tsg_bind_channel_ex;
+ int err;
+
+ gk20a_dbg_fn("");
+
+ err = gk20a_tsg_bind_channel(tsg, ch);
+ if (err)
+ return err;
+
+ msg.cmd = TEGRA_VGPU_CMD_TSG_BIND_CHANNEL_EX;
+ msg.handle = vgpu_get_handle(tsg->g);
+ p->tsg_id = tsg->tsgid;
+ p->ch_handle = ch->virt_ctx;
+ p->subctx_id = ch->subctx_id;
+ p->runqueue_sel = ch->runqueue_sel;
+ err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
+ err = err ? err : msg.ret;
+ if (err) {
+ nvgpu_err(tsg->g,
+ "vgpu_gv11b_tsg_bind_channel failed, ch %d tsgid %d",
+ ch->chid, tsg->tsgid);
+ gk20a_tsg_unbind_channel(ch);
+ }
+
+ return err;
+}
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.h b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.h
new file mode 100644
index 000000000..9ce841707
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VGPU_TSG_GV11B_H_
+#define _VGPU_TSG_GV11B_H_
+
+int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
+ struct channel_gk20a *ch);
+
+#endif
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
new file mode 100644
index 000000000..7e86ba384
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
@@ -0,0 +1,69 @@
+/*
+ * Virtualized GPU L2
+ *
+ * Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include
+
+#include "gk20a/gk20a.h"
+#include "ltc_vgpu.h"
+
+int vgpu_determine_L2_size_bytes(struct gk20a *g)
+{
+ struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
+
+ gk20a_dbg_fn("");
+
+ return priv->constants.l2_size;
+}
+
+int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
+{
+ struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
+ u32 max_comptag_lines = 0;
+ int err;
+
+ gk20a_dbg_fn("");
+
+ gr->cacheline_size = priv->constants.cacheline_size;
+ gr->comptags_per_cacheline = priv->constants.comptags_per_cacheline;
+ gr->slices_per_ltc = priv->constants.slices_per_ltc;
+ max_comptag_lines = priv->constants.comptag_lines;
+
+ if (max_comptag_lines < 2)
+ return -ENXIO;
+
+ err = gk20a_comptag_allocator_init(g, &gr->comp_tags, max_comptag_lines);
+ if (err)
+ return err;
+
+ return 0;
+}
+
+void vgpu_ltc_init_fs_state(struct gk20a *g)
+{
+ struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
+
+ gk20a_dbg_fn("");
+
+ g->ltc_count = priv->constants.ltc_count;
+}
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.h b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.h
new file mode 100644
index 000000000..adc761716
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _LTC_VGPU_H_
+#define _LTC_VGPU_H_
+
+struct gk20a;
+struct gr_gk20a;
+
+int vgpu_determine_L2_size_bytes(struct gk20a *g);
+int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr);
+void vgpu_ltc_init_fs_state(struct gk20a *g);
+
+#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
similarity index 83%
rename from drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c
rename to drivers/gpu/nvgpu/vgpu/mm_vgpu.c
index db3d6d03d..214969068 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
@@ -3,17 +3,23 @@
*
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
@@ -23,11 +29,11 @@
#include
#include
+#include
#include
#include
-#include "vgpu.h"
#include "mm_vgpu.h"
#include "gk20a/gk20a.h"
#include "gk20a/mm_gk20a.h"
diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.h b/drivers/gpu/nvgpu/vgpu/mm_vgpu.h
new file mode 100644
index 000000000..12265fc1e
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _MM_VGPU_H_
+#define _MM_VGPU_H_
+
+struct nvgpu_mem;
+struct channel_gk20a;
+struct vm_gk20a_mapping_batch;
+struct gk20a_as_share;
+struct vm_gk20a;
+
+void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm,
+ u64 vaddr,
+ u64 size,
+ int pgsz_idx,
+ bool va_allocated,
+ int rw_flag,
+ bool sparse,
+ struct vm_gk20a_mapping_batch *batch);
+int vgpu_vm_bind_channel(struct gk20a_as_share *as_share,
+ struct channel_gk20a *ch);
+int vgpu_mm_fb_flush(struct gk20a *g);
+void vgpu_mm_l2_invalidate(struct gk20a *g);
+void vgpu_mm_l2_flush(struct gk20a *g, bool invalidate);
+void vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb);
+void vgpu_mm_mmu_set_debug_mode(struct gk20a *g, bool enable);
+#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
similarity index 74%
rename from drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c
rename to drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
index 421763ecc..a6e493d09 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
@@ -1,28 +1,33 @@
/*
* Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include "gk20a/gk20a.h"
#include "gk20a/channel_gk20a.h"
#include "gk20a/tsg_gk20a.h"
-#include "common/linux/platform_gk20a.h"
-#include "vgpu.h"
#include "fifo_vgpu.h"
#include
#include
+#include
int vgpu_tsg_open(struct tsg_gk20a *tsg)
{
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
similarity index 87%
rename from drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
rename to drivers/gpu/nvgpu/vgpu/vgpu.c
index 7915a599a..eb56d4f95 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -1,25 +1,31 @@
/*
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
#include
#include
#include
+#include
#include "gk20a/gk20a.h"
-#include "vgpu.h"
#include "fecs_trace_vgpu.h"
int vgpu_comm_init(struct gk20a *g)