From 20ac0d74cf0d1dc51fc94a830c2c5f5baadc6fd5 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 18 Sep 2018 12:59:40 -0700 Subject: gpu: nvgpu: Fix comment in priv_cmd_buf allocation Update the comment to fix obvious issues and describe the new allocation logic. Bug 2327792 Change-Id: Ica0dd4159467e3023cc487a2bf9f525db3ad76e6 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1831096 (cherry picked from commit c64f9432b13d47a791220578e823efcae4fe2a80) Reviewed-on: https://git-master.nvidia.com/r/1949221 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Tested-by: James Norton Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'drivers/gpu/nvgpu/common') 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, * Any sync-pt fences will take less memory so we can ignore them for * now. * - * A semaphore ACQ (fence-wait) is 8 dwords: semaphore_a, semaphore_b, + * A semaphore ACQ (fence-wait) is 8 words: semaphore_a, semaphore_b, * semaphore_c, and semaphore_d. A semaphore INCR (fence-get) will be 10 - * dwords: all the same as an ACQ plus a non-stalling intr which is - * another 2 dwords. + * words: all the same as an ACQ plus a non-stalling intr which is + * another 2 words. * - * Lastly the number of gpfifo entries per channel is fixed so at most - * we can use 2/3rds of the gpfifo entries (1 pre-fence entry, one - * userspace entry, and one post-fence entry). Thus the computation is: + * We have two cases to consider: the first is we base the size of the + * priv_cmd_buf on the gpfifo count. Here we multiply by a factor of + * 2/3rds because only at most 2/3rds of the GPFIFO can be used for + * sync commands: * - * (gpfifo entry number * (2 / 3) * (8 + 10) * 4 bytes. + * nr_gpfifos * (2 / 3) * (8 + 10) * 4 bytes + * + * If instead num_in_flight is specified then we will use that to size + * the priv_cmd_buf. The worst case is two sync commands (one ACQ and + * one INCR) per submit so we have a priv_cmd_buf size of: + * + * num_in_flight * (8 + 10) * 4 bytes */ size = num_in_flight * 18U * (u32)sizeof(u32); if (gpfifo_based) { -- cgit v1.2.2