summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-01-12 22:18:21 -0500
committerVarun Colbert <vcolbert@nvidia.com>2017-02-13 21:15:03 -0500
commite7a0c0ae8b6791c6b8ee30270ebdbe6e95fbbc71 (patch)
tree0f62852593ad151cc716e258ece88fb5da30a3ae /drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
parentaa36d3786aeed6755b9744fed37aad000b582322 (diff)
gpu: nvgpu: Move from gk20a_ to nvgpu_ in semaphore code
Change the prefix in the semaphore code to 'nvgpu_' since this code is global to all chips. Bug 1799159 Change-Id: Ic1f3e13428882019e5d1f547acfe95271cc10da5 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1284628 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 0eba1c30..18971b09 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -388,7 +388,7 @@ struct gk20a_channel_semaphore {
388 struct channel_gk20a *c; 388 struct channel_gk20a *c;
389 389
390 /* A semaphore pool owned by this channel. */ 390 /* A semaphore pool owned by this channel. */
391 struct gk20a_semaphore_pool *pool; 391 struct nvgpu_semaphore_pool *pool;
392 392
393 /* A sync timeline that advances when gpu completes work. */ 393 /* A sync timeline that advances when gpu completes work. */
394 struct sync_timeline *timeline; 394 struct sync_timeline *timeline;
@@ -399,7 +399,7 @@ struct wait_fence_work {
399 struct sync_fence_waiter waiter; 399 struct sync_fence_waiter waiter;
400 struct sync_fence *fence; 400 struct sync_fence *fence;
401 struct channel_gk20a *ch; 401 struct channel_gk20a *ch;
402 struct gk20a_semaphore *sema; 402 struct nvgpu_semaphore *sema;
403 struct gk20a *g; 403 struct gk20a *g;
404 struct list_head entry; 404 struct list_head entry;
405}; 405};
@@ -501,14 +501,14 @@ static void gk20a_channel_semaphore_launcher(
501 "wait completed (%d) for fence %p '%s', triggering gpu work", 501 "wait completed (%d) for fence %p '%s', triggering gpu work",
502 err, fence, fence->name); 502 err, fence, fence->name);
503 sync_fence_put(fence); 503 sync_fence_put(fence);
504 gk20a_semaphore_release(w->sema); 504 nvgpu_semaphore_release(w->sema);
505 gk20a_semaphore_put(w->sema); 505 nvgpu_semaphore_put(w->sema);
506 kfree(w); 506 kfree(w);
507} 507}
508#endif 508#endif
509 509
510static void add_sema_cmd(struct gk20a *g, struct channel_gk20a *c, 510static void add_sema_cmd(struct gk20a *g, struct channel_gk20a *c,
511 struct gk20a_semaphore *s, struct priv_cmd_entry *cmd, 511 struct nvgpu_semaphore *s, struct priv_cmd_entry *cmd,
512 int cmd_size, bool acquire, bool wfi) 512 int cmd_size, bool acquire, bool wfi)
513{ 513{
514 int ch = c->hw_chid; 514 int ch = c->hw_chid;
@@ -521,15 +521,15 @@ static void add_sema_cmd(struct gk20a *g, struct channel_gk20a *c,
521 * RO for acquire (since we just need to read the mem) and RW for 521 * RO for acquire (since we just need to read the mem) and RW for
522 * release since we will need to write back to the semaphore memory. 522 * release since we will need to write back to the semaphore memory.
523 */ 523 */
524 va = acquire ? gk20a_semaphore_gpu_ro_va(s) : 524 va = acquire ? nvgpu_semaphore_gpu_ro_va(s) :
525 gk20a_semaphore_gpu_rw_va(s); 525 nvgpu_semaphore_gpu_rw_va(s);
526 526
527 /* 527 /*
528 * If the op is not an acquire (so therefor a release) we should 528 * If the op is not an acquire (so therefor a release) we should
529 * incr the underlying sema next_value. 529 * incr the underlying sema next_value.
530 */ 530 */
531 if (!acquire) 531 if (!acquire)
532 gk20a_semaphore_incr(s); 532 nvgpu_semaphore_incr(s);
533 533
534 /* semaphore_a */ 534 /* semaphore_a */
535 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010004); 535 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010004);
@@ -545,7 +545,7 @@ static void add_sema_cmd(struct gk20a *g, struct channel_gk20a *c,
545 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010006); 545 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010006);
546 /* payload */ 546 /* payload */
547 gk20a_mem_wr32(g, cmd->mem, off++, 547 gk20a_mem_wr32(g, cmd->mem, off++,
548 gk20a_semaphore_get_value(s)); 548 nvgpu_semaphore_get_value(s));
549 /* semaphore_d */ 549 /* semaphore_d */
550 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010007); 550 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010007);
551 /* operation: acq_geq, switch_en */ 551 /* operation: acq_geq, switch_en */
@@ -555,7 +555,7 @@ static void add_sema_cmd(struct gk20a *g, struct channel_gk20a *c,
555 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010006); 555 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010006);
556 /* payload */ 556 /* payload */
557 gk20a_mem_wr32(g, cmd->mem, off++, 557 gk20a_mem_wr32(g, cmd->mem, off++,
558 gk20a_semaphore_get_value(s)); 558 nvgpu_semaphore_get_value(s));
559 /* semaphore_d */ 559 /* semaphore_d */
560 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010007); 560 gk20a_mem_wr32(g, cmd->mem, off++, 0x20010007);
561 /* operation: release, wfi */ 561 /* operation: release, wfi */
@@ -570,13 +570,13 @@ static void add_sema_cmd(struct gk20a *g, struct channel_gk20a *c,
570 if (acquire) 570 if (acquire)
571 gpu_sema_verbose_dbg("(A) c=%d ACQ_GE %-4u owner=%-3d" 571 gpu_sema_verbose_dbg("(A) c=%d ACQ_GE %-4u owner=%-3d"
572 "va=0x%llx cmd_mem=0x%llx b=0x%llx off=%u", 572 "va=0x%llx cmd_mem=0x%llx b=0x%llx off=%u",
573 ch, gk20a_semaphore_get_value(s), 573 ch, nvgpu_semaphore_get_value(s),
574 s->hw_sema->ch->hw_chid, va, cmd->gva, 574 s->hw_sema->ch->hw_chid, va, cmd->gva,
575 cmd->mem->gpu_va, ob); 575 cmd->mem->gpu_va, ob);
576 else 576 else
577 gpu_sema_verbose_dbg("(R) c=%d INCR %u (%u) va=0x%llx " 577 gpu_sema_verbose_dbg("(R) c=%d INCR %u (%u) va=0x%llx "
578 "cmd_mem=0x%llx b=0x%llx off=%u", 578 "cmd_mem=0x%llx b=0x%llx off=%u",
579 ch, gk20a_semaphore_get_value(s), 579 ch, nvgpu_semaphore_get_value(s),
580 readl(s->hw_sema->value), va, cmd->gva, 580 readl(s->hw_sema->value), va, cmd->gva,
581 cmd->mem->gpu_va, ob); 581 cmd->mem->gpu_va, ob);
582} 582}
@@ -596,7 +596,7 @@ static int gk20a_channel_semaphore_wait_syncpt(
596#ifdef CONFIG_SYNC 596#ifdef CONFIG_SYNC
597/* 597/*
598 * Attempt a fast path for waiting on a sync_fence. Basically if the passed 598 * Attempt a fast path for waiting on a sync_fence. Basically if the passed
599 * sync_fence is backed by a gk20a_semaphore then there's no reason to go 599 * sync_fence is backed by a nvgpu_semaphore then there's no reason to go
600 * through the rigmarole of setting up a separate semaphore which waits on an 600 * through the rigmarole of setting up a separate semaphore which waits on an
601 * interrupt from the GPU and then triggers a worker thread to execute a SW 601 * interrupt from the GPU and then triggers a worker thread to execute a SW
602 * based semaphore release. Instead just have the GPU wait on the same semaphore 602 * based semaphore release. Instead just have the GPU wait on the same semaphore
@@ -609,9 +609,9 @@ static int gk20a_channel_semaphore_wait_syncpt(
609static int __semaphore_wait_fd_fast_path(struct channel_gk20a *c, 609static int __semaphore_wait_fd_fast_path(struct channel_gk20a *c,
610 struct sync_fence *fence, 610 struct sync_fence *fence,
611 struct priv_cmd_entry *wait_cmd, 611 struct priv_cmd_entry *wait_cmd,
612 struct gk20a_semaphore **fp_sema) 612 struct nvgpu_semaphore **fp_sema)
613{ 613{
614 struct gk20a_semaphore *sema; 614 struct nvgpu_semaphore *sema;
615 int err; 615 int err;
616 616
617 if (!gk20a_is_sema_backed_sync_fence(fence)) 617 if (!gk20a_is_sema_backed_sync_fence(fence))
@@ -632,7 +632,7 @@ static int __semaphore_wait_fd_fast_path(struct channel_gk20a *c,
632 if (err) 632 if (err)
633 return err; 633 return err;
634 634
635 gk20a_semaphore_get(sema); 635 nvgpu_semaphore_get(sema);
636 BUG_ON(!atomic_read(&sema->value)); 636 BUG_ON(!atomic_read(&sema->value));
637 add_sema_cmd(c->g, c, sema, wait_cmd, 8, true, false); 637 add_sema_cmd(c->g, c, sema, wait_cmd, 8, true, false);
638 638
@@ -655,7 +655,7 @@ static int gk20a_channel_semaphore_wait_fd(
655 container_of(s, struct gk20a_channel_semaphore, ops); 655 container_of(s, struct gk20a_channel_semaphore, ops);
656 struct channel_gk20a *c = sema->c; 656 struct channel_gk20a *c = sema->c;
657#ifdef CONFIG_SYNC 657#ifdef CONFIG_SYNC
658 struct gk20a_semaphore *fp_sema; 658 struct nvgpu_semaphore *fp_sema;
659 struct sync_fence *sync_fence; 659 struct sync_fence *sync_fence;
660 struct priv_cmd_entry *wait_cmd = entry; 660 struct priv_cmd_entry *wait_cmd = entry;
661 struct wait_fence_work *w = NULL; 661 struct wait_fence_work *w = NULL;
@@ -674,7 +674,7 @@ static int gk20a_channel_semaphore_wait_fd(
674 &c->semaphore_wq, 674 &c->semaphore_wq,
675 NULL, false, false); 675 NULL, false, false);
676 if (err) { 676 if (err) {
677 gk20a_semaphore_put(fp_sema); 677 nvgpu_semaphore_put(fp_sema);
678 goto clean_up_priv_cmd; 678 goto clean_up_priv_cmd;
679 } 679 }
680 } else 680 } else
@@ -716,7 +716,7 @@ static int gk20a_channel_semaphore_wait_fd(
716 w->fence = sync_fence; 716 w->fence = sync_fence;
717 w->g = c->g; 717 w->g = c->g;
718 w->ch = c; 718 w->ch = c;
719 w->sema = gk20a_semaphore_alloc(c); 719 w->sema = nvgpu_semaphore_alloc(c);
720 if (!w->sema) { 720 if (!w->sema) {
721 gk20a_err(dev_from_gk20a(c->g), "ran out of semaphores"); 721 gk20a_err(dev_from_gk20a(c->g), "ran out of semaphores");
722 err = -ENOMEM; 722 err = -ENOMEM;
@@ -724,8 +724,8 @@ static int gk20a_channel_semaphore_wait_fd(
724 } 724 }
725 725
726 /* worker takes one reference */ 726 /* worker takes one reference */
727 gk20a_semaphore_get(w->sema); 727 nvgpu_semaphore_get(w->sema);
728 gk20a_semaphore_incr(w->sema); 728 nvgpu_semaphore_incr(w->sema);
729 729
730 /* GPU unblocked when the semaphore value increments. */ 730 /* GPU unblocked when the semaphore value increments. */
731 add_sema_cmd(c->g, c, w->sema, wait_cmd, 8, true, false); 731 add_sema_cmd(c->g, c, w->sema, wait_cmd, 8, true, false);
@@ -747,12 +747,12 @@ static int gk20a_channel_semaphore_wait_fd(
747 * If the sync_fence has already signaled then the above async_wait 747 * If the sync_fence has already signaled then the above async_wait
748 * will never trigger. This causes the semaphore release op to never 748 * will never trigger. This causes the semaphore release op to never
749 * happen which, in turn, hangs the GPU. That's bad. So let's just 749 * happen which, in turn, hangs the GPU. That's bad. So let's just
750 * do the gk20a_semaphore_release() right now. 750 * do the nvgpu_semaphore_release() right now.
751 */ 751 */
752 if (ret == 1) { 752 if (ret == 1) {
753 sync_fence_put(sync_fence); 753 sync_fence_put(sync_fence);
754 gk20a_semaphore_release(w->sema); 754 nvgpu_semaphore_release(w->sema);
755 gk20a_semaphore_put(w->sema); 755 nvgpu_semaphore_put(w->sema);
756 } 756 }
757 757
758skip_slow_path: 758skip_slow_path:
@@ -763,8 +763,8 @@ clean_up_sema:
763 * Release the refs to the semaphore, including 763 * Release the refs to the semaphore, including
764 * the one for the worker since it will never run. 764 * the one for the worker since it will never run.
765 */ 765 */
766 gk20a_semaphore_put(w->sema); 766 nvgpu_semaphore_put(w->sema);
767 gk20a_semaphore_put(w->sema); 767 nvgpu_semaphore_put(w->sema);
768clean_up_worker: 768clean_up_worker:
769 kfree(w); 769 kfree(w);
770clean_up_priv_cmd: 770clean_up_priv_cmd:
@@ -790,10 +790,10 @@ static int __gk20a_channel_semaphore_incr(
790 struct gk20a_channel_semaphore *sp = 790 struct gk20a_channel_semaphore *sp =
791 container_of(s, struct gk20a_channel_semaphore, ops); 791 container_of(s, struct gk20a_channel_semaphore, ops);
792 struct channel_gk20a *c = sp->c; 792 struct channel_gk20a *c = sp->c;
793 struct gk20a_semaphore *semaphore; 793 struct nvgpu_semaphore *semaphore;
794 int err = 0; 794 int err = 0;
795 795
796 semaphore = gk20a_semaphore_alloc(c); 796 semaphore = nvgpu_semaphore_alloc(c);
797 if (!semaphore) { 797 if (!semaphore) {
798 gk20a_err(dev_from_gk20a(c->g), 798 gk20a_err(dev_from_gk20a(c->g),
799 "ran out of semaphores"); 799 "ran out of semaphores");
@@ -824,7 +824,7 @@ static int __gk20a_channel_semaphore_incr(
824clean_up_priv_cmd: 824clean_up_priv_cmd:
825 gk20a_free_priv_cmdbuf(c, incr_cmd); 825 gk20a_free_priv_cmdbuf(c, incr_cmd);
826clean_up_sema: 826clean_up_sema:
827 gk20a_semaphore_put(semaphore); 827 nvgpu_semaphore_put(semaphore);
828 return err; 828 return err;
829} 829}
830 830