From e083bd0df2515b6f258be0d519c2d4be52e3e1ac Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Sun, 10 Jul 2022 13:03:25 +0530 Subject: [PATCH] gpu: nvgpu: fix syncpt increment logic in host1x syncpt_set_minval On host copy engine PBDMA interrupt, channel is aborted as part of the recovery and its syncpt value is set to the max threshold. Syncpoint may then get incremented by PBDMA (incr cmd gets processed) after this interrupt is handled leading to syncpoint value becoming greater than the max threshold. Again while unbinding the channel, syncpoint value is incremented until it reaches max threshold. Since syncpoint value is already greater than max threshold, host1x version of nvgpu_nvhost_syncpt_set_minval will loop for entire u32 range until it reaches max threshold and this will hang the channel unbind. nvgpu_nvhost_syncpt_set_minval can ensure the syncpoint value is greater than or equal to max threshold. Hence update the check for syncpoint value from not equal to less than. Bug 3681100 Change-Id: I96e7a1f53d4037e9ed858a2e90dd5a8d17ed6bb0 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2742604 (cherry picked from commit f246facd018b6366fd5d24e3ec9e760c3d9792e9) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2742603 Reviewed-by: Vijayakumar Subbu GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/nvhost_host1x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c b/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c index d8014da25..4fb71738d 100644 --- a/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c +++ b/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2020-2022, 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, @@ -193,8 +193,9 @@ void nvgpu_nvhost_syncpt_set_minval(struct nvgpu_nvhost_dev *nvhost_dev, cur = host1x_syncpt_read(sp); - while (cur++ != val) + while (cur++ < val) { host1x_syncpt_incr(sp); + } } void nvgpu_nvhost_syncpt_put_ref_ext(struct nvgpu_nvhost_dev *nvhost_dev,