gpu: nvgpu: error handling for gk20a_fence alloc

In current design, the new increments are added to the threshold for
fence allocation. So if it fails to get gk20a_fence, decrease the new
increments before bailing out from __gk20a_channel_syncpt_incr()
and propagating the error code.

Bug 1867651

Change-Id: I8a21bf0afef1d9ebe660ebea59d877acad1b726a
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: http://git-master/r/1300421
(cherry picked from commit a4a55f1851834042ab14e487f1ff0d497509ff24)
Reviewed-on: https://git-master.nvidia.com/r/1609824
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Ken Chang
2017-12-04 10:08:54 +08:00
committed by mobile promotions
parent c6cd82008f
commit 793f7deb94

View File

@@ -235,6 +235,16 @@ static int __gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s,
thresh = nvhost_syncpt_incr_max_ext(sp->host1x_pdev, sp->id, 2); thresh = nvhost_syncpt_incr_max_ext(sp->host1x_pdev, sp->id, 2);
err = gk20a_fence_from_syncpt(fence, sp->host1x_pdev, sp->id, thresh,
wfi_cmd, need_sync_fence);
if (err) {
thresh = nvhost_syncpt_decr_max_ext(sp->host1x_pdev, sp->id, 2);
gk20a_err(dev_from_gk20a(c->g),
"failed to get fence, fallback syncpt id %d to %d!",
sp->id, thresh);
goto clean_up_priv_cmd;
}
if (register_irq) { if (register_irq) {
struct channel_gk20a *referenced = gk20a_channel_get(c); struct channel_gk20a *referenced = gk20a_channel_get(c);
@@ -261,11 +271,6 @@ static int __gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s,
} }
} }
err = gk20a_fence_from_syncpt(fence, sp->host1x_pdev, sp->id, thresh,
wfi_cmd, need_sync_fence);
if (err)
goto clean_up_priv_cmd;
return 0; return 0;
clean_up_priv_cmd: clean_up_priv_cmd: