[PATCH] drm/amdgpu: fix SI UVD firmware validate resume fail
Christian König
ckoenig.leichtzumerken at gmail.com
Wed Nov 11 17:06:38 UTC 2020
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 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;
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);
>
More information about the amd-gfx
mailing list