drm/amdgpu/vcn: Adjust firmware names indentation
Subsystems (2)
PATCH 1/3 drm/amdgpu/vcn: Adjust firmware names indentation
This is an incredibly trivial fix, just for the sake of "aesthetical" organization of the defines. Some were space based, most were tab based and there was a lack of "alignment", now it's all the same and aligned.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +19 -19
@@ -36,26 +36,26 @@#include "soc15d.h" /* Firmware Names */ -#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin" -#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin" -#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" -#define FIRMWARE_ARCTURUS "amdgpu/arcturus_vcn.bin" -#define FIRMWARE_RENOIR "amdgpu/renoir_vcn.bin" -#define FIRMWARE_GREEN_SARDINE "amdgpu/green_sardine_vcn.bin" -#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin" -#define FIRMWARE_NAVI14 "amdgpu/navi14_vcn.bin" -#define FIRMWARE_NAVI12 "amdgpu/navi12_vcn.bin" -#define FIRMWARE_SIENNA_CICHLID "amdgpu/sienna_cichlid_vcn.bin" -#define FIRMWARE_NAVY_FLOUNDER "amdgpu/navy_flounder_vcn.bin" -#define FIRMWARE_VANGOGH "amdgpu/vangogh_vcn.bin" +#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin" +#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin" +#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" +#define FIRMWARE_ARCTURUS "amdgpu/arcturus_vcn.bin" +#define FIRMWARE_RENOIR "amdgpu/renoir_vcn.bin" +#define FIRMWARE_GREEN_SARDINE "amdgpu/green_sardine_vcn.bin" +#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin" +#define FIRMWARE_NAVI14 "amdgpu/navi14_vcn.bin" +#define FIRMWARE_NAVI12 "amdgpu/navi12_vcn.bin" +#define FIRMWARE_SIENNA_CICHLID "amdgpu/sienna_cichlid_vcn.bin" +#define FIRMWARE_NAVY_FLOUNDER "amdgpu/navy_flounder_vcn.bin" +#define FIRMWARE_VANGOGH "amdgpu/vangogh_vcn.bin"#define FIRMWARE_DIMGREY_CAVEFISH "amdgpu/dimgrey_cavefish_vcn.bin" -#define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin" -#define FIRMWARE_BEIGE_GOBY "amdgpu/beige_goby_vcn.bin" -#define FIRMWARE_YELLOW_CARP "amdgpu/yellow_carp_vcn.bin" -#define FIRMWARE_VCN_3_1_2 "amdgpu/vcn_3_1_2.bin" -#define FIRMWARE_VCN4_0_0 "amdgpu/vcn_4_0_0.bin" -#define FIRMWARE_VCN4_0_2 "amdgpu/vcn_4_0_2.bin" -#define FIRMWARE_VCN4_0_4 "amdgpu/vcn_4_0_4.bin" +#define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin" +#define FIRMWARE_BEIGE_GOBY "amdgpu/beige_goby_vcn.bin" +#define FIRMWARE_YELLOW_CARP "amdgpu/yellow_carp_vcn.bin" +#define FIRMWARE_VCN_3_1_2 "amdgpu/vcn_3_1_2.bin" +#define FIRMWARE_VCN4_0_0 "amdgpu/vcn_4_0_0.bin" +#define FIRMWARE_VCN4_0_2 "amdgpu/vcn_4_0_2.bin" +#define FIRMWARE_VCN4_0_4 "amdgpu/vcn_4_0_4.bin"MODULE_FIRMWARE (FIRMWARE_RAVEN );MODULE_FIRMWARE (FIRMWARE_PICASSO );
Signature · 1 line
2.39.0
PATCH 2/3 drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
Currently both conditionals checked to enable indirect SRAM are repeated for all HW/IP models. Let's just simplify it a bit so code is more compact and readable.
While at it, add the legacy names as a comment per case block, to help whoever is reading the code and doesn't have much experience with the name/number mapping.
---
Hi folks, first of all thanks in advance for reviews/comments!
This work is based on agd5f/amd-staging-drm-next branch - there is this patch from Mario that refactored the amdgpu_vcn.c, and since it dropped the legacy names from the switch cases, I've decided to also include them here as comments.
I'm not sure if that's a good idea, feels good for somebody not so used to the code read the codenames instead of purely numbers, but if you wanna move away from the legacy names for good, lemme know and I can rework without these comments.
Cheers,
Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 84 +++++-------------------- 1 file changed, 16 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +16 -68
@@ -111,78 +111,26 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)atomic_set (&adev->vcn.inst[i].dpg_enc_submission_cnt,0 );switch (adev->ip_versions[UVD_HWIP ][0 ]) { -case IP_VERSION (1 ,0 ,0 ): -case IP_VERSION (1 ,0 ,1 ): -case IP_VERSION (2 ,5 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,2 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,6 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,0 ): -case IP_VERSION (3 ,0 ,64 ): -case IP_VERSION (3 ,0 ,192 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,16 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,33 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,1 ,1 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (1 ,0 ,0 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (1 ,0 ,1 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (2 ,0 ,0 ):/* Navi10 */ +case IP_VERSION (2 ,0 ,2 ):/* Navi12 / Navi14 */ +case IP_VERSION (2 ,2 ,0 ):/* Renoir / Green Sardine */ +case IP_VERSION (2 ,5 ,0 ):/* Arcturus */ +case IP_VERSION (2 ,6 ,0 ):/* Aldebaran */ +case IP_VERSION (3 ,0 ,0 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,2 ):/* Vangogh */ +case IP_VERSION (3 ,0 ,64 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,16 ):/* Dimgray Cavefish */ +case IP_VERSION (3 ,0 ,33 ):/* Beige Goby */ +case IP_VERSION (3 ,0 ,192 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,1 ,1 ):/* Yellow Carp */ case IP_VERSION (3 ,1 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (4 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (4 ,0 ,0 ):/* Vega10 */ case IP_VERSION (4 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ;case IP_VERSION (4 ,0 ,4 ):if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) + (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) adev->vcn.indirect_sram = true;break ;default :
Signature · 1 line
2.39.0
Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
Quoted 116 lines · Guilherme G. Piccoli
Currently both conditionals checked to enable indirect SRAM are repeated for all HW/IP models. Let's just simplify it a bit so code is more compact and readable.
While at it, add the legacy names as a comment per case block, to help whoever is reading the code and doesn't have much experience with the name/number mapping.
Cc James Zhu <[email protected]>Cc Lazar Lijo <[email protected]>Cc Leo Liu <[email protected]>Cc Mario Limonciello <[email protected]>Cc Sonny Jiang <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>---
Hi folks, first of all thanks in advance for reviews/comments!
This work is based on agd5f/amd-staging-drm-next branch - there is this patch from Mario that refactored the
amdgpu_vcn.c, and since it dropped the legacy names from the switch cases, I've decided to also include them here as comments.I'm not sure if that's a good idea, feels good for somebody not so used to the code read the codenames instead of purely numbers, but if you wanna move away from the legacy names for good, lemme know and I can rework without these comments.
Cheers,
Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 84 +++++-------------------- 1 file changed, 16 insertions(+), 68 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +14
-54@@ -111,78 +111,26 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)atomic_set (&adev->vcn.inst[i].dpg_enc_submission_cnt,0 );switch (adev->ip_versions[UVD_HWIP ][0 ]) { -case IP_VERSION (1 ,0 ,0 ): -case IP_VERSION (1 ,0 ,1 ): -case IP_VERSION (2 ,5 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,2 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,6 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,0 ): -case IP_VERSION (3 ,0 ,64 ): -case IP_VERSION (3 ,0 ,192 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,16 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,33 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,1 ,1 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (1 ,0 ,0 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (1 ,0 ,1 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (2 ,0 ,0 ):/* Navi10 */ +case IP_VERSION (2 ,0 ,2 ):/* Navi12 / Navi14 */ +case IP_VERSION (2 ,2 ,0 ):/* Renoir / Green Sardine */ +case IP_VERSION (2 ,5 ,0 ):/* Arcturus */ +case IP_VERSION (2 ,6 ,0 ):/* Aldebaran */ +case IP_VERSION (3 ,0 ,0 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,2 ):/* Vangogh */ +case IP_VERSION (3 ,0 ,64 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,16 ):/* Dimgray Cavefish */ +case IP_VERSION (3 ,0 ,33 ):/* Beige Goby */ +case IP_VERSION (3 ,0 ,192 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,1 ,1 ):/* Yellow Carp */ case IP_VERSION (3 ,1 ,2 ):
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · line 129
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-9-if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (4 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (4 ,0 ,0 ):/* Vega10 */
This comment is incorrect. Vega10 does not have VCN (it has UVD and VCE).
Alex
Alex
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-6case IP_VERSION (4 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ;case IP_VERSION (4 ,0 ,4 ):if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) + (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) adev->vcn.indirect_sram = true;break ;default : --2.39.0
RE: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
[Public]
Quoted 55 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Monday, January 16, 2023 15:42
To: Guilherme G. Piccoli <[email protected]>
Cc: [email protected]; Jiang, Sonny <[email protected]>; [email protected]; Pan, Xinhui <[email protected]>; dri- [email protected]; Lazar, Lijo <[email protected]>; Limonciello, Mario <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Liu, Leo <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking codeQuoted 39 lines · Guilherme G. Piccoli
Currently both conditionals checked to enable indirect SRAM are repeated for all HW/IP models. Let's just simplify it a bit so code is more compact and readable.
While at it, add the legacy names as a comment per case block, to help whoever is reading the code and doesn't have much experience with the name/number mapping.
Cc James Zhu <[email protected]>Cc Lazar Lijo <[email protected]>Cc Leo Liu <[email protected]>Cc Mario Limonciello <[email protected]>Cc Sonny Jiang <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>---
Hi folks, first of all thanks in advance for reviews/comments!
This work is based on agd5f/amd-staging-drm-next branch - there is this patch from Mario that refactored the
amdgpu_vcn.c, and since it dropped the legacy names from the switch cases, I've decided to also include them here as comments.I'm not sure if that's a good idea, feels good for somebody not so used to the code read the codenames instead of purely numbers, but if you wanna move away from the legacy names for good, lemme know and I can rework without these comments.
Cheers,
Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 84 +++++-------------------- 1 file changed, 16 insertions(+), 68 deletions(-)
Quoted 78 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.cdrivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device
Quoted 4 lines
index
1b1a3c9e1863..1f880e162d9d100644drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-0@@ -111,78 +111,26 @@ int amdgpu_vcn_sw_init(struct amdgpu_device*adev)
Quoted 71 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +14
-54atomic_set (&adev->vcn.inst[i].dpg_enc_submission_cnt,0 );switch (adev->ip_versions[UVD_HWIP ][0 ]) { -case IP_VERSION (1 ,0 ,0 ): -case IP_VERSION (1 ,0 ,1 ): -case IP_VERSION (2 ,5 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,2 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,6 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,0 ): -case IP_VERSION (3 ,0 ,64 ): -case IP_VERSION (3 ,0 ,192 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,16 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,33 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,1 ,1 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (1 ,0 ,0 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (1 ,0 ,1 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (2 ,0 ,0 ):/* Navi10 */ +case IP_VERSION (2 ,0 ,2 ):/* Navi12 / Navi14 */ +case IP_VERSION (2 ,2 ,0 ):/* Renoir / Green Sardine */ +case IP_VERSION (2 ,5 ,0 ):/* Arcturus */ +case IP_VERSION (2 ,6 ,0 ):/* Aldebaran */ +case IP_VERSION (3 ,0 ,0 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,2 ):/* Vangogh */ +case IP_VERSION (3 ,0 ,64 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,16 ):/* Dimgray Cavefish */ +case IP_VERSION (3 ,0 ,33 ):/* Beige Goby */ +case IP_VERSION (3 ,0 ,192 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,1 ,1 ):/* Yellow Carp */
The problem with adding a comment about which platform it's in is that this will probably go stale. Some IP blocks are re-used in multiple ASICs.
VCN 3, 1, 1 is a great example. This is used in both Yellow Carp (Rembrandt) as well
as Mendocino. I would think a better approach would be to have a single point
of documentation somewhere in the source tree that we can update after new ASICs launch that could act as a decoder ring.
It's effort to remember to update it, but it's at least a single point of failure.
Quoted 34 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · line 129
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-9case IP_VERSION (3 ,1 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (4 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (4 ,0 ,0 ):/* Vega10 */ This comment is incorrect. Vega10 does not have VCN (it has UVD and VCE).
Alex
Alex
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-6case IP_VERSION (4 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ;case IP_VERSION (4 ,0 ,4 ):if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) + (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) adev->vcn.indirect_sram = true;break ;default : --2.39.0
Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
Quoted 142 lines · Mario
[Public]
Quoted 55 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Monday, January 16, 2023 15:42
To: Guilherme G. Piccoli <[email protected]>
Cc: [email protected]; Jiang, Sonny <[email protected]>; [email protected]; Pan, Xinhui <[email protected]>; dri- [email protected]; Lazar, Lijo <[email protected]>; Limonciello, Mario <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Liu, Leo <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking codeQuoted 39 lines · Guilherme G. Piccoli
Currently both conditionals checked to enable indirect SRAM are repeated for all HW/IP models. Let's just simplify it a bit so code is more compact and readable.
While at it, add the legacy names as a comment per case block, to help whoever is reading the code and doesn't have much experience with the name/number mapping.
Cc James Zhu <[email protected]>Cc Lazar Lijo <[email protected]>Cc Leo Liu <[email protected]>Cc Mario Limonciello <[email protected]>Cc Sonny Jiang <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>---
Hi folks, first of all thanks in advance for reviews/comments!
This work is based on agd5f/amd-staging-drm-next branch - there is this patch from Mario that refactored the
amdgpu_vcn.c, and since it dropped the legacy names from the switch cases, I've decided to also include them here as comments.I'm not sure if that's a good idea, feels good for somebody not so used to the code read the codenames instead of purely numbers, but if you wanna move away from the legacy names for good, lemme know and I can rework without these comments.
Cheers,
Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 84 +++++-------------------- 1 file changed, 16 insertions(+), 68 deletions(-)Quoted 78 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.cdrivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device
Quoted 4 lines
index
1b1a3c9e1863..1f880e162d9d100644drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-0@@ -111,78 +111,26 @@ int amdgpu_vcn_sw_init(struct amdgpu_device*adev)
Quoted 71 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +14
-54atomic_set (&adev->vcn.inst[i].dpg_enc_submission_cnt,0 );switch (adev->ip_versions[UVD_HWIP ][0 ]) { -case IP_VERSION (1 ,0 ,0 ): -case IP_VERSION (1 ,0 ,1 ): -case IP_VERSION (2 ,5 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,2 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,6 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,0 ): -case IP_VERSION (3 ,0 ,64 ): -case IP_VERSION (3 ,0 ,192 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,16 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,33 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,1 ,1 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (1 ,0 ,0 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (1 ,0 ,1 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (2 ,0 ,0 ):/* Navi10 */ +case IP_VERSION (2 ,0 ,2 ):/* Navi12 / Navi14 */ +case IP_VERSION (2 ,2 ,0 ):/* Renoir / Green Sardine */ +case IP_VERSION (2 ,5 ,0 ):/* Arcturus */ +case IP_VERSION (2 ,6 ,0 ):/* Aldebaran */ +case IP_VERSION (3 ,0 ,0 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,2 ):/* Vangogh */ +case IP_VERSION (3 ,0 ,64 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,16 ):/* Dimgray Cavefish */ +case IP_VERSION (3 ,0 ,33 ):/* Beige Goby */ +case IP_VERSION (3 ,0 ,192 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,1 ,1 ):/* Yellow Carp */ The problem with adding a comment about which platform it's in is that this will probably go stale. Some IP blocks are re-used in multiple ASICs.
Quoted 6 lines
VCN 3, 1, 1 is a great example. This is used in both Yellow Carp (Rembrandt) as well
as Mendocino. I would think a better approach would be to have a single point
of documentation somewhere in the source tree that we can update after new ASICs launch that could act as a decoder ring.It's effort to remember to update it, but it's at least a single point of failure.
Maybe it would be better to just drop the case statement and just always set this condition. I don't think there is a case where we don't set it?
Alex
Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · line 129
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-9case IP_VERSION (3 ,1 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (4 ,0 ,0 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (4 ,0 ,0 ):/* Vega10 */ This comment is incorrect. Vega10 does not have VCN (it has UVD and VCE).
Alex
Alex
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-6case IP_VERSION (4 ,0 ,2 ): -if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) - adev->vcn.indirect_sram = true; -break ;case IP_VERSION (4 ,0 ,4 ):if ((adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) && - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) + (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )) adev->vcn.indirect_sram = true;break ;default : --2.39.0
RE: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
[Public]
Quoted 180 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Monday, January 16, 2023 15:54
To: Limonciello, Mario <[email protected]>
Cc: Guilherme G. Piccoli <[email protected]>; amd- [email protected]; Jiang, Sonny <[email protected]>; [email protected]; Pan, Xinhui <[email protected]>; dri- [email protected]; Lazar, Lijo <[email protected]>; kernel- [email protected]; Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Liu, Leo <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking codeQuoted 10 lines · Mario
[Public]
Quoted 5 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Monday, January 16, 2023 15:42
To: Guilherme G. Piccoli <[email protected]>
Cc: [email protected]; Jiang, SonnyQuoted 2 lines
Quoted 2 lines
[email protected]; Pan, Xinhui <[email protected]>; dri- [email protected]; Lazar, Lijo <[email protected]>;
Limonciello,
Quoted 27 lines
Quoted 27 lines
Mario <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Liu, Leo <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking codeQuoted 18 lines · Guilherme G. Piccoli
Currently both conditionals checked to enable indirect SRAM are repeated for all HW/IP models. Let's just simplify it a bit so code is more compact and readable.
While at it, add the legacy names as a comment per case block, to help whoever is reading the code and doesn't have much experience with the name/number mapping.
Cc James Zhu <[email protected]>Cc Lazar Lijo <[email protected]>Cc Leo Liu <[email protected]>Cc Mario Limonciello <[email protected]>Cc Sonny Jiang <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>---
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi folks, first of all thanks in advance for reviews/comments!
This work is based on agd5f/amd-staging-drm-next branch - there is this patch from Mario that refactored the
amdgpu_vcn.c, and since itdropped
Quoted 1 line
Quoted 1 line
Quoted 1 line
the legacy names from the switch cases, I've decided to also include
them
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
here as comments.
I'm not sure if that's a good idea, feels good for somebody not so used to the code read the codenames instead of purely numbers, but if you wanna move away from the legacy names for good, lemme know and I can rework without these comments.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Cheers,
Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 84 +++++--------------------
Quoted 8 lines
Quoted 8 lines
Review
Quoted 3 lines
1 file changed, 16 insertions(+), 68 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.cdrivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct
Quoted 4 lines
index
1b1a3c9e1863..1f880e162d9d100644drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-0@@ -111,78 +111,26 @@ int amdgpu_vcn_sw_init(struct
amdgpu_deviceQuoted 8 lines
Quoted 8 lines
*adev)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-4atomic_set (&adev->vcn.inst[i].dpg_enc_submission_cnt,0 );switch (adev->ip_versions[UVD_HWIP ][0 ]) { -case IP_VERSION (1 ,0 ,0 ): -case IP_VERSION (1 ,0 ,1 ): -case IP_VERSION (2 ,5 ,0 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,2 ,0 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,6 ,0 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,0 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (2 ,0 ,2 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-7- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,0 ): -case IP_VERSION (3 ,0 ,64 ): -case IP_VERSION (3 ,0 ,192 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,2 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,16 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,0 ,33 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (3 ,1 ,1 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6
-3- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (1 ,0 ,0 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (1 ,0 ,1 ):/* Raven (1/2) / Picasso */ +case IP_VERSION (2 ,0 ,0 ):/* Navi10 */ +case IP_VERSION (2 ,0 ,2 ):/* Navi12 / Navi14 */ +case IP_VERSION (2 ,2 ,0 ):/* Renoir / Green Sardine */ +case IP_VERSION (2 ,5 ,0 ):/* Arcturus */ Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · line 127
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +8
-0+case IP_VERSION (2 ,6 ,0 ):/* Aldebaran */ +case IP_VERSION (3 ,0 ,0 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,2 ):/* Vangogh */ +case IP_VERSION (3 ,0 ,64 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,0 ,16 ):/* Dimgray Cavefish */ +case IP_VERSION (3 ,0 ,33 ):/* Beige Goby */ +case IP_VERSION (3 ,0 ,192 ):/* Sienna Cichlid / Navy Flounder */ +case IP_VERSION (3 ,1 ,1 ):/* Yellow Carp */ Quoted 4 lines
The problem with adding a comment about which platform it's in is that this will probably go stale. Some IP blocks are re-used in multiple ASICs.
VCN 3, 1, 1 is a great example. This is used in both Yellow Carp (Rembrandt)
as well
Quoted 1 line
as Mendocino. I would think a better approach would be to have a single
point
Quoted 1 line
of documentation somewhere in the source tree that we can update after
new
Quoted 8 lines
Quoted 3 lines
ASICs launch that could act as a decoder ring.
It's effort to remember to update it, but it's at least a single point of failure.
Maybe it would be better to just drop the case statement and just always set this condition. I don't think there is a case where we don't set it?
Yeah, it wasn't immediately apparent at the time of the rework - but you're right. Goodbye ~75 LOC.
Quoted 43 lines
Alex
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct · line 169
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-1case IP_VERSION (3 ,1 ,2 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-5- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; -case IP_VERSION (4 ,0 ,0 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · line 129
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-3- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ; +case IP_VERSION (4 ,0 ,0 ):/* Vega10 */ This comment is incorrect. Vega10 does not have VCN (it has UVD and
VCE).
Quoted 8 lines
Quoted 8 lines
Alex
Alex
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-1case IP_VERSION (4 ,0 ,2 ): - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0
-3- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) - adev->vcn.indirect_sram = true; -break ;case IP_VERSION (4 ,0 ,4 ): if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)&&
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-2- (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) + (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true;break ;default : --2.39.0
Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
In reply to Limonciello, MarioQuoted 5 lines · Mario
[...]
The problem with adding a comment about which platform it's in is that this will probably go stale. Some IP blocks are re-used in multiple ASICs.
Quoted 7 lines
VCN 3, 1, 1 is a great example. This is used in both Yellow Carp (Rembrandt) as well
as Mendocino. I would think a better approach would be to have a single point
of documentation somewhere in the source tree that we can update after new ASICs launch that could act as a decoder ring.It's effort to remember to update it, but it's at least a single point of failure.
Hi Mario, thanks - it makes a lot of sense! I can remove the comments in the V2, I'll wait a bit more for (potential) extra feedback but I agree with you, so I'm inclined to remove them.
Cheers,
Guilherme
Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
In reply to Alex DeucherQuoted 6 lines · Alex Deucher
[...]
Quoted 1 line
+ case
IP_VERSION(4, 0, 0): /* Vega10 */This comment is incorrect. Vega10 does not have VCN (it has UVD and VCE).
Alex
Thanks Alex! I'll resubmit V2 with this comment removed.
I've stolen it from
https://gitlab.freedesktop.org/agd5f/linux/-/blob/amd-staging-drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c#L1147
, but obviously I misunderstood the mapping here heheh
Cheers,
Guilherme
Re: [PATCH 2/3] drm/amdgpu/vcn: Deduplicate indirect SRAM checking code
Quoted 5 lines · Guilherme G. Piccoli
Quoted 3 lines · Alex Deucher
[...]
Quoted 1 line
+ case
IP_VERSION(4, 0, 0): /* Vega10 */
Quoted 8 lines
Quoted 3 lines
This comment is incorrect. Vega10 does not have VCN (it has UVD and VCE).
Alex
Thanks Alex! I'll resubmit V2 with this comment removed.
I've stolen it from
https://gitlab.freedesktop.org/agd5f/linux/-/blob/amd-staging-drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c#L1147
That is for a different IP (SDMA).
Alex
Quoted 6 lines
, but obviously I misunderstood the mapping here heheh
Cheers,
Guilherme
PATCH 3/3 drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
In reply to Guilherme G. PiccoliCurrently the FW loading path perform some checks based on IP model and in case it is advertised as supported, the VCN indirect SRAM mode is used.
Happens that in case there's any issue on FW and this mode ends-up not being properly supported, the driver probe fails [0]. Debugging this requires driver rebuilding, so to allow fast debug and experiments, add a parameter to force setting indirect SRAM mode to true/false from the kernel command-line; parameter default is -1, which doesn't change the current driver's behavior.
[0] Example of this issue, observed on Steam Deck:
[drm] kiq ring mec 2 pipe 1 q 0
[drm] failed to load ucode VCN0_RAM(0x3A)
[drm] psp gfx command LOAD_IP_FW(0x6) failed and response status is (0xFFFF0000) amdgpu 0000:04:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring vcn_dec_0 test failed (-110) [drm:amdgpu_device_init.cold [amdgpu]] *ERROR* hw_init of IP block <vcn_v3_0> failed -110 amdgpu 0000:04:00.0: amdgpu: amdgpu_device_ip_init failed
amdgpu 0000:04:00.0: amdgpu: Fatal error during GPU init
---
This work is based on agd5f/amd-staging-drm-next branch. Thanks in advance for reviews/comments!
Cheers,
Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++ 3 files changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -215,6 +215,7 @@ extern int amdgpu_noretry;extern int amdgpu_force_asic_type;extern int amdgpu_smartshift_bias;extern int amdgpu_use_xgmi_p2p; +extern int amdgpu_indirect_sram;#ifdef CONFIG_HSA_AMD extern int sched_policy;extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9 -0
@@ -187,6 +187,7 @@ int amdgpu_num_kcq = -1;int amdgpu_smartshift_bias;int amdgpu_use_xgmi_p2p =1 ;int amdgpu_vcnfw_log; +int amdgpu_indirect_sram =-1 ;static void amdgpu_drv_delayed_reset_work_handler (struct work_struct *work);
@@ -941,6 +942,14 @@ MODULE_PARM_DESC(smu_pptable_id, "specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)");module_param_named (smu_pptable_id, amdgpu_smu_pptable_id, int,0444 ); +/** +* DOC: indirect_sram (int) +* Allow users to force using (or not) the VCN indirect SRAM mode in the fw load +* code. Default is -1, meaning auto (aka, don't mess with driver's behavior). +*/ +MODULE_PARM_DESC (indirect_sram,"Force VCN indirect SRAM (-1 = auto (default), 0 = disabled, 1 = enabled)" ); +module_param_named (indirect_sram, amdgpu_indirect_sram, int,0444 ); +/* These devices are not supported by amdgpu. * They are supported by the mach64, r128, radeon drivers */
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -0
@@ -137,6 +137,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)return -EINVAL ; } +if (amdgpu_indirect_sram >=0 ) + adev->vcn.indirect_sram = (bool )amdgpu_indirect_sram; + hdr = (const struct common_firmware_header *)adev->vcn.fw->data; adev->vcn.fw_version =le32_to_cpu (hdr->ucode_version);
Signature · 1 line
2.39.0
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 11 lines · Guilherme G. Piccoli
Currently the FW loading path perform some checks based on IP model and in case it is advertised as supported, the VCN indirect SRAM mode is used.
Happens that in case there's any issue on FW and this mode ends-up not being properly supported, the driver probe fails [0]. Debugging this requires driver rebuilding, so to allow fast debug and experiments, add a parameter to force setting indirect SRAM mode to true/false from the kernel command-line; parameter default is -1, which doesn't change the current driver's behavior.
Probably a question for Leo or James, but I was under the impression non-indirect mode didn't work on production silicon for most chips, but maybe I'm mis-remembering that.
Alex
Quoted 88 lines
[0] Example of this issue, observed on Steam Deck:
[drm] kiq ring mec 2 pipe 1 q 0
[drm] failed to load ucodeVCN0_RAM(0x3A)
[drm] psp gfx commandLOAD_IP_FW(0x6)failed and response status is (0xFFFF0000) amdgpu 0000:04:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ringvcn_dec_0test failed (-110) [drm:amdgpu_device_init.cold [amdgpu]] *ERROR*hw_initof IP block <vcn_v3_0> failed -110 amdgpu 0000:04:00.0: amdgpu:amdgpu_device_ip_initfailed
amdgpu 0000:04:00.0: amdgpu: Fatal error during GPU initCc James Zhu <[email protected]>Cc Lazar Lijo <[email protected]>Cc Leo Liu <[email protected]>Cc Mario Limonciello <[email protected]>Cc Sonny Jiang <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>---
This work is based on agd5f/amd-staging-drm-next branch. Thanks in advance for reviews/comments!
Cheers,Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++ 3 files changed, 13 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -215,6 +215,7 @@ extern int amdgpu_noretry;extern int amdgpu_force_asic_type;extern int amdgpu_smartshift_bias;extern int amdgpu_use_xgmi_p2p; +extern int amdgpu_indirect_sram;#ifdef CONFIG_HSA_AMD extern int sched_policy;extern bool debug_evictions;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9
-0@@ -187,6 +187,7 @@ int amdgpu_num_kcq = -1;int amdgpu_smartshift_bias;int amdgpu_use_xgmi_p2p =1 ;int amdgpu_vcnfw_log; +int amdgpu_indirect_sram =-1 ;static void amdgpu_drv_delayed_reset_work_handler (struct work_struct *work);@@ -941,6 +942,14 @@ MODULE_PARM_DESC(smu_pptable_id, "specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)");module_param_named (smu_pptable_id, amdgpu_smu_pptable_id, int,0444 ); +/** +* DOC: indirect_sram (int) +* Allow users to force using (or not) the VCN indirect SRAM mode in the fw load +* code. Default is -1, meaning auto (aka, don't mess with driver's behavior). +*/ +MODULE_PARM_DESC (indirect_sram,"Force VCN indirect SRAM (-1 = auto (default), 0 = disabled, 1 = enabled)" ); +module_param_named (indirect_sram, amdgpu_indirect_sram, int,0444 ); +/* These devices are not supported by amdgpu. * They are supported by the mach64, r128, radeon drivers */ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3
-1@@ -137,6 +137,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)return -EINVAL ; } +if (amdgpu_indirect_sram >=0 ) + adev->vcn.indirect_sram = (bool )amdgpu_indirect_sram; + hdr = (const struct common_firmware_header *)adev->vcn.fw->data; adev->vcn.fw_version =le32_to_cpu (hdr->ucode_version); --2.39.0
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Secure part requires PSP load VCN boot sequence which is with indirect sram mode.
Regards,
Leo
________________________________
From: Alex Deucher <[email protected]>
Sent: January 16, 2023 4:50 PM
To: Guilherme G. Piccoli <[email protected]>
Cc: [email protected] <[email protected]>; Jiang, Sonny <[email protected]>; [email protected] <[email protected]>; Pan, Xinhui <[email protected]>; [email protected] <[email protected]>; Lazar, Lijo <[email protected]>; Limonciello, Mario <[email protected]>; [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Liu, Leo <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 11 lines · Guilherme G. Piccoli
Currently the FW loading path perform some checks based on IP model and in case it is advertised as supported, the VCN indirect SRAM mode is used.
Happens that in case there's any issue on FW and this mode ends-up not being properly supported, the driver probe fails [0]. Debugging this requires driver rebuilding, so to allow fast debug and experiments, add a parameter to force setting indirect SRAM mode to true/false from the kernel command-line; parameter default is -1, which doesn't change the current driver's behavior.
Probably a question for Leo or James, but I was under the impression non-indirect mode didn't work on production silicon for most chips, but maybe I'm mis-remembering that.
Alex
Quoted 88 lines
[0] Example of this issue, observed on Steam Deck:
[drm] kiq ring mec 2 pipe 1 q 0
[drm] failed to load ucodeVCN0_RAM(0x3A)
[drm] psp gfx commandLOAD_IP_FW(0x6)failed and response status is (0xFFFF0000) amdgpu 0000:04:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ringvcn_dec_0test failed (-110) [drm:amdgpu_device_init.cold [amdgpu]] *ERROR*hw_initof IP block <vcn_v3_0> failed -110 amdgpu 0000:04:00.0: amdgpu:amdgpu_device_ip_initfailed
amdgpu 0000:04:00.0: amdgpu: Fatal error during GPU initCc James Zhu <[email protected]>Cc Lazar Lijo <[email protected]>Cc Leo Liu <[email protected]>Cc Mario Limonciello <[email protected]>Cc Sonny Jiang <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>---
This work is based on agd5f/amd-staging-drm-next branch. Thanks in advance for reviews/comments!
Cheers,Guilherme
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++ 3 files changed, 13 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -215,6 +215,7 @@ extern int amdgpu_noretry;extern int amdgpu_force_asic_type;extern int amdgpu_smartshift_bias;extern int amdgpu_use_xgmi_p2p; +extern int amdgpu_indirect_sram;#ifdef CONFIG_HSA_AMD extern int sched_policy;extern bool debug_evictions;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9
-0@@ -187,6 +187,7 @@ int amdgpu_num_kcq = -1;int amdgpu_smartshift_bias;int amdgpu_use_xgmi_p2p =1 ;int amdgpu_vcnfw_log; +int amdgpu_indirect_sram =-1 ;static void amdgpu_drv_delayed_reset_work_handler (struct work_struct *work);@@ -941,6 +942,14 @@ MODULE_PARM_DESC(smu_pptable_id, "specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)");module_param_named (smu_pptable_id, amdgpu_smu_pptable_id, int,0444 ); +/** +* DOC: indirect_sram (int) +* Allow users to force using (or not) the VCN indirect SRAM mode in the fw load +* code. Default is -1, meaning auto (aka, don't mess with driver's behavior). +*/ +MODULE_PARM_DESC (indirect_sram,"Force VCN indirect SRAM (-1 = auto (default), 0 = disabled, 1 = enabled)" ); +module_param_named (indirect_sram, amdgpu_indirect_sram, int,0444 ); +/* These devices are not supported by amdgpu. * They are supported by the mach64, r128, radeon drivers */ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3
-1@@ -137,6 +137,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)return -EINVAL ; } +if (amdgpu_indirect_sram >=0 ) + adev->vcn.indirect_sram = (bool )amdgpu_indirect_sram; + hdr = (const struct common_firmware_header *)adev->vcn.fw->data; adev->vcn.fw_version =le32_to_cpu (hdr->ucode_version); --2.39.0
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 5 lines · Leo
Secure part requires PSP load VCN boot sequence which is with indirect sram mode.
Regards,
Leo
With that said, and with the plans of just setting the indirect sram mode nevertheless (with no switch/cases anymore - I'll submit the V2 tomorrow if everybody agrees), does anybody oppose to have this parameter for debug reasons?
I first considered doing through debugfs, but obviously was a (very) bad idea, since this should be an early boot tuning heheh
Cheers,
Guilherme
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 5 lines · Guilherme G. Piccoli
Quoted 3 lines · Leo
Secure part requires PSP load VCN boot sequence which is with indirect sram mode.
Quoted 7 lines
Quoted 2 lines
Regards,
LeoWith that said, and with the plans of just setting the indirect sram mode nevertheless (with no switch/cases anymore - I'll submit the V2 tomorrow if everybody agrees), does anybody oppose to have this parameter for debug reasons?
It's not clear to me when this would be used. We only disable it briefly during new asic bring up, after that we never touch it again. No end user on production hardware should ever have to change it and doing so would break VCN on their system.
Alex
Quoted 8 lines
I first considered doing through debugfs, but obviously was a (very) bad idea, since this should be an early boot tuning heheh
Cheers,
Guilherme
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 8 lines · Alex Deucher
[...]
It's not clear to me when this would be used. We only disable it briefly during new asic bring up, after that we never touch it again. No end user on production hardware should ever have to change it and doing so would break VCN on their system.
Alex
[+ Pierre-Loup]
Steam Deck is facing a pretty weird scenario then heheh
Commit 82132ecc543 ("drm/amdgpu: enable Vangogh VCN indirect sram mode") corrected a long-term issue in which the indirect SRAM mode wasn't enabled for Vangogh - and Deck GPU architecture is Vangogh, so it was working perfectly with that disabled.
Happens that a bad FW candidate seems to have broken something - it was a bit convoluted to debug, but we proved that disabling indirect SRAM is a good workaround so far, it "restored the behavior" pre-82132ecc543.
Hence my proposal - this parameter would've made life so much easier, and we're start using it "downstream" now. While I understand that of course the FW should be fixed, meanwhile this is a cheap solution to allow further debug and real use of the system.
Thanks,
Guilherme
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 19 lines · Guilherme G. Piccoli
Quoted 8 lines · Alex Deucher
[...]
It's not clear to me when this would be used. We only disable it briefly during new asic bring up, after that we never touch it again. No end user on production hardware should ever have to change it and doing so would break VCN on their system.
Alex
[+ Pierre-Loup]
Steam Deck is facing a pretty weird scenario then heheh
Commit
82132ecc543("drm/amdgpu: enable Vangogh VCN indirect sram mode") corrected a long-term issue in which the indirect SRAM mode wasn't enabled for Vangogh - and Deck GPU architecture is Vangogh, so it was working perfectly with that disabled.
Quoted 9 lines
Happens that a bad FW candidate seems to have broken something - it was a bit convoluted to debug, but we proved that disabling indirect SRAM is a good workaround so far, it "restored the behavior" pre-82132ecc543.
Hence my proposal - this parameter would've made life so much easier, and we're start using it "downstream" now. While I understand that of course the FW should be fixed, meanwhile this is a cheap solution to allow further debug and real use of the system.
For debugging these type of problems, I think an effective debugging tactic would have been to mask the IP block (amdgpu.ip_block_mask).
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 4 lines · Mario
[...]
For debugging these type of problems, I think an effective debugging tactic would have been to mask the IP block (amdgpu.ip_block_mask).
Thank you, it worked indeed - nice suggestion!
Though I see two problems with that: first, I'm not sure what's the impact in the GPU functioning when I disable some IP block.
Second, the parameter is a bit hard to figure - we need to clear a bit for the IP block we want to disable, and the doc suggest to read on dmesg to get this information (it seems it changes depending on the HW model), but I couldn't parse the proper bit from dmesg. Needed to instrument the kernel to find the proper bit heh
The second part is easy to improve (we can just show this bit in dmesg!), I might do that instead of proposing this parameter, which seems didn't raise much excitement after all heheh
Finally, I'm still curious on why Deck was working fine with the indirect SRAM mode disabled (by mistake) in many kernels - was it in practice the same as disabling the VCN IP block?
Thanks,
Guilherme
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 18 lines · Guilherme G. Piccoli
Quoted 4 lines · Mario
[...]
For debugging these type of problems, I think an effective debugging tactic would have been to mask the IP block (amdgpu.ip_block_mask).
Thank you, it worked indeed - nice suggestion!
Though I see two problems with that: first, I'm not sure what's the impact in the GPU functioning when I disable some IP block.
Second, the parameter is a bit hard to figure - we need to clear a bit for the IP block we want to disable, and the doc suggest to read on dmesg to get this information (it seems it changes depending on the HW model), but I couldn't parse the proper bit from dmesg. Needed to instrument the kernel to find the proper bit heh
Quoted 7 lines
The second part is easy to improve (we can just show this bit in dmesg!), I might do that instead of proposing this parameter, which seems didn't raise much excitement after all heheh
Finally, I'm still curious on why Deck was working fine with the indirect SRAM mode disabled (by mistake) in many kernels - was it in practice the same as disabling the VCN IP block?
IIRC, it depends on the fuse recipe for the particular ASIC.
Alex
Quoted 6 lines
Thanks,
Guilherme
RE: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
[Public]
Quoted 15 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 17, 2023 09:11
To: Guilherme G. Piccoli <[email protected]>
Cc: Limonciello, Mario <[email protected]>; Liu, Leo <[email protected]>; [email protected]; Jiang, Sonny <[email protected]>; [email protected]; Pan, Xinhui <[email protected]>; [email protected]; Lazar, Lijo <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Koenig, Christian <[email protected]>; Pierre-Loup Griffais <[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 14 lines
Quoted 12 lines · Guilherme G. Piccoli
Quoted 4 lines · Mario
[...]
For debugging these type of problems, I think an effective debugging tactic would have been to mask the IP block (amdgpu.ip_block_mask).
Thank you, it worked indeed - nice suggestion!
Though I see two problems with that: first, I'm not sure what's the impact in the GPU functioning when I disable some IP block.
It depends on the individual block what the impact is. For example if you don't have VCN, then you can't do any accelerated video playback.
Quoted 6 lines
Quoted 6 lines
Second, the parameter is a bit hard to figure - we need to clear a bit for the IP block we want to disable, and the doc suggest to read on dmesg to get this information (it seems it changes depending on the HW model), but I couldn't parse the proper bit from dmesg. Needed to instrument the kernel to find the proper bit heh
Isn't it this stuff (taken from a CZN system):
[ 7.797779] [drm] add ip block number 0 <soc15_common> [ 7.797781] [drm] add ip block number 1 <gmc_v9_0> [ 7.797782] [drm] add ip block number 2 <vega10_ih> [ 7.797783] [drm] add ip block number 3 <psp> [ 7.797783] [drm] add ip block number 4 <smu> [ 7.797784] [drm] add ip block number 5 <dm> [ 7.797785] [drm] add ip block number 6 <gfx_v9_0> [ 7.797786] [drm] add ip block number 7 <sdma_v4_0> [ 7.797787] [drm] add ip block number 8 <vcn_v2_0> [ 7.797788] [drm] add ip block number 9 <jpeg_v2_0>
So for that system it would be bit 8 to disable vcn.
In terms of how debugging would work:
I would expect when you get your failure it will have been the previous block # that failed, and so you can reboot with that block masked and see if you get further.
Quoted 19 lines
Quoted 7 lines
The second part is easy to improve (we can just show this bit in dmesg!), I might do that instead of proposing this parameter, which seems didn't raise much excitement after all heheh
Finally, I'm still curious on why Deck was working fine with the indirect SRAM mode disabled (by mistake) in many kernels - was it in practice the same as disabling the VCN IP block?
IIRC, it depends on the fuse recipe for the particular ASIC.
Alex
Quoted 6 lines
Thanks,
Guilherme
Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode
Quoted 28 lines · Mario
[...]
Quoted 3 lines
Quoted 3 lines
Though I see two problems with that: first, I'm not sure what's the impact in the GPU functioning when I disable some IP block.
It depends on the individual block what the impact is. For example if you don't have VCN, then you can't do any accelerated video playback.
Quoted 6 lines
Quoted 6 lines
Second, the parameter is a bit hard to figure - we need to clear a bit for the IP block we want to disable, and the doc suggest to read on dmesg to get this information (it seems it changes depending on the HW model), but I couldn't parse the proper bit from dmesg. Needed to instrument the kernel to find the proper bit heh
Isn't it this stuff (taken from a CZN system):
[ 7.797779] [drm] add ip block number 0 <soc15_common> [ 7.797781] [drm] add ip block number 1 <gmc_v9_0> [ 7.797782] [drm] add ip block number 2 <vega10_ih> [ 7.797783] [drm] add ip block number 3 <psp> [ 7.797783] [drm] add ip block number 4 <smu> [ 7.797784] [drm] add ip block number 5 <dm> [ 7.797785] [drm] add ip block number 6 <gfx_v9_0> [ 7.797786] [drm] add ip block number 7 <sdma_v4_0> [ 7.797787] [drm] add ip block number 8 <vcn_v2_0> [ 7.797788] [drm] add ip block number 9 <jpeg_v2_0>
Quoted 7 lines
So for that system it would be bit 8 to disable vcn.
In terms of how debugging would work:
I would expect when you get your failure it will have been the previous block # that failed, and so you can reboot with that block masked and see if you get further.
Thanks Mario, much appreciated! You're totally right and I messed up not seeing these obvious messages...
So, I'll just drop the parameter on V2.
Cheers,
Guilherme
Quoted 6 lines · Guilherme G. Piccoli
This is an incredibly trivial fix, just for the sake of "aesthetical" organization of the defines. Some were space based, most were tab based and there was a lack of "alignment", now it's all the same and aligned.
Quoted 6 lines
Cc James Zhu <[email protected]>Cc Lazar Lijo <[email protected]>Cc Leo Liu <[email protected]>Cc Mario Limonciello <[email protected]>Cc Sonny Jiang <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>
Quoted 57 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +19
-20@@ -36,26 +36,26 @@#include "soc15d.h" /* Firmware Names */ -#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin" -#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin" -#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" -#define FIRMWARE_ARCTURUS "amdgpu/arcturus_vcn.bin" -#define FIRMWARE_RENOIR "amdgpu/renoir_vcn.bin" -#define FIRMWARE_GREEN_SARDINE "amdgpu/green_sardine_vcn.bin" -#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin" -#define FIRMWARE_NAVI14 "amdgpu/navi14_vcn.bin" -#define FIRMWARE_NAVI12 "amdgpu/navi12_vcn.bin" -#define FIRMWARE_SIENNA_CICHLID "amdgpu/sienna_cichlid_vcn.bin" -#define FIRMWARE_NAVY_FLOUNDER "amdgpu/navy_flounder_vcn.bin" -#define FIRMWARE_VANGOGH "amdgpu/vangogh_vcn.bin" +#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin" +#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin" +#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" +#define FIRMWARE_ARCTURUS "amdgpu/arcturus_vcn.bin" +#define FIRMWARE_RENOIR "amdgpu/renoir_vcn.bin" +#define FIRMWARE_GREEN_SARDINE "amdgpu/green_sardine_vcn.bin" +#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin" +#define FIRMWARE_NAVI14 "amdgpu/navi14_vcn.bin" +#define FIRMWARE_NAVI12 "amdgpu/navi12_vcn.bin" +#define FIRMWARE_SIENNA_CICHLID "amdgpu/sienna_cichlid_vcn.bin" +#define FIRMWARE_NAVY_FLOUNDER "amdgpu/navy_flounder_vcn.bin" +#define FIRMWARE_VANGOGH "amdgpu/vangogh_vcn.bin"#define FIRMWARE_DIMGREY_CAVEFISH "amdgpu/dimgrey_cavefish_vcn.bin" -#define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin" -#define FIRMWARE_BEIGE_GOBY "amdgpu/beige_goby_vcn.bin" -#define FIRMWARE_YELLOW_CARP "amdgpu/yellow_carp_vcn.bin" -#define FIRMWARE_VCN_3_1_2 "amdgpu/vcn_3_1_2.bin" -#define FIRMWARE_VCN4_0_0 "amdgpu/vcn_4_0_0.bin" -#define FIRMWARE_VCN4_0_2 "amdgpu/vcn_4_0_2.bin" -#define FIRMWARE_VCN4_0_4 "amdgpu/vcn_4_0_4.bin" +#define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin" +#define FIRMWARE_BEIGE_GOBY "amdgpu/beige_goby_vcn.bin" +#define FIRMWARE_YELLOW_CARP "amdgpu/yellow_carp_vcn.bin" +#define FIRMWARE_VCN_3_1_2 "amdgpu/vcn_3_1_2.bin" +#define FIRMWARE_VCN4_0_0 "amdgpu/vcn_4_0_0.bin" +#define FIRMWARE_VCN4_0_2 "amdgpu/vcn_4_0_2.bin" +#define FIRMWARE_VCN4_0_4 "amdgpu/vcn_4_0_4.bin"MODULE_FIRMWARE (FIRMWARE_RAVEN );MODULE_FIRMWARE (FIRMWARE_PICASSO ); --2.39.0