diff options
author | seshendra Gadagottu <sgadagottu@nvidia.com> | 2017-06-29 18:59:05 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-07-05 18:40:25 -0400 |
commit | 6d758eb81bcbff4e50df5c9fa67a369a4e1f2074 (patch) | |
tree | 8b6f62c1cb64f878c13746b8f14d42a2d45105e6 /drivers/gpu/nvgpu/common/linux | |
parent | 37fa5128ec260bc9ebb2e902ac2dfe9baead4656 (diff) |
gpu: nvgpu: gv11b: support for full subcontext
Changes to enable 64 subcontexts: 1 SYNC + 63 ASYNC
Currently all subcontexts with in a tsg can have only
single address space.
Add support for NVGPU_TSG_IOCTL_BIND_CHANNEL_EX for
selecting subctx id by client.
Bug 1842197
Change-Id: Icf56a41303bd1ad7fc6f2a6fbc691bb7b4a01d22
Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master/r/1511145
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c | 87 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.h | 21 |
2 files changed, 108 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c new file mode 100644 index 00000000..bf6088ab --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * GV11B TSG IOCTL Handler | ||
3 | * | ||
4 | * Copyright (c) 2017, 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 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | #include "gk20a/gk20a.h" | ||
19 | |||
20 | #include "gv11b/fifo_gv11b.h" | ||
21 | #include "gv11b/subctx_gv11b.h" | ||
22 | #include "ioctl_tsg_t19x.h" | ||
23 | |||
24 | static int gv11b_tsg_ioctl_bind_channel_ex(struct gk20a *g, | ||
25 | struct tsg_gk20a *tsg, struct nvgpu_tsg_bind_channel_ex_args *arg) | ||
26 | { | ||
27 | struct gk20a_sched_ctrl *sched = &g->sched_ctrl; | ||
28 | struct channel_gk20a *ch; | ||
29 | int err = 0; | ||
30 | |||
31 | nvgpu_log(g, gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); | ||
32 | |||
33 | nvgpu_mutex_acquire(&sched->control_lock); | ||
34 | if (sched->control_locked) { | ||
35 | err = -EPERM; | ||
36 | goto done; | ||
37 | } | ||
38 | err = gk20a_busy(g); | ||
39 | if (err) { | ||
40 | nvgpu_err(g, "failed to power on gpu"); | ||
41 | goto done; | ||
42 | } | ||
43 | |||
44 | ch = gk20a_get_channel_from_file(arg->channel_fd); | ||
45 | if (!ch) | ||
46 | return -EINVAL; | ||
47 | if (arg->subcontext_id < gv11b_get_max_subctx_count(g)) | ||
48 | ch->t19x.subctx_id = arg->subcontext_id; | ||
49 | else | ||
50 | return -EINVAL; | ||
51 | nvgpu_log(g, gpu_dbg_info, "channel id : %d : subctx: %d", | ||
52 | ch->chid, ch->t19x.subctx_id); | ||
53 | |||
54 | /* Use runqueue selector 1 for all ASYNC ids */ | ||
55 | if (ch->t19x.subctx_id > CHANNEL_INFO_VEID0) | ||
56 | ch->t19x.runqueue_sel = 1; | ||
57 | |||
58 | err = ch->g->ops.fifo.tsg_bind_channel(tsg, ch); | ||
59 | gk20a_idle(g); | ||
60 | done: | ||
61 | nvgpu_mutex_release(&sched->control_lock); | ||
62 | return err; | ||
63 | } | ||
64 | |||
65 | int t19x_tsg_ioctl_handler(struct gk20a *g, struct tsg_gk20a *tsg, | ||
66 | unsigned int cmd, u8 *buf) | ||
67 | { | ||
68 | int err = 0; | ||
69 | |||
70 | nvgpu_log(g, gpu_dbg_fn, "t19x_tsg_ioctl_handler"); | ||
71 | |||
72 | switch (cmd) { | ||
73 | case NVGPU_TSG_IOCTL_BIND_CHANNEL_EX: | ||
74 | { | ||
75 | err = gv11b_tsg_ioctl_bind_channel_ex(g, tsg, | ||
76 | (struct nvgpu_tsg_bind_channel_ex_args *)buf); | ||
77 | break; | ||
78 | } | ||
79 | |||
80 | default: | ||
81 | nvgpu_err(g, "unrecognized tsg gpu ioctl cmd: 0x%x", | ||
82 | cmd); | ||
83 | err = -ENOTTY; | ||
84 | break; | ||
85 | } | ||
86 | return err; | ||
87 | } | ||
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.h b/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.h new file mode 100644 index 00000000..3376ffce --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * GV11B TSG IOCTL handler | ||
3 | * | ||
4 | * Copyright (c) 2017, 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 | |||
16 | #ifndef _NVGPU_IOCTL_TSG_T19X | ||
17 | #define _NVGPU_IOCTL_TSG_T19X | ||
18 | |||
19 | int t19x_tsg_ioctl_handler(struct gk20a *g, struct tsg_gk20a *tsg, | ||
20 | unsigned int cmd, u8 *arg); | ||
21 | #endif | ||