diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/common/fifo/channel.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index 8af5f5e9..54fa4747 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c | |||
@@ -753,16 +753,23 @@ static int channel_gk20a_alloc_priv_cmdbuf(struct channel_gk20a *c, | |||
753 | * Any sync-pt fences will take less memory so we can ignore them for | 753 | * Any sync-pt fences will take less memory so we can ignore them for |
754 | * now. | 754 | * now. |
755 | * | 755 | * |
756 | * A semaphore ACQ (fence-wait) is 8 dwords: semaphore_a, semaphore_b, | 756 | * A semaphore ACQ (fence-wait) is 8 words: semaphore_a, semaphore_b, |
757 | * semaphore_c, and semaphore_d. A semaphore INCR (fence-get) will be 10 | 757 | * semaphore_c, and semaphore_d. A semaphore INCR (fence-get) will be 10 |
758 | * dwords: all the same as an ACQ plus a non-stalling intr which is | 758 | * words: all the same as an ACQ plus a non-stalling intr which is |
759 | * another 2 dwords. | 759 | * another 2 words. |
760 | * | 760 | * |
761 | * Lastly the number of gpfifo entries per channel is fixed so at most | 761 | * We have two cases to consider: the first is we base the size of the |
762 | * we can use 2/3rds of the gpfifo entries (1 pre-fence entry, one | 762 | * priv_cmd_buf on the gpfifo count. Here we multiply by a factor of |
763 | * userspace entry, and one post-fence entry). Thus the computation is: | 763 | * 2/3rds because only at most 2/3rds of the GPFIFO can be used for |
764 | * sync commands: | ||
764 | * | 765 | * |
765 | * (gpfifo entry number * (2 / 3) * (8 + 10) * 4 bytes. | 766 | * nr_gpfifos * (2 / 3) * (8 + 10) * 4 bytes |
767 | * | ||
768 | * If instead num_in_flight is specified then we will use that to size | ||
769 | * the priv_cmd_buf. The worst case is two sync commands (one ACQ and | ||
770 | * one INCR) per submit so we have a priv_cmd_buf size of: | ||
771 | * | ||
772 | * num_in_flight * (8 + 10) * 4 bytes | ||
766 | */ | 773 | */ |
767 | size = num_in_flight * 18U * (u32)sizeof(u32); | 774 | size = num_in_flight * 18U * (u32)sizeof(u32); |
768 | if (gpfifo_based) { | 775 | if (gpfifo_based) { |