From 29ceb36331b21940afd210c594fd07e6c7337793 Mon Sep 17 00:00:00 2001 From: Gagan Grover Date: Mon, 30 Mar 2015 21:13:12 +0530 Subject: gpu: nvgpu: Fix the GPFIFO submit condition GPFIFO HW with fifo size N can actually accept N-1 entries. Also, kernel can insert two extra entries, before and after the user GPFIFOs. So, GPFIFO with N size can accept max N-3 user gpfifos. Bug 1613125 Change-Id: I173526afb70dddf1b2b9ec0a99890335c81f0e02 Signed-off-by: Gagan Grover Reviewed-on: http://git-master/r/725380 Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 7fa8a552..328f49b1 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -1460,8 +1460,11 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, if (c->has_timedout) return -ETIMEDOUT; - /* fifo not large enough for request. Return error immediately */ - if (c->gpfifo.entry_num < num_entries) { + /* fifo not large enough for request. Return error immediately. + * Kernel can insert gpfifo entries before and after user gpfifos. + * So, add extra_entries in user request. Also, HW with fifo size N + * can accept only N-1 entreis and so the below condition */ + if (c->gpfifo.entry_num - 1 < num_entries + extra_entries) { gk20a_err(d, "not enough gpfifo space allocated"); return -ENOMEM; } -- cgit v1.2.2