diff --git a/drivers/video/tegra/virt/tegra_gr_comm.c b/drivers/video/tegra/virt/tegra_gr_comm.c index e9ac6a07..0388cfc2 100644 --- a/drivers/video/tegra/virt/tegra_gr_comm.c +++ b/drivers/video/tegra/virt/tegra_gr_comm.c @@ -1,7 +1,7 @@ /* * Tegra Graphics Virtualization Communication Framework * - * Copyright (c) 2013-2018, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2013-2019, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -469,6 +469,7 @@ int tegra_gr_comm_send(u32 peer, u32 index, void *data, { struct gr_comm_ivc_context *ivc_ctx; struct gr_comm_queue *queue; + int retries = 10; int ret; if (index >= NUM_QUEUES) @@ -487,14 +488,23 @@ int tegra_gr_comm_send(u32 peer, u32 index, void *data, return -EINVAL; if (!tegra_hv_ivc_can_write(ivc_ctx->cookie)) { - ret = wait_event_timeout(ivc_ctx->wq, - tegra_hv_ivc_can_write(ivc_ctx->cookie), - msecs_to_jiffies(500)); - if (!ret) { - dev_err(&ivc_ctx->pdev->dev, - "%s timeout waiting for buffer\n", __func__); - return -ENOMEM; - } + do { + ret = wait_event_timeout(ivc_ctx->wq, + tegra_hv_ivc_can_write(ivc_ctx->cookie), + msecs_to_jiffies(500)); + if (!ret) { + if (retries > 0) { + dev_warn(&ivc_ctx->pdev->dev, + "%s retrying (remaining %d times)\n", + __func__, retries--); + } else { + dev_err(&ivc_ctx->pdev->dev, + "%s timeout waiting for buffer\n", + __func__); + return -ENOMEM; + } + } + } while (!ret); } ret = tegra_hv_ivc_write(ivc_ctx->cookie, data, size);