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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 08.11.20 um 16:09 schrieb Sonny Jiang:
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@xxxxxxx>
---
  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;

Well, that is a really big NAK.

You can't just make a variable static and hope that we don't have multiple instances of the device driver loaded.

If you need to keep the value around put it into adev somehow.

Christian.

+
+	/* 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);

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



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux