[PATCH 1/2] drm/amdgpu: use memcpy_to/fromio for UVD fw upload

Deucher, Alexander Alexander.Deucher at amd.com
Tue Aug 23 14:43:43 UTC 2016


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Christian König
> Sent: Tuesday, August 23, 2016 5:20 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH 1/2] drm/amdgpu: use memcpy_to/fromio for UVD fw
> upload
> 
> From: Christian König <christian.koenig at amd.com>
> 
> Also use the firmware size from the header instead of calculating it.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

For the series:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index 533d702..7ed75a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -298,7 +298,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device
> *adev)
>  	if (!adev->uvd.saved_bo)
>  		return -ENOMEM;
> 
> -	memcpy(adev->uvd.saved_bo, ptr, size);
> +	memcpy_fromio(adev->uvd.saved_bo, ptr, size);
> 
>  	return 0;
>  }
> @@ -315,7 +315,7 @@ int amdgpu_uvd_resume(struct amdgpu_device
> *adev)
>  	ptr = adev->uvd.cpu_addr;
> 
>  	if (adev->uvd.saved_bo != NULL) {
> -		memcpy(ptr, adev->uvd.saved_bo, size);
> +		memcpy_toio(ptr, adev->uvd.saved_bo, size);
>  		kfree(adev->uvd.saved_bo);
>  		adev->uvd.saved_bo = NULL;
>  	} else {
> @@ -324,11 +324,11 @@ int amdgpu_uvd_resume(struct amdgpu_device
> *adev)
> 
>  		hdr = (const struct common_firmware_header *)adev-
> >uvd.fw->data;
>  		offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
> -		memcpy(adev->uvd.cpu_addr, (adev->uvd.fw->data) +
> offset,
> -			(adev->uvd.fw->size) - offset);
> +		memcpy_toio(adev->uvd.cpu_addr, adev->uvd.fw->data +
> offset,
> +			    le32_to_cpu(hdr->ucode_size_bytes));
>  		size -= le32_to_cpu(hdr->ucode_size_bytes);
>  		ptr += le32_to_cpu(hdr->ucode_size_bytes);
> -		memset(ptr, 0, size);
> +		memset_io(ptr, 0, size);
>  	}
> 
>  	return 0;
> --
> 2.5.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list