Skip to content

Commit 4d6a953

Browse files
Sonny Jiangalexdeucher
authored andcommitted
drm/amdgpu: fix SI UVD firmware validate resume fail
The SI UVD firmware validate key is stored at the end of firmware, which is changed during resume while playing video. So get the key at sw_init and store it for fw validate using. Signed-off-by: Sonny Jiang <sonny.jiang@amd.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 7acc79e commit 4d6a953

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct amdgpu_uvd {
6767
unsigned harvest_config;
6868
/* store image width to adjust nb memory state */
6969
unsigned decode_image_width;
70+
uint32_t keyselect;
7071
};
7172

7273
int amdgpu_uvd_sw_init(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,8 @@ static void uvd_v3_1_mc_resume(struct amdgpu_device *adev)
277277
*/
278278
static int uvd_v3_1_fw_validate(struct amdgpu_device *adev)
279279
{
280-
void *ptr;
281-
uint32_t ucode_len, i;
282-
uint32_t keysel;
283-
284-
ptr = adev->uvd.inst[0].cpu_addr;
285-
ptr += 192 + 16;
286-
memcpy(&ucode_len, ptr, 4);
287-
ptr += ucode_len;
288-
memcpy(&keysel, ptr, 4);
280+
int i;
281+
uint32_t keysel = adev->uvd.keyselect;
289282

290283
WREG32(mmUVD_FW_START, keysel);
291284

@@ -550,6 +543,8 @@ static int uvd_v3_1_sw_init(void *handle)
550543
struct amdgpu_ring *ring;
551544
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
552545
int r;
546+
void *ptr;
547+
uint32_t ucode_len;
553548

554549
/* UVD TRAP */
555550
r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, 124, &adev->uvd.inst->irq);
@@ -560,6 +555,13 @@ static int uvd_v3_1_sw_init(void *handle)
560555
if (r)
561556
return r;
562557

558+
/* Retrieval firmware validate key */
559+
ptr = adev->uvd.inst[0].cpu_addr;
560+
ptr += 192 + 16;
561+
memcpy(&ucode_len, ptr, 4);
562+
ptr += ucode_len;
563+
memcpy(&adev->uvd.keyselect, ptr, 4);
564+
563565
ring = &adev->uvd.inst->ring;
564566
sprintf(ring->name, "uvd");
565567
r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0,

0 commit comments

Comments
 (0)