From d1d1fbfb60141f25cad3206f0da974b78c651e71 Mon Sep 17 00:00:00 2001 From: Sam Payne Date: Wed, 17 Dec 2014 10:02:53 -0800 Subject: gpu: nvgpu: check gpfifo size against request if a request is submitted larger than the allocated fifo, an error is returned immediately rather than waiting for timeout while enough space becomes available in the fifo (timeout will not trigger in this case) bug 1563401 Change-Id: I264dee2673dc8722034881f9e7db7bb137a8c0c8 Signed-off-by: Sam Payne Reviewed-on: http://git-master/r/665113 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 28b0bbc7..a54e3a6c 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -1545,6 +1545,12 @@ 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) { + gk20a_err(d, "not enough gpfifo space allocated"); + return -ENOMEM; + } + if ((flags & (NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_WAIT | NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET)) && !fence) @@ -1606,7 +1612,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, } if (err) { - gk20a_err(d, "not enough gpfifo space"); + gk20a_err(d, "timeout waiting for gpfifo space"); err = -EAGAIN; goto clean_up; } -- cgit v1.2.2