summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-01-30 02:24:37 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-02-27 17:30:52 -0500
commit6393eddfa996fba03464f897b85aa5ec79860fed (patch)
tree557ebe9be93e2b0464118e7d8ec019d9d5dbae5f
parent7932568b7fe9e16b2b83bc58b2b3686c0d5e52d4 (diff)
gpu: nvgpu: vgpu: move common files out of linux folder
Most of files have been moved out of linux folder. More code could be common as halifying going on. Jira EVLR-2364 Change-Id: Ia9dbdbc82f45ceefe5c788eac7517000cd455d5e Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1649947 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Makefile47
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/ce2_vgpu.c46
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/clk_vgpu.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.h34
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.h41
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.h41
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c42
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h24
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fifo_gp10b.c24
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.h37
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.h39
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.h27
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.c34
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.h24
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.c42
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.h24
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.h25
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c53
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.h23
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c62
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.h27
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.h40
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/sysfs_vgpu.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu_linux.h2
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h (renamed from drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h)24
-rw-r--r--drivers/gpu/nvgpu/vgpu/ce2_vgpu.c52
-rw-r--r--drivers/gpu/nvgpu/vgpu/css_vgpu.h40
-rw-r--r--drivers/gpu/nvgpu/vgpu/dbg_vgpu.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.c)29
-rw-r--r--drivers/gpu/nvgpu/vgpu/dbg_vgpu.h47
-rw-r--r--drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.h47
-rw-r--r--drivers/gpu/nvgpu/vgpu/fifo_vgpu.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c)26
-rw-r--r--drivers/gpu/nvgpu/vgpu/fifo_vgpu.h (renamed from drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h)26
-rw-r--r--drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c48
-rw-r--r--drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h30
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fifo_gp10b.c30
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c)2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.h (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.h)2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.c)30
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.h43
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c)42
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.c)26
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.h45
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c)26
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.h (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h)24
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c)30
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.h33
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c40
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.h30
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.c47
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.h30
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c)46
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c)27
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.h31
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.c59
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.h29
-rw-r--r--drivers/gpu/nvgpu/vgpu/ltc_vgpu.c69
-rw-r--r--drivers/gpu/nvgpu/vgpu/ltc_vgpu.h33
-rw-r--r--drivers/gpu/nvgpu/vgpu/mm_vgpu.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c)26
-rw-r--r--drivers/gpu/nvgpu/vgpu/mm_vgpu.h47
-rw-r--r--drivers/gpu/nvgpu/vgpu/tsg_vgpu.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c)27
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c (renamed from drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c)26
64 files changed, 1124 insertions, 919 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index ae169a1d..418b7ea3 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -163,23 +163,34 @@ nvgpu-$(CONFIG_GK20A_PCI) += common/linux/pci.o \
163nvgpu-$(CONFIG_TEGRA_GK20A_NVHOST) += common/linux/nvhost.o 163nvgpu-$(CONFIG_TEGRA_GK20A_NVHOST) += common/linux/nvhost.o
164 164
165nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \ 165nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
166 vgpu/ltc_vgpu.o \
167 vgpu/gr_vgpu.o \
168 vgpu/fifo_vgpu.o \
169 vgpu/ce2_vgpu.o \
170 vgpu/mm_vgpu.o \
171 vgpu/vgpu.o \
172 vgpu/dbg_vgpu.o \
173 vgpu/tsg_vgpu.o \
174 vgpu/gm20b/vgpu_gr_gm20b.o \
175 vgpu/gp10b/vgpu_hal_gp10b.o \
176 vgpu/gp10b/vgpu_gr_gp10b.o \
177 vgpu/gp10b/vgpu_fuse_gp10b.o \
178 vgpu/gp10b/vgpu_mm_gp10b.o \
179 vgpu/gv11b/vgpu_gv11b.o \
180 vgpu/gv11b/vgpu_hal_gv11b.o \
181 vgpu/gv11b/vgpu_gr_gv11b.o \
182 vgpu/gv11b/vgpu_fifo_gv11b.o \
183 vgpu/gv11b/vgpu_subctx_gv11b.o \
184 vgpu/gv11b/vgpu_tsg_gv11b.o \
166 common/linux/vgpu/platform_vgpu_tegra.o \ 185 common/linux/vgpu/platform_vgpu_tegra.o \
167 common/linux/vgpu/ltc_vgpu.o \
168 common/linux/vgpu/gr_vgpu.o \
169 common/linux/vgpu/fifo_vgpu.o \
170 common/linux/vgpu/ce2_vgpu.o \
171 common/linux/vgpu/mm_vgpu.o \
172 common/linux/vgpu/vgpu.o \
173 common/linux/vgpu/dbg_vgpu.o \
174 common/linux/vgpu/fecs_trace_vgpu.o \ 186 common/linux/vgpu/fecs_trace_vgpu.o \
175 common/linux/vgpu/tsg_vgpu.o \
176 common/linux/vgpu/clk_vgpu.o \ 187 common/linux/vgpu/clk_vgpu.o \
177 common/linux/vgpu/css_vgpu.o \ 188 common/linux/vgpu/css_vgpu.o \
178 common/linux/vgpu/gm20b/vgpu_gr_gm20b.o \
179 common/linux/vgpu/sysfs_vgpu.o \ 189 common/linux/vgpu/sysfs_vgpu.o \
180 common/linux/vgpu/vgpu_ivc.o \ 190 common/linux/vgpu/vgpu_ivc.o \
181 common/linux/vgpu/vgpu_ivm.o \ 191 common/linux/vgpu/vgpu_ivm.o \
182 common/linux/vgpu/vgpu_linux.o 192 common/linux/vgpu/vgpu_linux.o \
193 common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.o
183 194
184nvgpu-$(CONFIG_COMMON_CLK) += \ 195nvgpu-$(CONFIG_COMMON_CLK) += \
185 common/linux/clk.o 196 common/linux/clk.o
@@ -287,22 +298,6 @@ nvgpu-y += \
287 lpwr/rppg.o \ 298 lpwr/rppg.o \
288 lpwr/lpwr.o 299 lpwr/lpwr.o
289 300
290
291nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
292 common/linux/vgpu/gp10b/vgpu_hal_gp10b.o \
293 common/linux/vgpu/gp10b/vgpu_gr_gp10b.o \
294 common/linux/vgpu/gp10b/vgpu_fuse_gp10b.o \
295 common/linux/vgpu/gp10b/vgpu_mm_gp10b.o
296
297nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
298 common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.o \
299 common/linux/vgpu/gv11b/vgpu_gv11b.o \
300 common/linux/vgpu/gv11b/vgpu_hal_gv11b.o \
301 common/linux/vgpu/gv11b/vgpu_gr_gv11b.o \
302 common/linux/vgpu/gv11b/vgpu_fifo_gv11b.o \
303 common/linux/vgpu/gv11b/vgpu_subctx_gv11b.o \
304 common/linux/vgpu/gv11b/vgpu_tsg_gv11b.o
305
306nvgpu-$(CONFIG_NVGPU_SUPPORT_CDE) += \ 301nvgpu-$(CONFIG_NVGPU_SUPPORT_CDE) += \
307 common/linux/cde.o \ 302 common/linux/cde.o \
308 common/linux/cde_gm20b.o \ 303 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 5da6f88a..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/ce2_vgpu.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Virtualized GPU CE2
3 *
4 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "vgpu.h"
20#include "gk20a/channel_gk20a.h"
21
22#include <nvgpu/bug.h>
23
24int vgpu_ce2_nonstall_isr(struct gk20a *g,
25 struct tegra_vgpu_ce2_nonstall_intr_info *info)
26{
27 gk20a_dbg_fn("");
28
29 switch (info->type) {
30 case TEGRA_VGPU_CE2_NONSTALL_INTR_NONBLOCKPIPE:
31 gk20a_channel_semaphore_wakeup(g, true);
32 break;
33 default:
34 WARN_ON(1);
35 break;
36 }
37
38 return 0;
39}
40
41u32 vgpu_ce_get_num_pce(struct gk20a *g)
42{
43 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
44
45 return priv->constants.num_pce;
46}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/clk_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/clk_vgpu.c
index 285cd481..0bd8e2bc 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 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19#include <nvgpu/vgpu/vgpu.h>
20
19#include "gk20a/gk20a.h" 21#include "gk20a/gk20a.h"
20#include "vgpu.h"
21#include "clk_vgpu.h" 22#include "clk_vgpu.h"
22#include "ctrl/ctrlclk.h" 23#include "ctrl/ctrlclk.h"
23#include "common/linux/platform_gk20a.h" 24#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 bace705d..fe9dc670 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 @@
18#include <nvgpu/vgpu/vgpu_ivm.h> 18#include <nvgpu/vgpu/vgpu_ivm.h>
19#include <nvgpu/vgpu/tegra_vgpu.h> 19#include <nvgpu/vgpu/tegra_vgpu.h>
20#include <uapi/linux/nvgpu.h> 20#include <uapi/linux/nvgpu.h>
21#include <nvgpu/vgpu/vgpu.h>
21 22
22#include "gk20a/gk20a.h" 23#include "gk20a/gk20a.h"
23#include "gk20a/channel_gk20a.h" 24#include "gk20a/channel_gk20a.h"
24#include "gk20a/css_gr_gk20a.h" 25#include "gk20a/css_gr_gk20a.h"
25#include "common/linux/platform_gk20a.h" 26#include "common/linux/platform_gk20a.h"
26#include "common/linux/vgpu/vgpu.h"
27#include "common/linux/vgpu/css_vgpu.h"
28#include "common/linux/os_linux.h" 27#include "common/linux/os_linux.h"
28#include "vgpu/css_vgpu.h"
29 29
30static struct tegra_hv_ivm_cookie *css_cookie; 30static struct tegra_hv_ivm_cookie *css_cookie;
31 31
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 df95e775..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/css_vgpu.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _CSS_VGPU_H_
18#define _CSS_VGPU_H_
19
20#include <nvgpu/types.h>
21
22struct gr_gk20a;
23struct channel_gk20a;
24struct gk20a_cs_snapshot_client;
25
26void vgpu_css_release_snapshot_buffer(struct gr_gk20a *gr);
27int vgpu_css_flush_snapshots(struct channel_gk20a *ch,
28 u32 *pending, bool *hw_overflow);
29int vgpu_css_detach(struct channel_gk20a *ch,
30 struct gk20a_cs_snapshot_client *cs_client);
31int vgpu_css_enable_snapshot_buffer(struct channel_gk20a *ch,
32 struct gk20a_cs_snapshot_client *cs_client);
33u32 vgpu_css_get_buffer_size(struct gk20a *g);
34#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 178767a2..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _DBG_VGPU_H_
18#define _DBG_VGPU_H_
19
20struct dbg_session_gk20a;
21struct nvgpu_dbg_reg_op;
22struct dbg_profiler_object_data;
23struct gk20a;
24
25int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s,
26 struct nvgpu_dbg_reg_op *ops,
27 u64 num_ops);
28int vgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate);
29bool vgpu_check_and_set_global_reservation(
30 struct dbg_session_gk20a *dbg_s,
31 struct dbg_profiler_object_data *prof_obj);
32bool vgpu_check_and_set_context_reservation(
33 struct dbg_session_gk20a *dbg_s,
34 struct dbg_profiler_object_data *prof_obj);
35
36void vgpu_release_profiler_reservation(
37 struct dbg_session_gk20a *dbg_s,
38 struct dbg_profiler_object_data *prof_obj);
39int vgpu_perfbuffer_enable(struct gk20a *g, u64 offset, u32 size);
40int vgpu_perfbuffer_disable(struct gk20a *g);
41#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 f0558106..31d89853 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 @@
22#include <nvgpu/ctxsw_trace.h> 22#include <nvgpu/ctxsw_trace.h>
23#include <nvgpu/vgpu/vgpu_ivm.h> 23#include <nvgpu/vgpu/vgpu_ivm.h>
24#include <nvgpu/vgpu/tegra_vgpu.h> 24#include <nvgpu/vgpu/tegra_vgpu.h>
25#include <nvgpu/vgpu/vgpu.h>
25 26
26#include "gk20a/gk20a.h" 27#include "gk20a/gk20a.h"
27#include "common/linux/os_linux.h" 28#include "common/linux/os_linux.h"
28#include "vgpu.h" 29#include "vgpu/fecs_trace_vgpu.h"
29#include "fecs_trace_vgpu.h"
30 30
31struct vgpu_fecs_trace { 31struct vgpu_fecs_trace {
32 struct tegra_hv_ivm_cookie *cookie; 32 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 c375b841..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __FECS_TRACE_VGPU_H
18#define __FECS_TRACE_VGPU_H
19
20#include <nvgpu/types.h>
21
22struct gk20a;
23struct vm_area_struct;
24struct nvgpu_ctxsw_trace_filter;
25
26void vgpu_fecs_trace_data_update(struct gk20a *g);
27int vgpu_fecs_trace_init(struct gk20a *g);
28int vgpu_fecs_trace_deinit(struct gk20a *g);
29int vgpu_fecs_trace_enable(struct gk20a *g);
30int vgpu_fecs_trace_disable(struct gk20a *g);
31bool vgpu_fecs_trace_is_enabled(struct gk20a *g);
32int vgpu_fecs_trace_poll(struct gk20a *g);
33int vgpu_alloc_user_buffer(struct gk20a *g, void **buf, size_t *size);
34int vgpu_free_user_buffer(struct gk20a *g);
35int vgpu_mmap_user_buffer(struct gk20a *g, struct vm_area_struct *vma);
36int vgpu_fecs_trace_max_entries(struct gk20a *g,
37 struct nvgpu_ctxsw_trace_filter *filter);
38int vgpu_fecs_trace_set_filter(struct gk20a *g,
39 struct nvgpu_ctxsw_trace_filter *filter);
40
41#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 fc39b3f5..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <nvgpu/enabled.h>
18
19#include "gk20a/gk20a.h"
20#include "gk20a/css_gr_gk20a.h"
21#include "common/linux/vgpu/css_vgpu.h"
22#include "vgpu_gr_gm20b.h"
23
24void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g)
25{
26#if defined(CONFIG_GK20A_CYCLE_STATS)
27 bool snapshots_supported = true;
28
29 /* cyclestats not supported on vgpu */
30 __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false);
31
32 g->gr.max_css_buffer_size = vgpu_css_get_buffer_size(g);
33
34 /* snapshots not supported if the buffer size is 0 */
35 if (g->gr.max_css_buffer_size == 0)
36 snapshots_supported = false;
37
38 __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT,
39 snapshots_supported);
40#endif
41}
42
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 77b83cbe..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gm20b/vgpu_gr_gm20b.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __VGPU_GR_GM20B_H__
18#define __VGPU_GR_GM20B_H__
19
20#include "gk20a/gk20a.h"
21
22void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g);
23
24#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 cc006f76..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fifo_gp10b.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "vgpu_fifo_gp10b.h"
18
19void vgpu_gp10b_init_fifo_ops(struct gpu_ops *gops)
20{
21 /* syncpoint protection not supported yet */
22 gops->fifo.resetup_ramfc = NULL;
23 gops->fifo.reschedule_runlist = NULL;
24}
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 559bd227..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_gr_gp10b.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __VGPU_GR_GP10B_H__
18#define __VGPU_GR_GP10B_H__
19
20#include "gk20a/gk20a.h"
21
22int vgpu_gr_gp10b_alloc_gr_ctx(struct gk20a *g,
23 struct nvgpu_gr_ctx *gr_ctx,
24 struct vm_gk20a *vm,
25 u32 class,
26 u32 flags);
27int vgpu_gr_gp10b_set_ctxsw_preemption_mode(struct gk20a *g,
28 struct nvgpu_gr_ctx *gr_ctx,
29 struct vm_gk20a *vm, u32 class,
30 u32 graphics_preempt_mode,
31 u32 compute_preempt_mode);
32int vgpu_gr_gp10b_set_preemption_mode(struct channel_gk20a *ch,
33 u32 graphics_preempt_mode,
34 u32 compute_preempt_mode);
35int vgpu_gr_gp10b_init_ctx_state(struct gk20a *g);
36
37#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 0a477dd0..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __VGPU_MM_GP10B_H__
18#define __VGPU_MM_GP10B_H__
19
20#include "gk20a/gk20a.h"
21
22u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm,
23 u64 map_offset,
24 struct nvgpu_sgt *sgt,
25 u64 buffer_offset,
26 u64 size,
27 int pgsz_idx,
28 u8 kind_v,
29 u32 ctag_offset,
30 u32 flags,
31 int rw_flag,
32 bool clear_ctags,
33 bool sparse,
34 bool priv,
35 struct vm_gk20a_mapping_batch *batch,
36 enum nvgpu_aperture aperture);
37int vgpu_gp10b_init_mm_setup_hw(struct gk20a *g);
38
39#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 66f482af..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _VGPU_FIFO_GV11B_H_
18#define _VGPU_FIFO_GV11B_H_
19
20struct gk20a;
21
22int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g);
23int vgpu_gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
24 u32 syncpt_id, struct nvgpu_mem *syncpt_buf);
25int vgpu_gv11b_fifo_get_sync_ro_map(struct vm_gk20a *vm,
26 u64 *base_gpuva, u32 *sync_size);
27#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 69e5b2ce..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "gk20a/gk20a.h"
18#include "common/linux/vgpu/gr_vgpu.h"
19#include "vgpu_subctx_gv11b.h"
20
21int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va)
22{
23 int err;
24
25 err = vgpu_gv11b_alloc_subctx_header(c);
26 if (err)
27 return err;
28
29 err = vgpu_gr_commit_inst(c, gpu_va);
30 if (err)
31 vgpu_gv11b_free_subctx_header(c);
32
33 return err;
34}
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 0208012d..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gr_gv11b.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _VGPU_GR_GV11B_H_
18#define _VGPU_GR_GV11B_H_
19
20struct channel_gk20a;
21
22int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va);
23
24#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 155e31b6..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "gk20a/gk20a.h"
18
19#include <nvgpu/enabled.h>
20
21#include "common/linux/vgpu/vgpu.h"
22#include "vgpu_gv11b.h"
23
24int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g)
25{
26 int err;
27
28 gk20a_dbg_fn("");
29
30 err = vgpu_init_gpu_characteristics(g);
31 if (err) {
32 nvgpu_err(g, "vgpu_init_gpu_characteristics failed, err %d\n", err);
33 return err;
34 }
35
36 __nvgpu_set_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS, true);
37 __nvgpu_set_enabled(g, NVGPU_SUPPORT_IO_COHERENCE, true);
38 __nvgpu_set_enabled(g, NVGPU_SUPPORT_SCG, true);
39 __nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNCPOINT_ADDRESS, true);
40
41 return 0;
42}
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 84ebfa17..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_gv11b.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _VGPU_GV11B_H_
18#define _VGPU_GV11B_H_
19
20struct gk20a;
21
22int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g);
23
24#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 dfd7109e..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _VGPU_SUBCTX_GV11B_H_
18#define _VGPU_SUBCTX_GV11B_H_
19
20struct channel_gk20a;
21
22int vgpu_gv11b_alloc_subctx_header(struct channel_gk20a *c);
23void vgpu_gv11b_free_subctx_header(struct channel_gk20a *c);
24
25#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 82a3db8f..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <nvgpu/vgpu/tegra_vgpu.h>
18#include "gk20a/gk20a.h"
19#include "common/linux/vgpu/vgpu.h"
20
21#include "vgpu_tsg_gv11b.h"
22
23int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
24 struct channel_gk20a *ch)
25{
26 struct tegra_vgpu_cmd_msg msg = {};
27 struct tegra_vgpu_tsg_bind_channel_ex_params *p =
28 &msg.params.tsg_bind_channel_ex;
29 int err;
30
31 gk20a_dbg_fn("");
32
33 err = gk20a_tsg_bind_channel(tsg, ch);
34 if (err)
35 return err;
36
37 msg.cmd = TEGRA_VGPU_CMD_TSG_BIND_CHANNEL_EX;
38 msg.handle = vgpu_get_handle(tsg->g);
39 p->tsg_id = tsg->tsgid;
40 p->ch_handle = ch->virt_ctx;
41 p->subctx_id = ch->subctx_id;
42 p->runqueue_sel = ch->runqueue_sel;
43 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
44 err = err ? err : msg.ret;
45 if (err) {
46 nvgpu_err(tsg->g,
47 "vgpu_gv11b_tsg_bind_channel failed, ch %d tsgid %d",
48 ch->chid, tsg->tsgid);
49 gk20a_tsg_unbind_channel(ch);
50 }
51
52 return err;
53}
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 6334cdbb..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _VGPU_TSG_GV11B_H_
18#define _VGPU_TSG_GV11B_H_
19
20int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
21 struct channel_gk20a *ch);
22
23#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 eacbbf9e..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Virtualized GPU L2
3 *
4 * Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "gk20a/gk20a.h"
20#include "vgpu.h"
21#include "ltc_vgpu.h"
22
23int vgpu_determine_L2_size_bytes(struct gk20a *g)
24{
25 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
26
27 gk20a_dbg_fn("");
28
29 return priv->constants.l2_size;
30}
31
32int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
33{
34 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
35 u32 max_comptag_lines = 0;
36 int err;
37
38 gk20a_dbg_fn("");
39
40 gr->cacheline_size = priv->constants.cacheline_size;
41 gr->comptags_per_cacheline = priv->constants.comptags_per_cacheline;
42 gr->slices_per_ltc = priv->constants.slices_per_ltc;
43 max_comptag_lines = priv->constants.comptag_lines;
44
45 if (max_comptag_lines < 2)
46 return -ENXIO;
47
48 err = gk20a_comptag_allocator_init(g, &gr->comp_tags, max_comptag_lines);
49 if (err)
50 return err;
51
52 return 0;
53}
54
55void vgpu_ltc_init_fs_state(struct gk20a *g)
56{
57 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
58
59 gk20a_dbg_fn("");
60
61 g->ltc_count = priv->constants.ltc_count;
62}
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 7b368ef5..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/ltc_vgpu.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _LTC_VGPU_H_
18#define _LTC_VGPU_H_
19
20struct gk20a;
21struct gr_gk20a;
22
23int vgpu_determine_L2_size_bytes(struct gk20a *g);
24int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr);
25void vgpu_ltc_init_fs_state(struct gk20a *g);
26
27#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 b0937495..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _MM_VGPU_H_
18#define _MM_VGPU_H_
19
20struct nvgpu_mem;
21struct channel_gk20a;
22struct vm_gk20a_mapping_batch;
23struct gk20a_as_share;
24
25void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm,
26 u64 vaddr,
27 u64 size,
28 int pgsz_idx,
29 bool va_allocated,
30 int rw_flag,
31 bool sparse,
32 struct vm_gk20a_mapping_batch *batch);
33int vgpu_vm_bind_channel(struct gk20a_as_share *as_share,
34 struct channel_gk20a *ch);
35int vgpu_mm_fb_flush(struct gk20a *g);
36void vgpu_mm_l2_invalidate(struct gk20a *g);
37void vgpu_mm_l2_flush(struct gk20a *g, bool invalidate);
38void vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb);
39void vgpu_mm_mmu_set_debug_mode(struct gk20a *g, bool enable);
40#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/sysfs_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/sysfs_vgpu.c
index c8435efd..5a8ed9fd 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 @@
15 */ 15 */
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <nvgpu/vgpu/vgpu.h>
18 19
19#include "vgpu.h"
20#include "common/linux/platform_gk20a.h" 20#include "common/linux/platform_gk20a.h"
21 21
22static ssize_t vgpu_load_show(struct device *dev, 22static 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 0f2209ee..1e5efa38 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 @@
32#include <nvgpu/ctxsw_trace.h> 32#include <nvgpu/ctxsw_trace.h>
33#include <nvgpu/defaults.h> 33#include <nvgpu/defaults.h>
34 34
35#include "vgpu.h"
36#include "vgpu_linux.h" 35#include "vgpu_linux.h"
37#include "fecs_trace_vgpu.h" 36#include "vgpu/fecs_trace_vgpu.h"
38#include "clk_vgpu.h" 37#include "clk_vgpu.h"
39#include "gk20a/tsg_gk20a.h" 38#include "gk20a/tsg_gk20a.h"
40#include "gk20a/channel_gk20a.h" 39#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 8fcc121f..38379cf2 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;
24 24
25#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 25#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
26 26
27#include "vgpu.h" 27#include <nvgpu/vgpu/vgpu.h>
28 28
29int vgpu_pm_prepare_poweroff(struct device *dev); 29int vgpu_pm_prepare_poweroff(struct device *dev);
30int vgpu_pm_finalize_poweron(struct device *dev); 30int 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
index 8fa1a0f8..1e608d96 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h
@@ -1,17 +1,23 @@
1/* 1/*
2 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#ifndef __VGPU_COMMON_H__ 23#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 00000000..914041ff
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/ce2_vgpu.c
@@ -0,0 +1,52 @@
1/*
2 * Virtualized GPU CE2
3 *
4 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#include "gk20a/channel_gk20a.h"
26
27#include <nvgpu/bug.h>
28#include <nvgpu/vgpu/vgpu.h>
29
30int vgpu_ce2_nonstall_isr(struct gk20a *g,
31 struct tegra_vgpu_ce2_nonstall_intr_info *info)
32{
33 gk20a_dbg_fn("");
34
35 switch (info->type) {
36 case TEGRA_VGPU_CE2_NONSTALL_INTR_NONBLOCKPIPE:
37 gk20a_channel_semaphore_wakeup(g, true);
38 break;
39 default:
40 WARN_ON(1);
41 break;
42 }
43
44 return 0;
45}
46
47u32 vgpu_ce_get_num_pce(struct gk20a *g)
48{
49 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
50
51 return priv->constants.num_pce;
52}
diff --git a/drivers/gpu/nvgpu/vgpu/css_vgpu.h b/drivers/gpu/nvgpu/vgpu/css_vgpu.h
new file mode 100644
index 00000000..de4466f3
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/css_vgpu.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _CSS_VGPU_H_
24#define _CSS_VGPU_H_
25
26#include <nvgpu/types.h>
27
28struct gr_gk20a;
29struct channel_gk20a;
30struct gk20a_cs_snapshot_client;
31
32void vgpu_css_release_snapshot_buffer(struct gr_gk20a *gr);
33int vgpu_css_flush_snapshots(struct channel_gk20a *ch,
34 u32 *pending, bool *hw_overflow);
35int vgpu_css_detach(struct channel_gk20a *ch,
36 struct gk20a_cs_snapshot_client *cs_client);
37int vgpu_css_enable_snapshot_buffer(struct channel_gk20a *ch,
38 struct gk20a_cs_snapshot_client *cs_client);
39u32 vgpu_css_get_buffer_size(struct gk20a *g);
40#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.c b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c
index 11ebe84b..092954ed 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/dbg_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c
@@ -1,31 +1,36 @@
1/* 1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include <nvgpu/vgpu/vgpu_ivc.h> 23#include <nvgpu/vgpu/vgpu_ivc.h>
18#include <nvgpu/vgpu/tegra_vgpu.h> 24#include <nvgpu/vgpu/tegra_vgpu.h>
25#include <nvgpu/vgpu/vgpu.h>
26#include <nvgpu/bug.h>
19 27
20#include "gk20a/gk20a.h" 28#include "gk20a/gk20a.h"
21#include "gk20a/channel_gk20a.h" 29#include "gk20a/channel_gk20a.h"
22#include "gk20a/dbg_gpu_gk20a.h" 30#include "gk20a/dbg_gpu_gk20a.h"
23#include "gk20a/regops_gk20a.h" 31#include "gk20a/regops_gk20a.h"
24#include "vgpu.h"
25#include "dbg_vgpu.h" 32#include "dbg_vgpu.h"
26 33
27#include <nvgpu/bug.h>
28
29int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s, 34int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s,
30 struct nvgpu_dbg_reg_op *ops, 35 struct nvgpu_dbg_reg_op *ops,
31 u64 num_ops) 36 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 00000000..90645e59
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _DBG_VGPU_H_
24#define _DBG_VGPU_H_
25
26struct dbg_session_gk20a;
27struct nvgpu_dbg_reg_op;
28struct dbg_profiler_object_data;
29struct gk20a;
30
31int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s,
32 struct nvgpu_dbg_reg_op *ops,
33 u64 num_ops);
34int vgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate);
35bool vgpu_check_and_set_global_reservation(
36 struct dbg_session_gk20a *dbg_s,
37 struct dbg_profiler_object_data *prof_obj);
38bool vgpu_check_and_set_context_reservation(
39 struct dbg_session_gk20a *dbg_s,
40 struct dbg_profiler_object_data *prof_obj);
41
42void vgpu_release_profiler_reservation(
43 struct dbg_session_gk20a *dbg_s,
44 struct dbg_profiler_object_data *prof_obj);
45int vgpu_perfbuffer_enable(struct gk20a *g, u64 offset, u32 size);
46int vgpu_perfbuffer_disable(struct gk20a *g);
47#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 00000000..b957a363
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __FECS_TRACE_VGPU_H
24#define __FECS_TRACE_VGPU_H
25
26#include <nvgpu/types.h>
27
28struct gk20a;
29struct vm_area_struct;
30struct nvgpu_ctxsw_trace_filter;
31
32void vgpu_fecs_trace_data_update(struct gk20a *g);
33int vgpu_fecs_trace_init(struct gk20a *g);
34int vgpu_fecs_trace_deinit(struct gk20a *g);
35int vgpu_fecs_trace_enable(struct gk20a *g);
36int vgpu_fecs_trace_disable(struct gk20a *g);
37bool vgpu_fecs_trace_is_enabled(struct gk20a *g);
38int vgpu_fecs_trace_poll(struct gk20a *g);
39int vgpu_alloc_user_buffer(struct gk20a *g, void **buf, size_t *size);
40int vgpu_free_user_buffer(struct gk20a *g);
41int vgpu_mmap_user_buffer(struct gk20a *g, struct vm_area_struct *vma);
42int vgpu_fecs_trace_max_entries(struct gk20a *g,
43 struct nvgpu_ctxsw_trace_filter *filter);
44int vgpu_fecs_trace_set_filter(struct gk20a *g,
45 struct nvgpu_ctxsw_trace_filter *filter);
46
47#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
index fde113e0..580bfb60 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
@@ -3,17 +3,23 @@
3 * 3 *
4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * under the terms and conditions of the GNU General Public License, 7 * copy of this software and associated documentation files (the "Software"),
8 * version 2, as published by the Free Software Foundation. 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
9 * 12 *
10 * This program is distributed in the hope it will be useful, but WITHOUT 13 * The above copyright notice and this permission notice shall be included in
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * all copies or substantial portions of the Software.
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 * 15 *
15 * You should have received a copy of the GNU General Public License 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
17 */ 23 */
18 24
19#include <trace/events/gk20a.h> 25#include <trace/events/gk20a.h>
@@ -25,9 +31,9 @@
25#include <nvgpu/barrier.h> 31#include <nvgpu/barrier.h>
26#include <nvgpu/error_notifier.h> 32#include <nvgpu/error_notifier.h>
27#include <nvgpu/vgpu/vgpu_ivc.h> 33#include <nvgpu/vgpu/vgpu_ivc.h>
34#include <nvgpu/vgpu/vgpu.h>
28 35
29#include "gk20a/gk20a.h" 36#include "gk20a/gk20a.h"
30#include "vgpu.h"
31#include "fifo_vgpu.h" 37#include "fifo_vgpu.h"
32 38
33#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h> 39#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h>
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.h
index 92789ddd..20205d3c 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.h
@@ -1,17 +1,23 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#ifndef _FIFO_VGPU_H_ 23#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 00000000..e83980a6
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.c
@@ -0,0 +1,48 @@
1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include <nvgpu/enabled.h>
24
25#include "gk20a/gk20a.h"
26#include "gk20a/css_gr_gk20a.h"
27#include "vgpu/css_vgpu.h"
28#include "vgpu_gr_gm20b.h"
29
30void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g)
31{
32#if defined(CONFIG_GK20A_CYCLE_STATS)
33 bool snapshots_supported = true;
34
35 /* cyclestats not supported on vgpu */
36 __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS, false);
37
38 g->gr.max_css_buffer_size = vgpu_css_get_buffer_size(g);
39
40 /* snapshots not supported if the buffer size is 0 */
41 if (g->gr.max_css_buffer_size == 0)
42 snapshots_supported = false;
43
44 __nvgpu_set_enabled(g, NVGPU_SUPPORT_CYCLE_STATS_SNAPSHOT,
45 snapshots_supported);
46#endif
47}
48
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 00000000..00759433
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gm20b/vgpu_gr_gm20b.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __VGPU_GR_GM20B_H__
24#define __VGPU_GR_GM20B_H__
25
26#include "gk20a/gk20a.h"
27
28void vgpu_gr_gm20b_init_cyclestats(struct gk20a *g);
29
30#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 00000000..ac187227
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fifo_gp10b.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include "vgpu_fifo_gp10b.h"
24
25void vgpu_gp10b_init_fifo_ops(struct gpu_ops *gops)
26{
27 /* syncpoint protection not supported yet */
28 gops->fifo.resetup_ramfc = NULL;
29 gops->fifo.reschedule_runlist = NULL;
30}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c
index 5ee5d1f6..52b2aee5 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 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * 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
index 2ec8f284..12334f23 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 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * 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
index 9adf20d1..ab35dc67 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 @@
1/* 1/*
2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include <nvgpu/kmem.h> 23#include <nvgpu/kmem.h>
18#include <nvgpu/dma.h> 24#include <nvgpu/dma.h>
19#include <nvgpu/bug.h> 25#include <nvgpu/bug.h>
26#include <nvgpu/vgpu/vgpu.h>
20 27
21#include "common/linux/vgpu/vgpu.h" 28#include "vgpu/gm20b/vgpu_gr_gm20b.h"
22#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h"
23 29
24#include "gp10b/gr_gp10b.h" 30#include "gp10b/gr_gp10b.h"
25#include "vgpu_gr_gp10b.h" 31#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 00000000..0dc53982
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_gr_gp10b.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __VGPU_GR_GP10B_H__
24#define __VGPU_GR_GP10B_H__
25
26#include "gk20a/gk20a.h"
27
28int vgpu_gr_gp10b_alloc_gr_ctx(struct gk20a *g,
29 struct nvgpu_gr_ctx *gr_ctx,
30 struct vm_gk20a *vm,
31 u32 class,
32 u32 flags);
33int vgpu_gr_gp10b_set_ctxsw_preemption_mode(struct gk20a *g,
34 struct nvgpu_gr_ctx *gr_ctx,
35 struct vm_gk20a *vm, u32 class,
36 u32 graphics_preempt_mode,
37 u32 compute_preempt_mode);
38int vgpu_gr_gp10b_set_preemption_mode(struct channel_gk20a *ch,
39 u32 graphics_preempt_mode,
40 u32 compute_preempt_mode);
41int vgpu_gr_gp10b_init_ctx_state(struct gk20a *g);
42
43#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
index 39b92263..f1ced1c8 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 @@
1/* 1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include "common/linux/vgpu/vgpu.h" 23#include "vgpu/fifo_vgpu.h"
18#include "common/linux/vgpu/fifo_vgpu.h" 24#include "vgpu/gr_vgpu.h"
19#include "common/linux/vgpu/gr_vgpu.h" 25#include "vgpu/ltc_vgpu.h"
20#include "common/linux/vgpu/ltc_vgpu.h" 26#include "vgpu/mm_vgpu.h"
21#include "common/linux/vgpu/mm_vgpu.h" 27#include "vgpu/dbg_vgpu.h"
22#include "common/linux/vgpu/dbg_vgpu.h" 28#include "vgpu/fecs_trace_vgpu.h"
23#include "common/linux/vgpu/fecs_trace_vgpu.h" 29#include "vgpu/css_vgpu.h"
24#include "common/linux/vgpu/css_vgpu.h"
25#include "gp10b/gp10b.h" 30#include "gp10b/gp10b.h"
26#include "gp10b/hal_gp10b.h" 31#include "gp10b/hal_gp10b.h"
27#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h" 32#include "vgpu/gm20b/vgpu_gr_gm20b.h"
28#include "vgpu_gr_gp10b.h" 33#include "vgpu_gr_gp10b.h"
29#include "vgpu_mm_gp10b.h" 34#include "vgpu_mm_gp10b.h"
30#include "vgpu_fuse_gp10b.h" 35#include "vgpu_fuse_gp10b.h"
@@ -58,6 +63,7 @@
58#include "gm20b/mm_gm20b.h" 63#include "gm20b/mm_gm20b.h"
59 64
60#include <nvgpu/enabled.h> 65#include <nvgpu/enabled.h>
66#include <nvgpu/vgpu/vgpu.h>
61 67
62#include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> 68#include <nvgpu/hw/gp10b/hw_fuse_gp10b.h>
63#include <nvgpu/hw/gp10b/hw_fifo_gp10b.h> 69#include <nvgpu/hw/gp10b/hw_fifo_gp10b.h>
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_mm_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c
index 26ce891f..cf9a28c7 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 @@
3 * 3 *
4 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * under the terms and conditions of the GNU General Public License, 7 * copy of this software and associated documentation files (the "Software"),
8 * version 2, as published by the Free Software Foundation. 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
9 * 12 *
10 * This program is distributed in the hope it will be useful, but WITHOUT 13 * The above copyright notice and this permission notice shall be included in
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * all copies or substantial portions of the Software.
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 * 15 *
15 * You should have received a copy of the GNU General Public License 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
17 */ 23 */
18 24
19#include "common/linux/vgpu/vgpu.h"
20#include "vgpu_mm_gp10b.h" 25#include "vgpu_mm_gp10b.h"
21#include "gk20a/mm_gk20a.h" 26#include "gk20a/mm_gk20a.h"
22 27
23#include <nvgpu/bug.h> 28#include <nvgpu/bug.h>
24#include <nvgpu/dma.h> 29#include <nvgpu/dma.h>
25#include <nvgpu/vgpu/vgpu_ivc.h> 30#include <nvgpu/vgpu/vgpu_ivc.h>
31#include <nvgpu/vgpu/vgpu.h>
26 32
27int vgpu_gp10b_init_mm_setup_hw(struct gk20a *g) 33int vgpu_gp10b_init_mm_setup_hw(struct gk20a *g)
28{ 34{
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 00000000..44072dd6
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __VGPU_MM_GP10B_H__
24#define __VGPU_MM_GP10B_H__
25
26#include "gk20a/gk20a.h"
27
28u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm,
29 u64 map_offset,
30 struct nvgpu_sgt *sgt,
31 u64 buffer_offset,
32 u64 size,
33 int pgsz_idx,
34 u8 kind_v,
35 u32 ctag_offset,
36 u32 flags,
37 int rw_flag,
38 bool clear_ctags,
39 bool sparse,
40 bool priv,
41 struct vm_gk20a_mapping_batch *batch,
42 enum nvgpu_aperture aperture);
43int vgpu_gp10b_init_mm_setup_hw(struct gk20a *g);
44
45#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index f455763b..ee5a5d36 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -3,17 +3,23 @@
3 * 3 *
4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * under the terms and conditions of the GNU General Public License, 7 * copy of this software and associated documentation files (the "Software"),
8 * version 2, as published by the Free Software Foundation. 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
9 * 12 *
10 * This program is distributed in the hope it will be useful, but WITHOUT 13 * The above copyright notice and this permission notice shall be included in
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * all copies or substantial portions of the Software.
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 * 15 *
15 * You should have received a copy of the GNU General Public License 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
17 */ 23 */
18 24
19#include <nvgpu/kmem.h> 25#include <nvgpu/kmem.h>
@@ -22,8 +28,8 @@
22#include <nvgpu/error_notifier.h> 28#include <nvgpu/error_notifier.h>
23#include <nvgpu/dma.h> 29#include <nvgpu/dma.h>
24#include <nvgpu/vgpu/vgpu_ivc.h> 30#include <nvgpu/vgpu/vgpu_ivc.h>
31#include <nvgpu/vgpu/vgpu.h>
25 32
26#include "vgpu.h"
27#include "gr_vgpu.h" 33#include "gr_vgpu.h"
28#include "gk20a/gk20a.h" 34#include "gk20a/gk20a.h"
29#include "gk20a/dbg_gpu_gk20a.h" 35#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
index efd9e09b..1f55823c 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gr_vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.h
@@ -1,17 +1,23 @@
1/* 1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#ifndef _GR_VGPU_H_ 23#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
index c2129e4b..18d2de70 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 @@
1/* 1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include <gk20a/gk20a.h> 23#include <gk20a/gk20a.h>
18 24#include <nvgpu/vgpu/vgpu.h>
19#include "common/linux/vgpu/vgpu.h"
20#include "gv11b/fifo_gv11b.h"
21#include <nvgpu/nvhost.h> 25#include <nvgpu/nvhost.h>
22#include <nvgpu/vgpu/tegra_vgpu.h> 26#include <nvgpu/vgpu/tegra_vgpu.h>
23 27
28#include "gv11b/fifo_gv11b.h"
29
24#ifdef CONFIG_TEGRA_GK20A_NVHOST 30#ifdef CONFIG_TEGRA_GK20A_NVHOST
25 31
26static int set_syncpt_ro_map_gpu_va_locked(struct vm_gk20a *vm) 32static 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 00000000..6d8f8f60
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.h
@@ -0,0 +1,33 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _VGPU_FIFO_GV11B_H_
24#define _VGPU_FIFO_GV11B_H_
25
26struct gk20a;
27
28int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g);
29int vgpu_gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
30 u32 syncpt_id, struct nvgpu_mem *syncpt_buf);
31int vgpu_gv11b_fifo_get_sync_ro_map(struct vm_gk20a *vm,
32 u64 *base_gpuva, u32 *sync_size);
33#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 00000000..3c93c581
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include "gk20a/gk20a.h"
24#include "vgpu/gr_vgpu.h"
25#include "vgpu_subctx_gv11b.h"
26
27int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va)
28{
29 int err;
30
31 err = vgpu_gv11b_alloc_subctx_header(c);
32 if (err)
33 return err;
34
35 err = vgpu_gr_commit_inst(c, gpu_va);
36 if (err)
37 vgpu_gv11b_free_subctx_header(c);
38
39 return err;
40}
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 00000000..2433dcd9
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _VGPU_GR_GV11B_H_
24#define _VGPU_GR_GV11B_H_
25
26struct channel_gk20a;
27
28int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va);
29
30#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 00000000..a303a3a2
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.c
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include <nvgpu/enabled.h>
24#include <nvgpu/vgpu/vgpu.h>
25
26#include "gk20a/gk20a.h"
27#include "vgpu_gv11b.h"
28
29int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g)
30{
31 int err;
32
33 gk20a_dbg_fn("");
34
35 err = vgpu_init_gpu_characteristics(g);
36 if (err) {
37 nvgpu_err(g, "vgpu_init_gpu_characteristics failed, err %d\n", err);
38 return err;
39 }
40
41 __nvgpu_set_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS, true);
42 __nvgpu_set_enabled(g, NVGPU_SUPPORT_IO_COHERENCE, true);
43 __nvgpu_set_enabled(g, NVGPU_SUPPORT_SCG, true);
44 __nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNCPOINT_ADDRESS, true);
45
46 return 0;
47}
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 00000000..8b2175d9
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gv11b.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _VGPU_GV11B_H_
24#define _VGPU_GV11B_H_
25
26struct gk20a;
27
28int vgpu_gv11b_init_gpu_characteristics(struct gk20a *g);
29
30#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
index 987dd186..76f7b389 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 @@
1/* 1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include <gk20a/gk20a.h> 23#include <gk20a/gk20a.h>
18#include <gv11b/hal_gv11b.h> 24#include <gv11b/hal_gv11b.h>
25#include <nvgpu/vgpu/vgpu.h>
19 26
20#include "common/linux/vgpu/vgpu.h" 27#include "vgpu/fifo_vgpu.h"
21#include "common/linux/vgpu/fifo_vgpu.h" 28#include "vgpu/gr_vgpu.h"
22#include "common/linux/vgpu/gr_vgpu.h" 29#include "vgpu/ltc_vgpu.h"
23#include "common/linux/vgpu/ltc_vgpu.h" 30#include "vgpu/mm_vgpu.h"
24#include "common/linux/vgpu/mm_vgpu.h" 31#include "vgpu/dbg_vgpu.h"
25#include "common/linux/vgpu/dbg_vgpu.h" 32#include "vgpu/fecs_trace_vgpu.h"
26#include "common/linux/vgpu/fecs_trace_vgpu.h" 33#include "vgpu/css_vgpu.h"
27#include "common/linux/vgpu/css_vgpu.h" 34#include "vgpu/gm20b/vgpu_gr_gm20b.h"
28#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h" 35#include "vgpu/gp10b/vgpu_mm_gp10b.h"
29#include "common/linux/vgpu/gp10b/vgpu_mm_gp10b.h" 36#include "vgpu/gp10b/vgpu_gr_gp10b.h"
30#include "common/linux/vgpu/gp10b/vgpu_gr_gp10b.h"
31 37
32#include <gk20a/fb_gk20a.h> 38#include <gk20a/fb_gk20a.h>
33#include <gk20a/flcn_gk20a.h> 39#include <gk20a/flcn_gk20a.h>
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c
index 5fbc7bbe..ba92c8d5 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 @@
1/* 1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include "gk20a/gk20a.h" 23#include "gk20a/gk20a.h"
18#include "common/linux/vgpu/vgpu.h" 24
25#include <nvgpu/vgpu/vgpu.h>
19#include <nvgpu/vgpu/tegra_vgpu.h> 26#include <nvgpu/vgpu/tegra_vgpu.h>
20#include <nvgpu/hw/gv11b/hw_ctxsw_prog_gv11b.h> 27#include <nvgpu/hw/gv11b/hw_ctxsw_prog_gv11b.h>
21 28
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 00000000..4bd0c2de
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _VGPU_SUBCTX_GV11B_H_
24#define _VGPU_SUBCTX_GV11B_H_
25
26struct channel_gk20a;
27
28int vgpu_gv11b_alloc_subctx_header(struct channel_gk20a *c);
29void vgpu_gv11b_free_subctx_header(struct channel_gk20a *c);
30
31#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 00000000..b249b5af
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.c
@@ -0,0 +1,59 @@
1/*
2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include <nvgpu/vgpu/tegra_vgpu.h>
24#include <nvgpu/vgpu/vgpu.h>
25
26#include "gk20a/gk20a.h"
27#include "vgpu_tsg_gv11b.h"
28
29int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
30 struct channel_gk20a *ch)
31{
32 struct tegra_vgpu_cmd_msg msg = {};
33 struct tegra_vgpu_tsg_bind_channel_ex_params *p =
34 &msg.params.tsg_bind_channel_ex;
35 int err;
36
37 gk20a_dbg_fn("");
38
39 err = gk20a_tsg_bind_channel(tsg, ch);
40 if (err)
41 return err;
42
43 msg.cmd = TEGRA_VGPU_CMD_TSG_BIND_CHANNEL_EX;
44 msg.handle = vgpu_get_handle(tsg->g);
45 p->tsg_id = tsg->tsgid;
46 p->ch_handle = ch->virt_ctx;
47 p->subctx_id = ch->subctx_id;
48 p->runqueue_sel = ch->runqueue_sel;
49 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
50 err = err ? err : msg.ret;
51 if (err) {
52 nvgpu_err(tsg->g,
53 "vgpu_gv11b_tsg_bind_channel failed, ch %d tsgid %d",
54 ch->chid, tsg->tsgid);
55 gk20a_tsg_unbind_channel(ch);
56 }
57
58 return err;
59}
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 00000000..9ce84170
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_tsg_gv11b.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _VGPU_TSG_GV11B_H_
24#define _VGPU_TSG_GV11B_H_
25
26int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
27 struct channel_gk20a *ch);
28
29#endif
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
new file mode 100644
index 00000000..7e86ba38
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c
@@ -0,0 +1,69 @@
1/*
2 * Virtualized GPU L2
3 *
4 * Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#include <nvgpu/vgpu/vgpu.h>
26
27#include "gk20a/gk20a.h"
28#include "ltc_vgpu.h"
29
30int vgpu_determine_L2_size_bytes(struct gk20a *g)
31{
32 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
33
34 gk20a_dbg_fn("");
35
36 return priv->constants.l2_size;
37}
38
39int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
40{
41 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
42 u32 max_comptag_lines = 0;
43 int err;
44
45 gk20a_dbg_fn("");
46
47 gr->cacheline_size = priv->constants.cacheline_size;
48 gr->comptags_per_cacheline = priv->constants.comptags_per_cacheline;
49 gr->slices_per_ltc = priv->constants.slices_per_ltc;
50 max_comptag_lines = priv->constants.comptag_lines;
51
52 if (max_comptag_lines < 2)
53 return -ENXIO;
54
55 err = gk20a_comptag_allocator_init(g, &gr->comp_tags, max_comptag_lines);
56 if (err)
57 return err;
58
59 return 0;
60}
61
62void vgpu_ltc_init_fs_state(struct gk20a *g)
63{
64 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
65
66 gk20a_dbg_fn("");
67
68 g->ltc_count = priv->constants.ltc_count;
69}
diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.h b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.h
new file mode 100644
index 00000000..adc76171
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.h
@@ -0,0 +1,33 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _LTC_VGPU_H_
24#define _LTC_VGPU_H_
25
26struct gk20a;
27struct gr_gk20a;
28
29int vgpu_determine_L2_size_bytes(struct gk20a *g);
30int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr);
31void vgpu_ltc_init_fs_state(struct gk20a *g);
32
33#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
index db3d6d03..21496906 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
@@ -3,17 +3,23 @@
3 * 3 *
4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * under the terms and conditions of the GNU General Public License, 7 * copy of this software and associated documentation files (the "Software"),
8 * version 2, as published by the Free Software Foundation. 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
9 * 12 *
10 * This program is distributed in the hope it will be useful, but WITHOUT 13 * The above copyright notice and this permission notice shall be included in
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * all copies or substantial portions of the Software.
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 * 15 *
15 * You should have received a copy of the GNU General Public License 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
17 */ 23 */
18 24
19#include <nvgpu/kmem.h> 25#include <nvgpu/kmem.h>
@@ -23,11 +29,11 @@
23#include <nvgpu/vm_area.h> 29#include <nvgpu/vm_area.h>
24 30
25#include <nvgpu/vgpu/vm.h> 31#include <nvgpu/vgpu/vm.h>
32#include <nvgpu/vgpu/vgpu.h>
26 33
27#include <nvgpu/linux/vm.h> 34#include <nvgpu/linux/vm.h>
28#include <nvgpu/linux/nvgpu_mem.h> 35#include <nvgpu/linux/nvgpu_mem.h>
29 36
30#include "vgpu.h"
31#include "mm_vgpu.h" 37#include "mm_vgpu.h"
32#include "gk20a/gk20a.h" 38#include "gk20a/gk20a.h"
33#include "gk20a/mm_gk20a.h" 39#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 00000000..12265fc1
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef _MM_VGPU_H_
24#define _MM_VGPU_H_
25
26struct nvgpu_mem;
27struct channel_gk20a;
28struct vm_gk20a_mapping_batch;
29struct gk20a_as_share;
30struct vm_gk20a;
31
32void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm,
33 u64 vaddr,
34 u64 size,
35 int pgsz_idx,
36 bool va_allocated,
37 int rw_flag,
38 bool sparse,
39 struct vm_gk20a_mapping_batch *batch);
40int vgpu_vm_bind_channel(struct gk20a_as_share *as_share,
41 struct channel_gk20a *ch);
42int vgpu_mm_fb_flush(struct gk20a *g);
43void vgpu_mm_l2_invalidate(struct gk20a *g);
44void vgpu_mm_l2_flush(struct gk20a *g, bool invalidate);
45void vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb);
46void vgpu_mm_mmu_set_debug_mode(struct gk20a *g, bool enable);
47#endif
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
index 421763ec..a6e493d0 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
@@ -1,28 +1,33 @@
1/* 1/*
2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include "gk20a/gk20a.h" 23#include "gk20a/gk20a.h"
18#include "gk20a/channel_gk20a.h" 24#include "gk20a/channel_gk20a.h"
19#include "gk20a/tsg_gk20a.h" 25#include "gk20a/tsg_gk20a.h"
20#include "common/linux/platform_gk20a.h"
21#include "vgpu.h"
22#include "fifo_vgpu.h" 26#include "fifo_vgpu.h"
23 27
24#include <nvgpu/bug.h> 28#include <nvgpu/bug.h>
25#include <nvgpu/vgpu/tegra_vgpu.h> 29#include <nvgpu/vgpu/tegra_vgpu.h>
30#include <nvgpu/vgpu/vgpu.h>
26 31
27int vgpu_tsg_open(struct tsg_gk20a *tsg) 32int vgpu_tsg_open(struct tsg_gk20a *tsg)
28{ 33{
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 7915a599..eb56d4f9 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -1,25 +1,31 @@
1/* 1/*
2 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#include <nvgpu/enabled.h> 23#include <nvgpu/enabled.h>
18#include <nvgpu/bus.h> 24#include <nvgpu/bus.h>
19#include <nvgpu/vgpu/vgpu_ivc.h> 25#include <nvgpu/vgpu/vgpu_ivc.h>
26#include <nvgpu/vgpu/vgpu.h>
20 27
21#include "gk20a/gk20a.h" 28#include "gk20a/gk20a.h"
22#include "vgpu.h"
23#include "fecs_trace_vgpu.h" 29#include "fecs_trace_vgpu.h"
24 30
25int vgpu_comm_init(struct gk20a *g) 31int vgpu_comm_init(struct gk20a *g)