All of lore.kernel.org
 help / color / mirror / Atom feed
From: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 5/6] drm/amdgpu:kiq reg access need timeout(v2)
Date: Wed, 3 May 2017 11:48:11 +0800	[thread overview]
Message-ID: <1493783292-2661-5-git-send-email-Monk.Liu@amd.com> (raw)
In-Reply-To: <1493783292-2661-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>

this is to prevent fence forever waiting if FLR occured
during register accessing.

v2:
use define instead of hardcode for the timeout msec

Change-Id: I32cc219a08f5a67654beb26c45d1b95d2b60cc96
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 966bf7f..757cbc4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -22,6 +22,7 @@
  */
 
 #include "amdgpu.h"
+#define MAX_KIQ_REG_WAIT	100000
 
 int amdgpu_allocate_static_csa(struct amdgpu_device *adev)
 {
@@ -128,10 +129,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&kiq->ring_mutex);
 
-	r = fence_wait(f, false);
-	if (r)
-		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
+	r = fence_wait_timeout(f, false, msecs_to_jiffies(MAX_KIQ_REG_WAIT));
 	fence_put(f);
+	if (r < 1) {
+		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
+		return ~0;
+	}
 
 	val = adev->wb.wb[adev->virt.reg_val_offs];
 
@@ -154,8 +157,8 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
 	amdgpu_ring_commit(ring);
 	mutex_unlock(&kiq->ring_mutex);
 
-	r = fence_wait(f, false);
-	if (r)
+	r = fence_wait_timeout(f, false, msecs_to_jiffies(MAX_KIQ_REG_WAIT));
+	if (r < 1)
 		DRM_ERROR("wait for kiq fence error: %ld.\n", r);
 	fence_put(f);
 }
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-05-03  3:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03  3:48 [PATCH 1/6] drm/amdgpu:fix cannot receive rcv/ack irq bug Monk Liu
     [not found] ` <1493783292-2661-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-03  3:48   ` [PATCH 2/6] drm/amdgpu:need som change on vega10 mailbox Monk Liu
     [not found]     ` <1493783292-2661-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-03  6:27       ` Yu, Xiangliang
2017-05-03  9:05       ` Christian König
     [not found]         ` <09b3c7b4-19f9-2ca2-301e-324b71af1479-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-03 15:20           ` Alex Deucher
     [not found]             ` <CADnq5_MHdrQzRKQNHMSR5ucorerVZ9JMA3kE4LOVVx1Lwz0=KA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-03 15:22               ` Liu, Monk
2017-05-03  3:48   ` [PATCH 3/6] drm/amdgpu:re-write sriov_reinit_early/late Monk Liu
     [not found]     ` <1493783292-2661-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-03  6:43       ` Yu, Xiangliang
2017-05-03  9:02       ` Christian König
     [not found]         ` <fe18ce3e-dc63-412b-7dbb-aa5265dfad9f-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-03  9:10           ` Liu, Monk
     [not found]             ` <DM5PR12MB1610B39D23F8DC3CBCD18A3784160-2J9CzHegvk++jCVTvoAFKAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-05-03 15:23               ` Alex Deucher
2017-05-03  3:48   ` [PATCH 4/6] drm/amdgpu:cleanups KIQ ring_funcs emit_frame_size Monk Liu
     [not found]     ` <1493783292-2661-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-03  6:33       ` Yu, Xiangliang
2017-05-03  9:02       ` Christian König
2017-05-03 15:23       ` Alex Deucher
2017-05-03  3:48   ` Monk Liu [this message]
     [not found]     ` <1493783292-2661-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-03  6:35       ` [PATCH 5/6] drm/amdgpu:kiq reg access need timeout(v2) Yu, Xiangliang
2017-05-03  3:48   ` [PATCH 6/6] drm/amdgpu:PTE flag should be 64 bit width Monk Liu
     [not found]     ` <1493783292-2661-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-05-03 13:10       ` Alex Deucher
2017-05-03  6:24   ` [PATCH 1/6] drm/amdgpu:fix cannot receive rcv/ack irq bug Yu, Xiangliang
2017-05-03  9:05   ` Christian König
2017-05-03 15:19   ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1493783292-2661-5-git-send-email-Monk.Liu@amd.com \
    --to=monk.liu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.