diff options
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/channel.c | 26 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 1 |
3 files changed, 8 insertions, 24 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); |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index fb7406da..78953558 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -1924,9 +1924,8 @@ void gk20a_channel_clean_up_jobs(struct channel_gk20a *c, | |||
1924 | channel_gk20a_joblist_delete(c, job); | 1924 | channel_gk20a_joblist_delete(c, job); |
1925 | channel_gk20a_joblist_unlock(c); | 1925 | channel_gk20a_joblist_unlock(c); |
1926 | 1926 | ||
1927 | /* Close the fences (this will unref the semaphores and release | 1927 | /* Close the fence (this will unref the semaphore and release |
1928 | * them to the pool). */ | 1928 | * it to the pool). */ |
1929 | gk20a_fence_put(job->pre_fence); | ||
1930 | gk20a_fence_put(job->post_fence); | 1929 | gk20a_fence_put(job->post_fence); |
1931 | 1930 | ||
1932 | /* Free the private command buffers (wait_cmd first and | 1931 | /* Free the private command buffers (wait_cmd first and |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index 947b8913..473248ec 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -58,7 +58,6 @@ struct notification { | |||
58 | struct channel_gk20a_job { | 58 | struct channel_gk20a_job { |
59 | struct nvgpu_mapped_buf **mapped_buffers; | 59 | struct nvgpu_mapped_buf **mapped_buffers; |
60 | int num_mapped_buffers; | 60 | int num_mapped_buffers; |
61 | struct gk20a_fence *pre_fence; | ||
62 | struct gk20a_fence *post_fence; | 61 | struct gk20a_fence *post_fence; |
63 | struct priv_cmd_entry *wait_cmd; | 62 | struct priv_cmd_entry *wait_cmd; |
64 | struct priv_cmd_entry *incr_cmd; | 63 | struct priv_cmd_entry *incr_cmd; |