summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-01-10 19:06:30 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-12 15:43:40 -0500
commit9dd3bb2e62c321bb48c14f3e76c00a754cd12c5f (patch)
tree48e1242d3f17ae0ef02ef0f724c95ce5c30b6338
parentece3d958b306f00dad76ed6f9b83ce136b4769f2 (diff)
gpu: nvgpu: vgpu: move t19x specific code to general code
- remove vgpu_t19x.h and tegra_vgpu_t19x.h - merge t19x specific ivc commands to the big enum - move TEGRA_VGPU_ATTRIB_MAX_SUBCTX_COUNT to constants Jira EVLR-2293 Change-Id: I34344bffa03bb69e1282b1f19382e3199f9ba105 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1636128 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c7
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c12
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c1
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h1
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu_t19x.h30
-rw-r--r--include/linux/tegra_vgpu.h40
-rw-r--r--include/linux/tegra_vgpu_t19x.h55
11 files changed, 44 insertions, 112 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index cc2b5ec7..b95bac0b 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -52,9 +52,6 @@
52#include "sim.h" 52#include "sim.h"
53#ifdef CONFIG_TEGRA_19x_GPU 53#ifdef CONFIG_TEGRA_19x_GPU
54#include "nvgpu_gpuid_t19x.h" 54#include "nvgpu_gpuid_t19x.h"
55#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
56#include "vgpu/vgpu_t19x.h"
57#endif
58#endif 55#endif
59 56
60#include "os_linux.h" 57#include "os_linux.h"
@@ -389,8 +386,8 @@ static struct of_device_id tegra_gk20a_of_match[] = {
389 { .compatible = TEGRA_19x_GPU_COMPAT_TEGRA, 386 { .compatible = TEGRA_19x_GPU_COMPAT_TEGRA,
390 .data = &t19x_gpu_tegra_platform }, 387 .data = &t19x_gpu_tegra_platform },
391#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 388#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
392 { .compatible = TEGRA_19x_VGPU_COMPAT_TEGRA, 389 { .compatible = "nvidia,gv11b-vgpu",
393 .data = &t19x_vgpu_tegra_platform }, 390 .data = &gv11b_vgpu_tegra_platform},
394#endif 391#endif
395#endif 392#endif
396#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 393#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
index b8201954..37c80a70 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
@@ -252,6 +252,7 @@ extern struct gk20a_platform gm20b_tegra_platform;
252extern struct gk20a_platform gp10b_tegra_platform; 252extern struct gk20a_platform gp10b_tegra_platform;
253#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 253#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
254extern struct gk20a_platform vgpu_tegra_platform; 254extern struct gk20a_platform vgpu_tegra_platform;
255extern struct gk20a_platform gv11b_vgpu_tegra_platform;
255#endif 256#endif
256#endif 257#endif
257 258
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c
index 710e4b90..475036ee 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_fifo_gv11b.c
@@ -30,7 +30,7 @@ int vgpu_gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
30 struct gk20a *g = c->g; 30 struct gk20a *g = c->g;
31 struct vm_gk20a *vm = c->vm; 31 struct vm_gk20a *vm = c->vm;
32 struct tegra_vgpu_cmd_msg msg = {}; 32 struct tegra_vgpu_cmd_msg msg = {};
33 struct tegra_vgpu_map_syncpt_params *p = &msg.params.t19x.map_syncpt; 33 struct tegra_vgpu_map_syncpt_params *p = &msg.params.map_syncpt;
34 34
35 /* 35 /*
36 * Add ro map for complete sync point shim range in vm. 36 * Add ro map for complete sync point shim range in vm.
@@ -97,15 +97,9 @@ int vgpu_gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
97int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g) 97int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g)
98{ 98{
99 struct fifo_gk20a *f = &g->fifo; 99 struct fifo_gk20a *f = &g->fifo;
100 int err; 100 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
101 101
102 err = vgpu_get_attribute(vgpu_get_handle(g), 102 f->t19x.max_subctx_count = priv->constants.max_subctx_count;
103 TEGRA_VGPU_ATTRIB_MAX_SUBCTX_COUNT,
104 &f->t19x.max_subctx_count);
105 if (err) {
106 nvgpu_err(g, "get max_subctx_count failed %d", err);
107 return err;
108 }
109 103
110 return 0; 104 return 0;
111} 105}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
index f6302d15..968eae10 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
@@ -25,7 +25,6 @@
25#include "common/linux/vgpu/dbg_vgpu.h" 25#include "common/linux/vgpu/dbg_vgpu.h"
26#include "common/linux/vgpu/fecs_trace_vgpu.h" 26#include "common/linux/vgpu/fecs_trace_vgpu.h"
27#include "common/linux/vgpu/css_vgpu.h" 27#include "common/linux/vgpu/css_vgpu.h"
28#include "common/linux/vgpu/vgpu_t19x.h"
29#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h" 28#include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h"
30#include "common/linux/vgpu/gp10b/vgpu_mm_gp10b.h" 29#include "common/linux/vgpu/gp10b/vgpu_mm_gp10b.h"
31#include "common/linux/vgpu/gp10b/vgpu_gr_gp10b.h" 30#include "common/linux/vgpu/gp10b/vgpu_gr_gp10b.h"
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
index 1e2de14d..d59f0381 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
@@ -24,7 +24,7 @@ int vgpu_gv11b_alloc_subctx_header(struct channel_gk20a *c)
24 struct ctx_header_desc *ctx = &c->ch_ctx.ctx_header; 24 struct ctx_header_desc *ctx = &c->ch_ctx.ctx_header;
25 struct tegra_vgpu_cmd_msg msg = {}; 25 struct tegra_vgpu_cmd_msg msg = {};
26 struct tegra_vgpu_alloc_ctx_header_params *p = 26 struct tegra_vgpu_alloc_ctx_header_params *p =
27 &msg.params.t19x.alloc_ctx_header; 27 &msg.params.alloc_ctx_header;
28 int err; 28 int err;
29 29
30 msg.cmd = TEGRA_VGPU_CMD_ALLOC_CTX_HEADER; 30 msg.cmd = TEGRA_VGPU_CMD_ALLOC_CTX_HEADER;
@@ -55,7 +55,7 @@ void vgpu_gv11b_free_subctx_header(struct channel_gk20a *c)
55 struct ctx_header_desc *ctx = &c->ch_ctx.ctx_header; 55 struct ctx_header_desc *ctx = &c->ch_ctx.ctx_header;
56 struct tegra_vgpu_cmd_msg msg = {}; 56 struct tegra_vgpu_cmd_msg msg = {};
57 struct tegra_vgpu_free_ctx_header_params *p = 57 struct tegra_vgpu_free_ctx_header_params *p =
58 &msg.params.t19x.free_ctx_header; 58 &msg.params.free_ctx_header;
59 int err; 59 int err;
60 60
61 if (ctx->mem.gpu_va) { 61 if (ctx->mem.gpu_va) {
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
index 094ccc44..c2e01218 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_tsg_gv11b.c
@@ -25,7 +25,7 @@ int vgpu_gv11b_tsg_bind_channel(struct tsg_gk20a *tsg,
25{ 25{
26 struct tegra_vgpu_cmd_msg msg = {}; 26 struct tegra_vgpu_cmd_msg msg = {};
27 struct tegra_vgpu_tsg_bind_channel_ex_params *p = 27 struct tegra_vgpu_tsg_bind_channel_ex_params *p =
28 &msg.params.t19x.tsg_bind_channel_ex; 28 &msg.params.tsg_bind_channel_ex;
29 int err; 29 int err;
30 30
31 gk20a_dbg_fn(""); 31 gk20a_dbg_fn("");
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
index bb523f1e..0d04d6e4 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
@@ -48,7 +48,6 @@
48#include "common/linux/driver_common.h" 48#include "common/linux/driver_common.h"
49 49
50#ifdef CONFIG_TEGRA_19x_GPU 50#ifdef CONFIG_TEGRA_19x_GPU
51#include "common/linux/vgpu/vgpu_t19x.h"
52#include <nvgpu_gpuid_t19x.h> 51#include <nvgpu_gpuid_t19x.h>
53#endif 52#endif
54 53
@@ -439,7 +438,7 @@ static int vgpu_init_hal(struct gk20a *g)
439 break; 438 break;
440#ifdef CONFIG_TEGRA_19x_GPU 439#ifdef CONFIG_TEGRA_19x_GPU
441 case TEGRA_19x_GPUID: 440 case TEGRA_19x_GPUID:
442 err = vgpu_t19x_init_hal(g); 441 err = vgpu_gv11b_init_hal(g);
443 break; 442 break;
444#endif 443#endif
445 default: 444 default:
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
index 8d1464d4..8c306ea0 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
@@ -103,6 +103,7 @@ int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in,
103 size_t size_out); 103 size_t size_out);
104 104
105int vgpu_gp10b_init_hal(struct gk20a *g); 105int vgpu_gp10b_init_hal(struct gk20a *g);
106int vgpu_gv11b_init_hal(struct gk20a *g);
106 107
107int vgpu_init_gpu_characteristics(struct gk20a *g); 108int vgpu_init_gpu_characteristics(struct gk20a *g);
108 109
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_t19x.h b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_t19x.h
deleted file mode 100644
index faa5f772..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu_t19x.h
+++ /dev/null
@@ -1,30 +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_T19X_H_
18#define _VGPU_T19X_H_
19
20struct gk20a;
21
22int vgpu_gv11b_init_hal(struct gk20a *g);
23
24#define vgpu_t19x_init_hal(g) vgpu_gv11b_init_hal(g)
25
26#define TEGRA_19x_VGPU_COMPAT_TEGRA "nvidia,gv11b-vgpu"
27extern struct gk20a_platform gv11b_vgpu_tegra_platform;
28#define t19x_vgpu_tegra_platform gv11b_vgpu_tegra_platform
29
30#endif
diff --git a/include/linux/tegra_vgpu.h b/include/linux/tegra_vgpu.h
index 74148294..105870dc 100644
--- a/include/linux/tegra_vgpu.h
+++ b/include/linux/tegra_vgpu.h
@@ -21,10 +21,6 @@
21 21
22#include <nvgpu/types.h> 22#include <nvgpu/types.h>
23 23
24#ifdef CONFIG_TEGRA_19x_GPU
25#include <linux/tegra_vgpu_t19x.h>
26#endif
27
28enum { 24enum {
29 TEGRA_VGPU_MODULE_GPU = 0, 25 TEGRA_VGPU_MODULE_GPU = 0,
30}; 26};
@@ -112,6 +108,10 @@ enum {
112 TEGRA_VGPU_CMD_GET_TIMESTAMPS_ZIPPER = 74, 108 TEGRA_VGPU_CMD_GET_TIMESTAMPS_ZIPPER = 74,
113 TEGRA_VGPU_CMD_TSG_RELEASE = 75, 109 TEGRA_VGPU_CMD_TSG_RELEASE = 75,
114 TEGRA_VGPU_CMD_GET_VSMS_MAPPING = 76, 110 TEGRA_VGPU_CMD_GET_VSMS_MAPPING = 76,
111 TEGRA_VGPU_CMD_ALLOC_CTX_HEADER = 77,
112 TEGRA_VGPU_CMD_FREE_CTX_HEADER = 78,
113 TEGRA_VGPU_CMD_MAP_SYNCPT = 79,
114 TEGRA_VGPU_CMD_TSG_BIND_CHANNEL_EX = 80,
115}; 115};
116 116
117struct tegra_vgpu_connect_params { 117struct tegra_vgpu_connect_params {
@@ -484,6 +484,7 @@ struct tegra_vgpu_constants_params {
484 struct tegra_vgpu_engines_info engines_info; 484 struct tegra_vgpu_engines_info engines_info;
485 u32 num_pce; 485 u32 num_pce;
486 u32 sm_per_tpc; 486 u32 sm_per_tpc;
487 u32 max_subctx_count;
487}; 488};
488 489
489struct tegra_vgpu_channel_cyclestats_snapshot_params { 490struct tegra_vgpu_channel_cyclestats_snapshot_params {
@@ -543,6 +544,30 @@ struct tegra_vgpu_vsms_mapping_entry {
543 u32 global_tpc_index; 544 u32 global_tpc_index;
544}; 545};
545 546
547struct tegra_vgpu_alloc_ctx_header_params {
548 u64 ch_handle;
549 u64 ctx_header_va;
550};
551
552struct tegra_vgpu_free_ctx_header_params {
553 u64 ch_handle;
554};
555
556struct tegra_vgpu_map_syncpt_params {
557 u64 as_handle;
558 u64 gpu_va;
559 u64 len;
560 u64 offset;
561 u8 prot;
562};
563
564struct tegra_vgpu_tsg_bind_channel_ex_params {
565 u32 tsg_id;
566 u64 ch_handle;
567 u32 subctx_id;
568 u32 runqueue_sel;
569};
570
546struct tegra_vgpu_cmd_msg { 571struct tegra_vgpu_cmd_msg {
547 u32 cmd; 572 u32 cmd;
548 int ret; 573 int ret;
@@ -598,9 +623,10 @@ struct tegra_vgpu_cmd_msg {
598 struct tegra_vgpu_get_timestamps_zipper_params get_timestamps_zipper; 623 struct tegra_vgpu_get_timestamps_zipper_params get_timestamps_zipper;
599 struct tegra_vgpu_get_gpu_freq_table_params get_gpu_freq_table; 624 struct tegra_vgpu_get_gpu_freq_table_params get_gpu_freq_table;
600 struct tegra_vgpu_vsms_mapping_params vsms_mapping; 625 struct tegra_vgpu_vsms_mapping_params vsms_mapping;
601#ifdef CONFIG_TEGRA_19x_GPU 626 struct tegra_vgpu_alloc_ctx_header_params alloc_ctx_header;
602 union tegra_vgpu_t19x_params t19x; 627 struct tegra_vgpu_free_ctx_header_params free_ctx_header;
603#endif 628 struct tegra_vgpu_map_syncpt_params map_syncpt;
629 struct tegra_vgpu_tsg_bind_channel_ex_params tsg_bind_channel_ex;
604 char padding[192]; 630 char padding[192];
605 } params; 631 } params;
606}; 632};
diff --git a/include/linux/tegra_vgpu_t19x.h b/include/linux/tegra_vgpu_t19x.h
deleted file mode 100644
index 38dbbf60..00000000
--- a/include/linux/tegra_vgpu_t19x.h
+++ /dev/null
@@ -1,55 +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
14#ifndef __TEGRA_VGPU_T19X_H
15#define __TEGRA_VGPU_T19X_H
16
17#define TEGRA_VGPU_CMD_ALLOC_CTX_HEADER 100
18#define TEGRA_VGPU_CMD_FREE_CTX_HEADER 101
19#define TEGRA_VGPU_CMD_MAP_SYNCPT 102
20#define TEGRA_VGPU_CMD_TSG_BIND_CHANNEL_EX 103
21
22struct tegra_vgpu_alloc_ctx_header_params {
23 u64 ch_handle;
24 u64 ctx_header_va;
25};
26
27struct tegra_vgpu_free_ctx_header_params {
28 u64 ch_handle;
29};
30
31struct tegra_vgpu_map_syncpt_params {
32 u64 as_handle;
33 u64 gpu_va;
34 u64 len;
35 u64 offset;
36 u8 prot;
37};
38
39struct tegra_vgpu_tsg_bind_channel_ex_params {
40 u32 tsg_id;
41 u64 ch_handle;
42 u32 subctx_id;
43 u32 runqueue_sel;
44};
45
46union tegra_vgpu_t19x_params {
47 struct tegra_vgpu_alloc_ctx_header_params alloc_ctx_header;
48 struct tegra_vgpu_free_ctx_header_params free_ctx_header;
49 struct tegra_vgpu_map_syncpt_params map_syncpt;
50 struct tegra_vgpu_tsg_bind_channel_ex_params tsg_bind_channel_ex;
51};
52
53#define TEGRA_VGPU_ATTRIB_MAX_SUBCTX_COUNT 100
54
55#endif