Skip to contentSkip to conversation

drm/amdgpu: fix the wrong value of UVD bo size

PATCH In review jimqu 2 participants 5 messages Aug 23, 2016 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

jimqu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix the wrong value of UVD bo size

Driver allocate bo for restore UVD fw ,cache, stack , etc. the firmware size is not only ucode size but the ucode and header.

Change-Id I886c099fa123c4814de9b7db3559c30e7b41fd1b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index 533d702..13ad44e 100644
@@ -198,7 +198,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 		DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n",
 			  version_major, version_minor);
 
-	bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
+	bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(adev->uvd.fw->size) + 8)
 		  +  AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE
 		  +  AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles;
 	r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE,
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw
In reply to a message not in the archive

Am 23.08.2016 um 08:20 schrieb jimqu:

Quoted 2 lines

Driver allocate bo for restore UVD fw ,cache, stack , etc. the firmware size is not only ucode size but the ucode and header.

Nope that isn't correct. Only the firmware is copied to the BO, not the header. See amdgpu_uvd_resume().

Saying this we should probably use the length from the header instead of calculating it manually again in amdgpu_uvd_resume().

Christian.

Quoted 12 lines
Change-Id I886c099fa123c4814de9b7db3559c30e7b41fd1b
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index 533d702..13ad44e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 204

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
@@ -198,7 +198,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
  		DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n",
  			  version_major, version_minor);
 
-	bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
+	bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(adev->uvd.fw->size) + 8)
  		  +  AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE
  		  +  AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles;
  	r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#4 lore raw
In reply to a message not in the archive

Hi Christian:

Yes, I have misunderstand the AMDGPU_UVD_FIRMWARE_OFFSET in amdgpu_uvd_mc_resume().

I will update the patch.

Thanks
JimQu

________________________________________
发件人: Christian König <[email protected]>
发送时间: 2016年8月23日 16:02:11
收件人: Qu, Jim; [email protected]
主题: Re: [PATCH] drm/amdgpu: fix the wrong value of UVD bo size

Am 23.08.2016 um 08:20 schrieb jimqu:

Quoted 2 lines

Driver allocate bo for restore UVD fw ,cache, stack , etc. the firmware size is not only ucode size but the ucode and header.

Nope that isn't correct. Only the firmware is copied to the BO, not the header. See amdgpu_uvd_resume().

Saying this we should probably use the length from the header instead of calculating it manually again in amdgpu_uvd_resume().

Christian.

Quoted 12 lines
Change-Id I886c099fa123c4814de9b7db3559c30e7b41fd1b
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index 533d702..13ad44e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 204

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
@@ -198,7 +198,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
              DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n",
                        version_major, version_minor);
 
-     bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
+     bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(adev->uvd.fw->size) + 8)
                +  AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE
                +  AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles;
      r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw
In reply to a message not in the archive
Quoted 1 line

I will update the patch.

Let me do this. I already had a couple of other TODOs on this part of the code.

Christian.

Am 23.08.2016 um 10:33 schrieb Qu, Jim:

Quoted 40 lines

Hi Christian:

Yes, I have misunderstand the AMDGPU_UVD_FIRMWARE_OFFSET in amdgpu_uvd_mc_resume().

I will update the patch.

Thanks
JimQu

________________________________________
发件人: Christian König <[email protected]>
发送时间: 2016年8月23日 16:02:11
收件人: Qu, Jim; [email protected]
主题: Re: [PATCH] drm/amdgpu: fix the wrong value of UVD bo size

Am 23.08.2016 um 08:20 schrieb jimqu:

Quoted 2 lines

Driver allocate bo for restore UVD fw ,cache, stack , etc. the firmware size is not only ucode size but the ucode and header.

Nope that isn't correct. Only the firmware is copied to the BO, not the header. See amdgpu_uvd_resume().

Saying this we should probably use the length from the header instead of calculating it manually again in amdgpu_uvd_resume().

Christian.

Quoted 14 lines
Change-Id I886c099fa123c4814de9b7db3559c30e7b41fd1b
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index 533d702..13ad44e 100644
@@ -198,7 +198,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
               DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n",
                         version_major, version_minor);
 
Quoted 10 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 204

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
-     bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
+     bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(adev->uvd.fw->size) + 8)
                 +  AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE
                 +  AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles;
       r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#8 lore raw
In reply to a message not in the archive

OK.

Thanks
JimQu

________________________________________
发件人: Christian König <[email protected]>
发送时间: 2016年8月23日 16:53:50
收件人: Qu, Jim; [email protected]
主题: Re: 答复: [PATCH] drm/amdgpu: fix the wrong value of UVD bo size

Quoted 1 line

I will update the patch.

Let me do this. I already had a couple of other TODOs on this part of the code.

Christian.

Am 23.08.2016 um 10:33 schrieb Qu, Jim:

Quoted 40 lines

Hi Christian:

Yes, I have misunderstand the AMDGPU_UVD_FIRMWARE_OFFSET in amdgpu_uvd_mc_resume().

I will update the patch.

Thanks
JimQu

________________________________________
发件人: Christian König <[email protected]>
发送时间: 2016年8月23日 16:02:11
收件人: Qu, Jim; [email protected]
主题: Re: [PATCH] drm/amdgpu: fix the wrong value of UVD bo size

Am 23.08.2016 um 08:20 schrieb jimqu:

Quoted 2 lines

Driver allocate bo for restore UVD fw ,cache, stack , etc. the firmware size is not only ucode size but the ucode and header.

Nope that isn't correct. Only the firmware is copied to the BO, not the header. See amdgpu_uvd_resume().

Saying this we should probably use the length from the header instead of calculating it manually again in amdgpu_uvd_resume().

Christian.

Quoted 14 lines
Change-Id I886c099fa123c4814de9b7db3559c30e7b41fd1b
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index 533d702..13ad44e 100644
@@ -198,7 +198,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
               DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n",
                         version_major, version_minor);
 
Quoted 10 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 204

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
-     bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
+     bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(adev->uvd.fw->size) + 8)
                 +  AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE
                 +  AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles;
       r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx