drm/amd: Adjust legacy IP discovery for Picasso/Raven/Raven2
Subsystems (2)
PATCH 1/3 drm/amd: Adjust legacy IP discovery for Picasso/Raven/Raven2
The switch/case statement currently combines 10.0.0 and 10.0.1, but 10.0.1 is only used for Raven 2. So split the two cases up to make this clearer.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +4 -8
@@ -1074,15 +1074,11 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int bl }break ;case IP_VERSION (10 ,0 ,0 ): +if (adev->apu_flags &AMD_APU_IS_PICASSO ) +return "picasso" ; +return "raven" ;case IP_VERSION (10 ,0 ,1 ): -if (adev->asic_type ==CHIP_RAVEN ) { -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) -return "raven2" ; -else if (adev->apu_flags &AMD_APU_IS_PICASSO ) -return "picasso" ; -return "raven" ; - } -break ; +return "raven2" ;case IP_VERSION (11 ,0 ,0 ):return "navi10" ;case IP_VERSION (11 ,0 ,2 ):
Signature · 1 line
2.25.1
PATCH 2/3 drm/amd: Remove needless break for legacy IP discovery MP0 9.0.0
There is already a "default" case in the switch block, so there is no need to have a break after the switch block.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +0 -1
@@ -1072,7 +1072,6 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int bldefault :return NULL ; } -break ;case IP_VERSION (10 ,0 ,0 ):if (adev->apu_flags &AMD_APU_IS_PICASSO )return "picasso" ;
Signature · 1 line
2.25.1
PATCH 3/3 drm/amd: Evaluate early init for all IP blocks even if one fails
In reply to Mario LimoncielloIf early init fails for a single IP block, then no further IP blocks are evaluated. This means that if a user was missing more than one firmware binary they would have to keep adding binaries and re-probing until they discovered the ones missing.
To make this easier, run early init for each IP block and report a single failure if not all passed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -1
@@ -2074,6 +2074,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)struct drm_device *dev =adev_to_drm (adev);struct pci_dev *parent;int i, r; +bool total;amdgpu_device_enable_virtual_display (adev);
@@ -2157,6 +2158,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)if (amdgpu_sriov_vf (adev) && adev->asic_type ==CHIP_SIENNA_CICHLID ) adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK ; + total = true;for (i =0 ; i < adev->num_ip_blocks; i++) {if ((amdgpu_ip_block_mask & (1 << i)) ==0 ) { DRM_ERROR("disabled ip block: %d <%s>\n",
@@ -2170,7 +2172,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) }else if (r) {DRM_ERROR ("early_init of IP block <%s> failed %d\n" , adev->ip_blocks[i].version->funcs->name, r); -return r; + total = false; }else { adev->ip_blocks[i].status.valid = true; }
@@ -2201,6 +2203,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) } } +if (!total) +return -ENODEV ; adev->cg_flags &= amdgpu_cg_mask; adev->pg_flags &= amdgpu_pg_mask;
Signature · 1 line
2.25.1
RE: [PATCH 3/3] drm/amd: Evaluate early init for all IP blocks even if one fails
[AMD Official Use Only - General]
Series is
Quoted 70 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Mario Limonciello
Sent: Monday, January 16, 2023 3:22 AM
To: [email protected]
Cc: Limonciello, Mario <[email protected]>
Subject: [PATCH 3/3] drm/amd: Evaluate early init for all IP blocks even if one failsIf early init fails for a single IP block, then no further IP blocks are evaluated. This means that if a user was missing more than one firmware binary they would have to keep adding binaries and re-probing until they discovered the ones missing.
To make this easier, run early init for each IP block and report a single failure if not all passed.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0@@ -2074,6 +2074,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)struct drm_device *dev =adev_to_drm (adev);struct pci_dev *parent;int i, r; +bool total;amdgpu_device_enable_virtual_display (adev);@@ -2157,6 +2158,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)if (amdgpu_sriov_vf (adev) && adev->asic_type ==CHIP_SIENNA_CICHLID ) adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK ; + total = true;for (i =0 ; i < adev->num_ip_blocks; i++) {if ((amdgpu_ip_block_mask & (1 << i)) == 0) { DRM_ERROR("disabled ip block: %d <%s>\n", @@ -2170,7 +2172,7 @@ static int
amdgpu_device_ip_early_init(struct amdgpu_device *adev)
} else if (r) {
DRM_ERROR("early_init of IP block
<%s> failed %d\n",adev->ip_blocks[i].version-Quoted 1 line
funcs->name, r);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-1-return r; + total = false; }else { adev->ip_blocks[i].status.valid = true; }@@ -2201,6 +2203,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) } } +if (!total) +return -ENODEV ; adev->cg_flags &= amdgpu_cg_mask;adev->pg_flags &= amdgpu_pg_mask;--
2.25.1
[AMD Official Use Only - General]
Quoted 46 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Mario Limonciello
Sent: Monday, January 16, 2023 3:22 AM
To: [email protected]
Cc: Limonciello, Mario <[email protected]>
Subject: [PATCH 1/3] drm/amd: Adjust legacy IP discovery for Picasso/Raven/Raven2The switch/case statement currently combines 10.0.0 and 10.0.1, but 10.0.1 is only used for Raven 2. So split the two cases up to make this clearer.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +4
-8@@ -1074,15 +1074,11 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int bl } break; case IP_VERSION(10, 0, 0): + if (adev->apu_flags & AMD_APU_IS_PICASSO) + return "picasso"; +return "raven" ;case IP_VERSION (10 ,0 ,1 ): - if (adev->asic_type == CHIP_RAVEN) { -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) -return "raven2" ; -else if (adev->apu_flags & AMD_APU_IS_PICASSO) -return "picasso" ; -return "raven" ; - } - break; +return "raven2" ;case IP_VERSION (11 ,0 ,0 ):return "navi10"; case IP_VERSION(11, 0, 2):--
2.25.1
Quoted 4 lines · Mario Limonciello
The switch/case statement currently combines 10.0.0 and 10.0.1, but 10.0.1 is only used for Raven 2. So split the two cases up to make this clearer.
Keep the logic as is. We don't know the revision id which is used to differentiate the raven variants until after IP discovery so we can't assign the proper IP versions for each raven variant and raven asics don't have an IP discovery table (it's hardcoded in amdgpu_discovery.c).
Alex
Quoted 33 lines
Signed-off-by Mario Limonciello <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +4
-9@@ -1074,15 +1074,11 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int bl }break ;case IP_VERSION (10 ,0 ,0 ): +if (adev->apu_flags &AMD_APU_IS_PICASSO ) +return "picasso" ; +return "raven" ;case IP_VERSION (10 ,0 ,1 ): -if (adev->asic_type ==CHIP_RAVEN ) { -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) -return "raven2" ; -else if (adev->apu_flags &AMD_APU_IS_PICASSO ) -return "picasso" ; -return "raven" ; - } -break ; +return "raven2" ;case IP_VERSION (11 ,0 ,0 ):return "navi10" ;case IP_VERSION (11 ,0 ,2 ): --2.25.1
[Public]
Quoted 15 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Monday, January 16, 2023 07:51
To: Limonciello, Mario <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 1/3] drm/amd: Adjust legacy IP discovery for Picasso/Raven/Raven2Quoted 4 lines · Mario Limonciello
The switch/case statement currently combines 10.0.0 and 10.0.1, but 10.0.1 is only used for Raven 2. So split the two cases up to make this clearer.
Quoted 6 lines
Keep the logic as is. We don't know the revision id which is used to differentiate the raven variants until after IP discovery so we can't assign the proper IP versions for each raven variant and raven asics don't have an IP discovery table (it's hardcoded in
amdgpu_discovery.c).
Got it thanks, will drop this patch.
Quoted 37 lines
Alex
Review
Quoted 7 lines
Signed-off-by Mario Limonciello <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.cdrivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c static const char
Quoted 4 lines
index
c03824d0311bd..0d950ae14b27c100644drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +0
-0@@ -1074,15 +1074,11 @@ static const char*amdgpu_ucode_legacy_naming(struct
amdgpu_device*adev, int blQuoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +4
-9}break ;case IP_VERSION (10 ,0 ,0 ): +if (adev->apu_flags &AMD_APU_IS_PICASSO ) +return "picasso" ; +return "raven" ;case IP_VERSION (10 ,0 ,1 ): -if (adev->asic_type ==CHIP_RAVEN ) { -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) -return "raven2" ; -else if (adev->apu_flags &AMD_APU_IS_PICASSO ) -return "picasso" ; -return "raven" ; - } -break ; +return "raven2" ;case IP_VERSION (11 ,0 ,0 ):return "navi10" ;case IP_VERSION (11 ,0 ,2 ): --2.25.1