summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/fifo/channel.c
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2019-08-07 02:27:28 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2019-08-15 03:57:45 -0400
commit58ee7561f72653aea8acece9f5d33ff8fe6fb99d (patch)
tree9af9a5b706a9cdb52a0e32e2364edbe93dbdd69a /drivers/gpu/nvgpu/common/fifo/channel.c
parentae175e45edc5807131dfb1b63d3e4795e96a3f86 (diff)
gpu: nvgpu: Add CHANNEL_SETUP_BIND IOCTL
For a long time now, the ALLOC_GPFIFO_EX channel IOCTL has done much more than just gpfifo allocation, and its signature does not match support that's needed soon. Add a new one called SETUP_BIND to hopefully cover our future needs and deprecate ALLOC_GPFIFO_EX. Change nvgpu internals to match this new naming as well. Bug 200145225 Bug 200541476 Change-Id: I766f9283a064e140656f6004b2b766db70bd6cad Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1835186 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> (cherry-picked from e0c8a16c8d474eac6723fea3980833873ab921a6 in dev-main) Reviewed-on: https://git-master.nvidia.com/r/2169882 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/fifo/channel.c')
-rw-r--r--drivers/gpu/nvgpu/common/fifo/channel.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c
index fefd90d8..adb59ac4 100644
--- a/drivers/gpu/nvgpu/common/fifo/channel.c
+++ b/drivers/gpu/nvgpu/common/fifo/channel.c
@@ -1131,8 +1131,8 @@ static void channel_gk20a_free_prealloc_resources(struct channel_gk20a *c)
1131 c->joblist.pre_alloc.enabled = false; 1131 c->joblist.pre_alloc.enabled = false;
1132} 1132}
1133 1133
1134int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, 1134int nvgpu_channel_setup_bind(struct channel_gk20a *c,
1135 struct nvgpu_gpfifo_args *gpfifo_args) 1135 struct nvgpu_setup_bind_args *args)
1136{ 1136{
1137 struct gk20a *g = c->g; 1137 struct gk20a *g = c->g;
1138 struct vm_gk20a *ch_vm; 1138 struct vm_gk20a *ch_vm;
@@ -1141,14 +1141,14 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1141 int err = 0; 1141 int err = 0;
1142 unsigned long acquire_timeout; 1142 unsigned long acquire_timeout;
1143 1143
1144 gpfifo_size = gpfifo_args->num_entries; 1144 gpfifo_size = args->num_gpfifo_entries;
1145 gpfifo_entry_size = nvgpu_get_gpfifo_entry_size(); 1145 gpfifo_entry_size = nvgpu_get_gpfifo_entry_size();
1146 1146
1147 if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_VPR) { 1147 if (args->flags & NVGPU_SETUP_BIND_FLAGS_SUPPORT_VPR) {
1148 c->vpr = true; 1148 c->vpr = true;
1149 } 1149 }
1150 1150
1151 if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC) { 1151 if (args->flags & NVGPU_SETUP_BIND_FLAGS_SUPPORT_DETERMINISTIC) {
1152 nvgpu_rwsem_down_read(&g->deterministic_busy); 1152 nvgpu_rwsem_down_read(&g->deterministic_busy);
1153 /* 1153 /*
1154 * Railgating isn't deterministic; instead of disallowing 1154 * Railgating isn't deterministic; instead of disallowing
@@ -1172,8 +1172,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1172 /* an address space needs to have been bound at this point. */ 1172 /* an address space needs to have been bound at this point. */
1173 if (!gk20a_channel_as_bound(c)) { 1173 if (!gk20a_channel_as_bound(c)) {
1174 nvgpu_err(g, 1174 nvgpu_err(g,
1175 "not bound to an address space at time of gpfifo" 1175 "not bound to an address space at time of setup_bind");
1176 " allocation.");
1177 err = -EINVAL; 1176 err = -EINVAL;
1178 goto clean_up_idle; 1177 goto clean_up_idle;
1179 } 1178 }
@@ -1187,10 +1186,9 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1187 goto clean_up_idle; 1186 goto clean_up_idle;
1188 } 1187 }
1189 1188
1190 if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_USERMODE_SUPPORT) { 1189 if (args->flags & NVGPU_SETUP_BIND_FLAGS_USERMODE_SUPPORT) {
1191 if (g->os_channel.alloc_usermode_buffers) { 1190 if (g->os_channel.alloc_usermode_buffers) {
1192 err = g->os_channel.alloc_usermode_buffers(c, 1191 err = g->os_channel.alloc_usermode_buffers(c, args);
1193 gpfifo_args);
1194 if (err) { 1192 if (err) {
1195 nvgpu_err(g, "Usermode buffer alloc failed"); 1193 nvgpu_err(g, "Usermode buffer alloc failed");
1196 goto clean_up; 1194 goto clean_up;
@@ -1258,23 +1256,23 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1258 1256
1259 err = g->ops.fifo.setup_ramfc(c, gpfifo_gpu_va, 1257 err = g->ops.fifo.setup_ramfc(c, gpfifo_gpu_va,
1260 c->gpfifo.entry_num, 1258 c->gpfifo.entry_num,
1261 acquire_timeout, gpfifo_args->flags); 1259 acquire_timeout, args->flags);
1262 if (err) { 1260 if (err) {
1263 goto clean_up_sync; 1261 goto clean_up_sync;
1264 } 1262 }
1265 1263
1266 /* TBD: setup engine contexts */ 1264 /* TBD: setup engine contexts */
1267 1265
1268 if (c->deterministic && gpfifo_args->num_inflight_jobs != 0U) { 1266 if (c->deterministic && args->num_inflight_jobs != 0U) {
1269 err = channel_gk20a_prealloc_resources(c, 1267 err = channel_gk20a_prealloc_resources(c,
1270 gpfifo_args->num_inflight_jobs); 1268 args->num_inflight_jobs);
1271 if (err) { 1269 if (err) {
1272 goto clean_up_sync; 1270 goto clean_up_sync;
1273 } 1271 }
1274 } 1272 }
1275 1273
1276 err = channel_gk20a_alloc_priv_cmdbuf(c, 1274 err = channel_gk20a_alloc_priv_cmdbuf(c,
1277 gpfifo_args->num_inflight_jobs); 1275 args->num_inflight_jobs);
1278 if (err) { 1276 if (err) {
1279 goto clean_up_prealloc; 1277 goto clean_up_prealloc;
1280 } 1278 }
@@ -1292,7 +1290,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1292clean_up_priv_cmd: 1290clean_up_priv_cmd:
1293 channel_gk20a_free_priv_cmdbuf(c); 1291 channel_gk20a_free_priv_cmdbuf(c);
1294clean_up_prealloc: 1292clean_up_prealloc:
1295 if (c->deterministic && gpfifo_args->num_inflight_jobs != 0U) { 1293 if (c->deterministic && args->num_inflight_jobs != 0U) {
1296 channel_gk20a_free_prealloc_resources(c); 1294 channel_gk20a_free_prealloc_resources(c);
1297 } 1295 }
1298clean_up_sync: 1296clean_up_sync: