diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/channel.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/channel.c b/drivers/gpu/nvgpu/common/linux/channel.c index cd9cadf8..1d4afcc8 100644 --- a/drivers/gpu/nvgpu/common/linux/channel.c +++ b/drivers/gpu/nvgpu/common/linux/channel.c | |||
@@ -420,7 +420,6 @@ static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, | |||
420 | struct channel_gk20a_job *job, | 420 | struct channel_gk20a_job *job, |
421 | struct priv_cmd_entry **wait_cmd, | 421 | struct priv_cmd_entry **wait_cmd, |
422 | struct priv_cmd_entry **incr_cmd, | 422 | struct priv_cmd_entry **incr_cmd, |
423 | struct gk20a_fence **pre_fence, | ||
424 | struct gk20a_fence **post_fence, | 423 | struct gk20a_fence **post_fence, |
425 | bool force_need_sync_fence, | 424 | bool force_need_sync_fence, |
426 | bool register_irq, | 425 | bool register_irq, |
@@ -470,19 +469,13 @@ static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, | |||
470 | * this condition. | 469 | * this condition. |
471 | */ | 470 | */ |
472 | if (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_WAIT) { | 471 | if (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_WAIT) { |
473 | job->pre_fence = gk20a_alloc_fence(c); | ||
474 | if (!job->pre_fence) { | ||
475 | err = -ENOMEM; | ||
476 | goto fail; | ||
477 | } | ||
478 | |||
479 | if (!pre_alloc_enabled) | 472 | if (!pre_alloc_enabled) |
480 | job->wait_cmd = nvgpu_kzalloc(g, | 473 | job->wait_cmd = nvgpu_kzalloc(g, |
481 | sizeof(struct priv_cmd_entry)); | 474 | sizeof(struct priv_cmd_entry)); |
482 | 475 | ||
483 | if (!job->wait_cmd) { | 476 | if (!job->wait_cmd) { |
484 | err = -ENOMEM; | 477 | err = -ENOMEM; |
485 | goto clean_up_pre_fence; | 478 | goto fail; |
486 | } | 479 | } |
487 | 480 | ||
488 | if (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_SYNC_FENCE) { | 481 | if (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_SYNC_FENCE) { |
@@ -495,12 +488,11 @@ static int gk20a_submit_prepare_syncs(struct channel_gk20a *c, | |||
495 | job->wait_cmd); | 488 | job->wait_cmd); |
496 | } | 489 | } |
497 | 490 | ||
498 | if (!err) { | 491 | if (err) |
499 | if (job->wait_cmd->valid) | ||
500 | *wait_cmd = job->wait_cmd; | ||
501 | *pre_fence = job->pre_fence; | ||
502 | } else | ||
503 | goto clean_up_wait_cmd; | 492 | goto clean_up_wait_cmd; |
493 | |||
494 | if (job->wait_cmd->valid) | ||
495 | *wait_cmd = job->wait_cmd; | ||
504 | } | 496 | } |
505 | 497 | ||
506 | if ((flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET) && | 498 | if ((flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET) && |
@@ -552,12 +544,8 @@ clean_up_wait_cmd: | |||
552 | free_priv_cmdbuf(c, job->wait_cmd); | 544 | free_priv_cmdbuf(c, job->wait_cmd); |
553 | if (!pre_alloc_enabled) | 545 | if (!pre_alloc_enabled) |
554 | job->wait_cmd = NULL; | 546 | job->wait_cmd = NULL; |
555 | clean_up_pre_fence: | ||
556 | gk20a_fence_put(job->pre_fence); | ||
557 | job->pre_fence = NULL; | ||
558 | fail: | 547 | fail: |
559 | *wait_cmd = NULL; | 548 | *wait_cmd = NULL; |
560 | *pre_fence = NULL; | ||
561 | return err; | 549 | return err; |
562 | } | 550 | } |
563 | 551 | ||
@@ -684,7 +672,6 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
684 | struct gk20a *g = c->g; | 672 | struct gk20a *g = c->g; |
685 | struct priv_cmd_entry *wait_cmd = NULL; | 673 | struct priv_cmd_entry *wait_cmd = NULL; |
686 | struct priv_cmd_entry *incr_cmd = NULL; | 674 | struct priv_cmd_entry *incr_cmd = NULL; |
687 | struct gk20a_fence *pre_fence = NULL; | ||
688 | struct gk20a_fence *post_fence = NULL; | 675 | struct gk20a_fence *post_fence = NULL; |
689 | struct channel_gk20a_job *job = NULL; | 676 | struct channel_gk20a_job *job = NULL; |
690 | /* we might need two extra gpfifo entries - one for pre fence | 677 | /* we might need two extra gpfifo entries - one for pre fence |
@@ -875,7 +862,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
875 | 862 | ||
876 | err = gk20a_submit_prepare_syncs(c, fence, job, | 863 | err = gk20a_submit_prepare_syncs(c, fence, job, |
877 | &wait_cmd, &incr_cmd, | 864 | &wait_cmd, &incr_cmd, |
878 | &pre_fence, &post_fence, | 865 | &post_fence, |
879 | force_need_sync_fence, | 866 | force_need_sync_fence, |
880 | need_deferred_cleanup, | 867 | need_deferred_cleanup, |
881 | flags); | 868 | flags); |
@@ -940,7 +927,6 @@ clean_up_job: | |||
940 | channel_gk20a_free_job(c, job); | 927 | channel_gk20a_free_job(c, job); |
941 | clean_up: | 928 | clean_up: |
942 | gk20a_dbg_fn("fail"); | 929 | gk20a_dbg_fn("fail"); |
943 | gk20a_fence_put(pre_fence); | ||
944 | gk20a_fence_put(post_fence); | 930 | gk20a_fence_put(post_fence); |
945 | if (c->deterministic) | 931 | if (c->deterministic) |
946 | nvgpu_rwsem_up_read(&g->deterministic_busy); | 932 | nvgpu_rwsem_up_read(&g->deterministic_busy); |