All of lore.kernel.org
 help / color / mirror / Atom feed
From: Le Ma <le.ma-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Le Ma <le.ma-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 1/4] drm/amdgpu: clear UVD VCPU buffer when err_event_athub generated
Date: Mon, 28 Oct 2019 19:31:06 +0800	[thread overview]
Message-ID: <1572262269-14985-1-git-send-email-le.ma@amd.com> (raw)

The err_event_athub error will mess up the buffer and cause UVD resume hang.

Change-Id: If17a2161fb9b1b52eac08de00d2e935191bdbf99
Signed-off-by: Le Ma <le.ma@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index b2c364b..b4dd89a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -39,6 +39,8 @@
 #include "cikd.h"
 #include "uvd/uvd_4_2_d.h"
 
+#include "amdgpu_ras.h"
+
 /* 1 second timeout */
 #define UVD_IDLE_TIMEOUT	msecs_to_jiffies(1000)
 
@@ -372,7 +374,13 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 		if (!adev->uvd.inst[j].saved_bo)
 			return -ENOMEM;
 
-		memcpy_fromio(adev->uvd.inst[j].saved_bo, ptr, size);
+		/* re-write 0 since err_event_athub will corrupt VCPU buffer */
+		if (amdgpu_ras_intr_triggered()) {
+			DRM_WARN("UVD VCPU state may lost due to RAS ERREVENT_ATHUB_INTERRUPT\n");
+			memset(adev->uvd.inst[j].saved_bo, 0, size);
+		} else {
+			memcpy_fromio(adev->uvd.inst[j].saved_bo, ptr, size);
+		}
 	}
 	return 0;
 }
-- 
2.7.4

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

WARNING: multiple messages have this Message-ID (diff)
From: Le Ma <le.ma@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Le Ma <le.ma@amd.com>
Subject: [PATCH 1/4] drm/amdgpu: clear UVD VCPU buffer when err_event_athub generated
Date: Mon, 28 Oct 2019 19:31:06 +0800	[thread overview]
Message-ID: <1572262269-14985-1-git-send-email-le.ma@amd.com> (raw)
Message-ID: <20191028113106.W3nugK_8ogxuZuWiAXNId1ToYMmtqjtLyOf3NZ0U4Kk@z> (raw)

The err_event_athub error will mess up the buffer and cause UVD resume hang.

Change-Id: If17a2161fb9b1b52eac08de00d2e935191bdbf99
Signed-off-by: Le Ma <le.ma@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index b2c364b..b4dd89a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -39,6 +39,8 @@
 #include "cikd.h"
 #include "uvd/uvd_4_2_d.h"
 
+#include "amdgpu_ras.h"
+
 /* 1 second timeout */
 #define UVD_IDLE_TIMEOUT	msecs_to_jiffies(1000)
 
@@ -372,7 +374,13 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 		if (!adev->uvd.inst[j].saved_bo)
 			return -ENOMEM;
 
-		memcpy_fromio(adev->uvd.inst[j].saved_bo, ptr, size);
+		/* re-write 0 since err_event_athub will corrupt VCPU buffer */
+		if (amdgpu_ras_intr_triggered()) {
+			DRM_WARN("UVD VCPU state may lost due to RAS ERREVENT_ATHUB_INTERRUPT\n");
+			memset(adev->uvd.inst[j].saved_bo, 0, size);
+		} else {
+			memcpy_fromio(adev->uvd.inst[j].saved_bo, ptr, size);
+		}
 	}
 	return 0;
 }
-- 
2.7.4

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

             reply	other threads:[~2019-10-28 11:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 11:31 Le Ma [this message]
2019-10-28 11:31 ` [PATCH 1/4] drm/amdgpu: clear UVD VCPU buffer when err_event_athub generated Le Ma
     [not found] ` <1572262269-14985-1-git-send-email-le.ma-5C7GfCeVMHo@public.gmane.org>
2019-10-28 11:31   ` [PATCH 2/4] drm/amdgpu: reset err_event_athub flag if gpu recovery succeeded Le Ma
2019-10-28 11:31     ` Le Ma
     [not found]     ` <1572262269-14985-2-git-send-email-le.ma-5C7GfCeVMHo@public.gmane.org>
2019-10-29  1:27       ` Chen, Guchun
2019-10-29  1:27         ` Chen, Guchun
     [not found]         ` <BYAPR12MB280615A3803ADC31A4AE9C8EF1610-ZGDeBxoHBPk0CuAkIMgl3QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-10-29  7:27           ` Ma, Le
2019-10-29  7:27             ` Ma, Le
2019-10-28 11:31   ` [PATCH 3/4] drm/amdgpu: bypass some cleanup work after err_event_athub Le Ma
2019-10-28 11:31     ` Le Ma
2019-10-28 11:31   ` [PATCH 4/4] drm/amdgpu: remove ras global recovery handling from ras_controller_int handler Le Ma
2019-10-28 11:31     ` Le Ma
     [not found]     ` <1572262269-14985-4-git-send-email-le.ma-5C7GfCeVMHo@public.gmane.org>
2019-10-29  1:36       ` Chen, Guchun
2019-10-29  1:36         ` Chen, Guchun
     [not found]         ` <BYAPR12MB2806A8C355785EFB07D88E2EF1610-ZGDeBxoHBPk0CuAkIMgl3QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-10-29  7:37           ` Ma, Le
2019-10-29  7:37             ` Ma, Le
2019-10-28 11:53   ` [PATCH 1/4] drm/amdgpu: clear UVD VCPU buffer when err_event_athub generated Zhang, Hawking
2019-10-28 11:53     ` Zhang, Hawking

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=1572262269-14985-1-git-send-email-le.ma@amd.com \
    --to=le.ma-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.