[PATCH] drm/amdgpu: fix SI UVD firmware validate resume fail

Sonny Jiang sonny.jiang at amd.com
Sun Nov 8 15:09:53 UTC 2020


The SI UVD firmware validate key is stored at the end of firmware,
which is changed during resume while playing video. So only to get
the key at device initialization and save it for later using.

Signed-off-by: Sonny Jiang <sonny.jiang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
index 7cf4b11a65c5..aab7415c1a32 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
@@ -279,13 +279,16 @@ static int uvd_v3_1_fw_validate(struct amdgpu_device *adev)
 {
 	void *ptr;
 	uint32_t ucode_len, i;
-	uint32_t keysel;
-
-	ptr = adev->uvd.inst[0].cpu_addr;
-	ptr += 192 + 16;
-	memcpy(&ucode_len, ptr, 4);
-	ptr += ucode_len;
-	memcpy(&keysel, ptr, 4);
+	static uint32_t keysel = 0;
+
+	/* Only get the validate key at device initialization*/
+	if (!keysel) {
+		ptr = adev->uvd.inst[0].cpu_addr;
+		ptr += 192 + 16;
+		memcpy(&ucode_len, ptr, 4);
+		ptr += ucode_len;
+		memcpy(&keysel, ptr, 4);
+	}
 
 	WREG32(mmUVD_FW_START, keysel);
 
-- 
2.25.1



More information about the amd-gfx mailing list