From b5b4353ca6cc9b6457ddccc00bf87538291870fc Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 20 Mar 2018 04:51:23 -0700 Subject: gpu: nvgpu: set safe state for user managed syncpoints MAX/threshold value of user managed syncpoint is not tracked by nvgpu So if channel is reset by nvgpu there could be waiters still waiting on some user syncpoint fence Fix this by setting a large safe value to user managed syncpoint when aborting the channel and when closing the channel We right now increment the current value by 0x10000 which should be sufficient to release any pending waiter Bug 200326065 Jira NVGPU-179 Change-Id: Ie6432369bb4c21bd922c14b8d5a74c1477116f0b Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1678768 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/nvhost.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/nvhost.c b/drivers/gpu/nvgpu/common/linux/nvhost.c index a76953e3..fa169cf0 100644 --- a/drivers/gpu/nvgpu/common/linux/nvhost.c +++ b/drivers/gpu/nvgpu/common/linux/nvhost.c @@ -166,6 +166,25 @@ u32 nvgpu_nvhost_syncpt_read_maxval( return nvhost_syncpt_read_maxval(nvhost_dev->host1x_pdev, id); } +void nvgpu_nvhost_syncpt_set_safe_state( + struct nvgpu_nvhost_dev *nvhost_dev, u32 id) +{ + u32 val; + + /* + * Add large number of increments to current value + * so that all waiters on this syncpoint are released + * + * We don't expect any case where more than 0x10000 increments + * are pending + */ + val = nvhost_syncpt_read_minval(nvhost_dev->host1x_pdev, id); + val += 0x10000; + + nvhost_syncpt_set_minval(nvhost_dev->host1x_pdev, id, val); + nvhost_syncpt_set_maxval(nvhost_dev->host1x_pdev, id, val); +} + int nvgpu_nvhost_create_symlink(struct gk20a *g) { struct device *dev = dev_from_gk20a(g); -- cgit v1.2.2