drm/amd/amdgpu: fix UVD mc offsets
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu: fix UVD mc offsets
When UVD bo is created, its size is based on the information from firmware header (ucode_size_bytes). The same value should be be used when programming UVD mc controller offsets, otherwise it can happen that (mmUVD_VCPU_CACHE_OFFSET2 + mmUVD_VCPU_CACHE_SIZE2) will point AMDGPU_GPU_PAGE_SIZE bytes after the UVD bo end.
Second issue is that when programming the mmUVD_VCPU_CACHE_SIZE0 register, AMDGPU_UVD_FIRMWARE_OFFSET should be taken into account. If it isn't, (mmUVD_VCPU_CACHE_OFFSET2 + mmUVD_VCPU_CACHE_SIZE2) will always point AMDGPU_UVD_FIRMWARE_OFFSET bytes after the UVD bo end.
--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 7 ++++++- 4 files changed, 18 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +4 -1
@@ -560,10 +560,13 @@ static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) {uint64_t addr;uint32_t size; +const struct common_firmware_header *hdr;/* programm the VCPU memory controller bits 0-27 */ addr = (adev->uvd.gpu_addr +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ) >>3 ; + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size = (AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, addr);WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +4 -1
@@ -250,6 +250,7 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
@@ -258,7 +259,9 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4 -1
@@ -595,6 +595,7 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
@@ -603,7 +604,9 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +6 -1
@@ -616,8 +616,13 @@ static int uvd_v7_0_resume(void *handle)*/ static void uvd_v7_0_mc_resume (struct amdgpu_device *adev) { -uint32_t size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); +uint32_t size;uint32_t offset; +const struct common_firmware_header *hdr; + + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
Signature · 6 lines
2.15.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171110113426.20790-1-predlewski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Am 10.11.2017 um 12:34 schrieb Piotr Redlewski:
Quoted 10 lines
When UVD bo is created, its size is based on the information from firmware header (
ucode_size_bytes). The same value should be be used when programming UVD mc controller offsets, otherwise it can happen that (mmUVD_VCPU_CACHE_OFFSET2+mmUVD_VCPU_CACHE_SIZE2) will pointAMDGPU_GPU_PAGE_SIZEbytes after the UVD bo end.Second issue is that when programming the
mmUVD_VCPU_CACHE_SIZE0register,AMDGPU_UVD_FIRMWARE_OFFSETshould be taken into account. If it isn't, (mmUVD_VCPU_CACHE_OFFSET2+mmUVD_VCPU_CACHE_SIZE2) will always pointAMDGPU_UVD_FIRMWARE_OFFSETbytes after the UVD bo end.
Good catch, a few notes inside.
Quoted 14 lines
Signed-off-by Piotr Redlewski <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 7 ++++++- 4 files changed, 18 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) · line 563
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0@@ -560,10 +560,13 @@ static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) {uint64_t addr;uint32_t size; +const struct common_firmware_header *hdr;
Coding style says reverse tree order. In other words longest line first.
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) · line 569
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +3
-1/* programm the VCPU memory controller bits 0-27 */ addr = (adev->uvd.gpu_addr +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ) >>3 ; + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size = (AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ;
Instead of repeating the code multiple times please add a define for this into amdgpu_uvd.h. E.g. something like this:
#define AMDGPU_UVD_FIRMWARE_SIZE(adev) \
(((const struct common_firmware_header *)(adev)->uvd.fw->data)->ucode_size_bytes + \
8 - AMDGPU_UVD_FIRMWARE_OFFSET)
Regards,
Christian.
Quoted 58 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0WREG32 (mmUVD_VCPU_CACHE_OFFSET0, addr);WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +4
-1@@ -250,6 +250,7 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,@@ -258,7 +259,9 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4
-1@@ -595,6 +595,7 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,@@ -603,7 +604,9 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0
-1@@ -616,8 +616,13 @@ static int uvd_v7_0_resume(void *handle)*/ static void uvd_v7_0_mc_resume (struct amdgpu_device *adev) { -uint32_t size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 );
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static int uvd_v7_0_resume(void *handle) · line 628
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +6
-0+uint32_t size;uint32_t offset; +const struct common_firmware_header *hdr; + + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): dea2b514-65d7-4b77-fafa-ba7788d7e76c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 7 lines · Christian König
Am 10.11.2017 um 12:34 schrieb Piotr Redlewski:
Quoted 6 lines
When UVD bo is created, its size is based on the information from firmware header (
ucode_size_bytes). The same value should be be used when programming UVD mc controller offsets, otherwise it can happen that (mmUVD_VCPU_CACHE_OFFSET2+mmUVD_VCPU_CACHE_SIZE2) will pointAMDGPU_GPU_PAGE_SIZEbytes after the UVD bo end.
Quoted 6 lines
Quoted 4 lines
Second issue is that when programming the
mmUVD_VCPU_CACHE_SIZE0register,AMDGPU_UVD_FIRMWARE_OFFSETshould be taken into account. If it isn't, (mmUVD_VCPU_CACHE_OFFSET2+mmUVD_VCPU_CACHE_SIZE2) will always pointAMDGPU_UVD_FIRMWARE_OFFSETbytes after the UVD bo end.Good catch, a few notes inside.
Thanks for comments, I've already sent v2 of the patch.
Quoted 32 lines
Quoted 15 lines
Signed-off-by Piotr Redlewski <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 7 ++++++- 4 files changed, 18 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) · line 563
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0@@ -560,10 +560,13 @@ static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) {uint64_t addr;uint32_t size; +const struct common_firmware_header *hdr;Coding style says reverse tree order. In other words longest line first.
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) · line 569
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +3
-1/* programm the VCPU memory controller bits 0-27 */ addr = (adev->uvd.gpu_addr +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ) >>3 ; + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size = (AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ;Instead of repeating the code multiple times please add a define for this into
amdgpu_uvd.h. E.g. something like this:
Quoted 4 lines
#define AMDGPU_UVD_FIRMWARE_SIZE(adev) \
(((const structcommon_firmware_header
*)(adev)->uvd.fw->data)->ucode_size_bytes + \
8 -AMDGPU_UVD_FIRMWARE_OFFSET)
I probably miss something, but this get me wondering - when calculating the size of the UVD bo, firmware size is aligned to the page size. Is there a reason for that? If not, maybe similar change could be done in amdgpu_uvd_sw_init.
Regards,
Piotr
Quoted 62 lines
Regards,
Christian.Quoted 58 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0WREG32 (mmUVD_VCPU_CACHE_OFFSET0, addr);WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +4
-1@@ -250,6 +250,7 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,@@ -258,7 +259,9 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4
-1@@ -595,6 +595,7 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,@@ -603,7 +604,9 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +6
-1@@ -616,8 +616,13 @@ static int uvd_v7_0_resume(void *handle)*/ static void uvd_v7_0_mc_resume (struct amdgpu_device *adev) { -uint32_t size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); +uint32_t size;uint32_t offset; +const struct common_firmware_header *hdr; + + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static int uvd_v7_0_resume(void *handle) · line 628
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0
-0if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): 20171110145051.GA5189-vEgOWn/6yzlBufL/[email protected]
Quoted 48 lines · Piotr Redlewski
Quoted 7 lines · Christian König
Am 10.11.2017 um 12:34 schrieb Piotr Redlewski:
Quoted 6 lines
When UVD bo is created, its size is based on the information from firmware header (
ucode_size_bytes). The same value should be be used when programming UVD mc controller offsets, otherwise it can happen that (mmUVD_VCPU_CACHE_OFFSET2+mmUVD_VCPU_CACHE_SIZE2) will pointAMDGPU_GPU_PAGE_SIZEbytes after the UVD bo end.Quoted 6 lines
Quoted 4 lines
Second issue is that when programming the
mmUVD_VCPU_CACHE_SIZE0register,AMDGPU_UVD_FIRMWARE_OFFSETshould be taken into account. If it isn't, (mmUVD_VCPU_CACHE_OFFSET2+mmUVD_VCPU_CACHE_SIZE2) will always pointAMDGPU_UVD_FIRMWARE_OFFSETbytes after the UVD bo end.Good catch, a few notes inside.
Thanks for comments, I've already sent v2 of the patch.
Quoted 32 lines
Quoted 15 lines
Signed-off-by Piotr Redlewski <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 7 ++++++- 4 files changed, 18 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) · line 563
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0@@ -560,10 +560,13 @@ static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) {uint64_t addr;uint32_t size; +const struct common_firmware_header *hdr;Coding style says reverse tree order. In other words longest line first.
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static void uvd_v4_2_mc_resume(struct amdgpu_device *adev) · line 569
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +3
-1/* programm the VCPU memory controller bits 0-27 */ addr = (adev->uvd.gpu_addr +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ) >>3 ; + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size = (AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ) >>3 ;Instead of repeating the code multiple times please add a define for this into
amdgpu_uvd.h. E.g. something like this:
Quoted 8 lines
Quoted 4 lines
#define AMDGPU_UVD_FIRMWARE_SIZE(adev) \
(((const structcommon_firmware_header
*)(adev)->uvd.fw->data)->ucode_size_bytes + \
8 -AMDGPU_UVD_FIRMWARE_OFFSET)I probably miss something, but this get me wondering - when calculating the size of the UVD bo, firmware size is aligned to the page size. Is there a reason for that? If not, maybe similar change could be done in
amdgpu_uvd_sw_init.
Nevermind, I've answered myself this question with v3 of this patch.
Regards,
Piotr
Quoted 73 lines
Regards,
PiotrQuoted 62 lines
Regards,
Christian.Quoted 58 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0WREG32 (mmUVD_VCPU_CACHE_OFFSET0, addr);WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +4
-1@@ -250,6 +250,7 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,@@ -258,7 +259,9 @@ static void uvd_v5_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4
-1@@ -595,6 +595,7 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) {uint64_t offset;uint32_t size; +const struct common_firmware_header *hdr;/* programm memory controller bits 0-27 */ WREG32(mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,@@ -603,7 +604,9 @@ static void uvd_v6_0_mc_resume(struct amdgpu_device *adev) upper_32_bits(adev->uvd.gpu_addr)); offset =AMDGPU_UVD_FIRMWARE_OFFSET ; - size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;WREG32 (mmUVD_VCPU_CACHE_OFFSET0, offset >>3 );WREG32 (mmUVD_VCPU_CACHE_SIZE0, size);drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +6
-1@@ -616,8 +616,13 @@ static int uvd_v7_0_resume(void *handle)*/ static void uvd_v7_0_mc_resume (struct amdgpu_device *adev) { -uint32_t size =AMDGPU_GPU_PAGE_ALIGN (adev->uvd.fw->size +4 ); +uint32_t size;uint32_t offset; +const struct common_firmware_header *hdr; + + hdr = (const struct common_firmware_header *)adev->uvd.fw->data; + size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_UVD_FIRMWARE_OFFSET ;Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static int uvd_v7_0_resume(void *handle) · line 628
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0
-0if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines
_______________________________________________
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