summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ce2_gk20a.c6
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c18
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h10
3 files changed, 20 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
index 5841c72c..87eff813 100644
--- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
@@ -406,6 +406,7 @@ u32 gk20a_ce_create_context(struct gk20a *g,
406{ 406{
407 struct gk20a_gpu_ctx *ce_ctx; 407 struct gk20a_gpu_ctx *ce_ctx;
408 struct gk20a_ce_app *ce_app = &g->ce_app; 408 struct gk20a_ce_app *ce_app = &g->ce_app;
409 struct nvgpu_gpfifo_args gpfifo_args;
409 u32 ctx_id = ~0; 410 u32 ctx_id = ~0;
410 int err = 0; 411 int err = 0;
411 412
@@ -458,8 +459,11 @@ u32 gk20a_ce_create_context(struct gk20a *g,
458 goto end; 459 goto end;
459 } 460 }
460 461
462 gpfifo_args.num_entries = 1024;
463 gpfifo_args.num_inflight_jobs = 0;
464 gpfifo_args.flags = 0;
461 /* allocate gpfifo (1024 should be more than enough) */ 465 /* allocate gpfifo (1024 should be more than enough) */
462 err = gk20a_channel_alloc_gpfifo(ce_ctx->ch, 1024, 0, 0); 466 err = gk20a_channel_alloc_gpfifo(ce_ctx->ch, &gpfifo_args);
463 if (err) { 467 if (err) {
464 nvgpu_err(g, "ce: unable to allocate gpfifo"); 468 nvgpu_err(g, "ce: unable to allocate gpfifo");
465 goto end; 469 goto end;
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 8b9f02df..83c49d52 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -1034,9 +1034,7 @@ static void channel_gk20a_free_prealloc_resources(struct channel_gk20a *c)
1034} 1034}
1035 1035
1036int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, 1036int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1037 unsigned int num_entries, 1037 struct nvgpu_gpfifo_args *gpfifo_args)
1038 unsigned int num_inflight_jobs,
1039 u32 flags)
1040{ 1038{
1041 struct gk20a *g = c->g; 1039 struct gk20a *g = c->g;
1042 struct vm_gk20a *ch_vm; 1040 struct vm_gk20a *ch_vm;
@@ -1044,13 +1042,13 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1044 int err = 0; 1042 int err = 0;
1045 unsigned long acquire_timeout; 1043 unsigned long acquire_timeout;
1046 1044
1047 gpfifo_size = num_entries; 1045 gpfifo_size = gpfifo_args->num_entries;
1048 gpfifo_entry_size = nvgpu_get_gpfifo_entry_size(); 1046 gpfifo_entry_size = nvgpu_get_gpfifo_entry_size();
1049 1047
1050 if (flags & NVGPU_GPFIFO_FLAGS_SUPPORT_VPR) 1048 if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_VPR)
1051 c->vpr = true; 1049 c->vpr = true;
1052 1050
1053 if (flags & NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC) { 1051 if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC) {
1054 nvgpu_rwsem_down_read(&g->deterministic_busy); 1052 nvgpu_rwsem_down_read(&g->deterministic_busy);
1055 /* 1053 /*
1056 * Railgating isn't deterministic; instead of disallowing 1054 * Railgating isn't deterministic; instead of disallowing
@@ -1137,15 +1135,15 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1137 1135
1138 err = g->ops.fifo.setup_ramfc(c, c->gpfifo.mem.gpu_va, 1136 err = g->ops.fifo.setup_ramfc(c, c->gpfifo.mem.gpu_va,
1139 c->gpfifo.entry_num, 1137 c->gpfifo.entry_num,
1140 acquire_timeout, flags); 1138 acquire_timeout, gpfifo_args->flags);
1141 if (err) 1139 if (err)
1142 goto clean_up_sync; 1140 goto clean_up_sync;
1143 1141
1144 /* TBD: setup engine contexts */ 1142 /* TBD: setup engine contexts */
1145 1143
1146 if (num_inflight_jobs) { 1144 if (gpfifo_args->num_inflight_jobs) {
1147 err = channel_gk20a_prealloc_resources(c, 1145 err = channel_gk20a_prealloc_resources(c,
1148 num_inflight_jobs); 1146 gpfifo_args->num_inflight_jobs);
1149 if (err) 1147 if (err)
1150 goto clean_up_sync; 1148 goto clean_up_sync;
1151 } 1149 }
@@ -1166,7 +1164,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
1166clean_up_priv_cmd: 1164clean_up_priv_cmd:
1167 channel_gk20a_free_priv_cmdbuf(c); 1165 channel_gk20a_free_priv_cmdbuf(c);
1168clean_up_prealloc: 1166clean_up_prealloc:
1169 if (num_inflight_jobs) 1167 if (gpfifo_args->num_inflight_jobs)
1170 channel_gk20a_free_prealloc_resources(c); 1168 channel_gk20a_free_prealloc_resources(c);
1171clean_up_sync: 1169clean_up_sync:
1172 if (c->sync) { 1170 if (c->sync) {
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index f2cb2ab8..eaa5f81b 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -46,6 +46,12 @@ struct fifo_profile_gk20a;
46#define NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC (1 << 1) 46#define NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC (1 << 1)
47#define NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2) 47#define NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2)
48 48
49struct nvgpu_gpfifo_args {
50 u32 num_entries;
51 u32 num_inflight_jobs;
52 u32 flags;
53};
54
49struct notification { 55struct notification {
50 struct { 56 struct {
51 u32 nanoseconds[2]; 57 u32 nanoseconds[2];
@@ -324,9 +330,7 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g,
324 bool is_privileged_channel); 330 bool is_privileged_channel);
325 331
326int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, 332int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c,
327 unsigned int num_entries, 333 struct nvgpu_gpfifo_args *gpfifo_args);
328 unsigned int num_inflight_jobs,
329 u32 flags);
330 334
331void gk20a_channel_timeout_restart_all_channels(struct gk20a *g); 335void gk20a_channel_timeout_restart_all_channels(struct gk20a *g);
332 336