drm/amdgpu/bios: split vbios fetching between APU and dGPU
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu/bios: split vbios fetching between APU and dGPU
We need some different logic for dGPUs and the APU path can be simplified because there are some methods which are never used on APUs. This also fixes a regression on some older APUs causing the the driver to fetch the unpatched ROM image rather than the patched image.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 47 +++++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +45 -2
@@ -414,7 +414,36 @@ static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) }#endif -bool amdgpu_get_bios (struct amdgpu_device *adev) +static bool amdgpu_get_bios_apu (struct amdgpu_device *adev) +{ +if (amdgpu_acpi_vfct_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from VFCT\n" ); + goto success; + } + +if (igp_read_bios_from_vram (adev)) { +dev_info (adev->dev,"Fetched VBIOS from VRAM BAR\n" ); + goto success; + } + +if (amdgpu_read_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from ROM BAR\n" ); + goto success; + } + +if (amdgpu_read_platform_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from platform\n" ); + goto success; + } + +dev_err (adev->dev,"Unable to locate a BIOS ROM\n" ); +return false; + +success: +return true; +} + +static bool amdgpu_get_bios_dgpu (struct amdgpu_device *adev) {if (amdgpu_atrm_get_bios (adev)) {dev_info (adev->dev,"Fetched VBIOS from ATRM\n" );
@@ -455,10 +484,24 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)return false; success: - adev->is_atom_fw = adev->asic_type >=CHIP_VEGA10 ;return true; } +bool amdgpu_get_bios (struct amdgpu_device *adev) +{ +bool found; + +if (adev->flags &AMD_IS_APU ) + found =amdgpu_get_bios_apu (adev); +else + found =amdgpu_get_bios_dgpu (adev); + +if (found) + adev->is_atom_fw = adev->asic_type >=CHIP_VEGA10 ; + +return found; +} +/* helper function for soc15 and onwards to read bios from rom */ bool amdgpu_soc15_read_bios_from_rom (struct amdgpu_device *adev,u8 *bios,u32 length_bytes)
Signature · 1 line
2.46.0
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks,
Georrge
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Monday, September 16, 2024 4:02 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/bios: split vbios fetching between APU and dGPU
We need some different logic for dGPUs and the APU path can be simplified because there are some methods which are never used on APUs. This also fixes a regression on some older APUs causing the the driver to fetch the unpatched ROM image rather than the patched image.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 47 +++++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +29 -1
@@ -414,7 +414,36 @@ static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) } #endif -bool amdgpu_get_bios (struct amdgpu_device *adev) +static bool amdgpu_get_bios_apu (struct amdgpu_device *adev) { +if (amdgpu_acpi_vfct_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from VFCT\n" ); + goto success; + } + +if (igp_read_bios_from_vram (adev)) { +dev_info (adev->dev,"Fetched VBIOS from VRAM BAR\n" ); + goto success; + } + +if (amdgpu_read_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from ROM BAR\n" ); + goto success; + } + +if (amdgpu_read_platform_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from platform\n" ); + goto success; + } + +dev_err (adev->dev,"Unable to locate a BIOS ROM\n" ); +return false; + +success: +return true; +} + +static bool amdgpu_get_bios_dgpu (struct amdgpu_device *adev) {if (amdgpu_atrm_get_bios (adev)) { dev_info(adev->dev, "Fetched VBIOS from ATRM\n"); @@ -455,10 +484,24 @@ bool amdgpu_get_bios(struct amdgpu_device *adev) return false;
success:
- adev->is_atom_fw = adev->asic_type >= CHIP_VEGA10;
return true;}
+bool amdgpu_get_bios(struct amdgpu_device *adev) {
+ bool found;
+
+ if (adev->flags & AMD_IS_APU)
+ found = amdgpu_get_bios_apu(adev);
+ else
+ found = amdgpu_get_bios_dgpu(adev);
+
+ if (found)
+ adev->is_atom_fw = adev->asic_type >= CHIP_VEGA10;
+
+ return found;
+}
+
/* helper function for soc15 and onwards to read bios from rom */ bool amdgpu_soc15_read_bios_from_rom(struct amdgpu_device *adev,
u8 *bios, u32 length_bytes)
--
2.46.0
Quoted 17 lines · Alex Deucher
We need some different logic for dGPUs and the APU path can be simplified because there are some methods which are never used on APUs. This also fixes a regression on some older APUs causing the the driver to fetch the unpatched ROM image rather than the patched image.
Fixes 9c081c11c621 ("drm/amdgpu: Reorder to read EFI exported ROM first")Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 47 +++++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) · line 416
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +0
-0@@ -414,7 +414,36 @@ static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) }#endif
Now that they are separated couple of additional changes -
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) · line 428
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +12
-1-bool amdgpu_get_bios (struct amdgpu_device *adev) +static bool amdgpu_get_bios_apu (struct amdgpu_device *adev) +{ +if (amdgpu_acpi_vfct_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from VFCT\n" ); + goto success; + } + +if (igp_read_bios_from_vram (adev)) { +dev_info (adev->dev,"Fetched VBIOS from VRAM BAR\n" ); + goto success; + } +
This may no longer be needed for dGPU path.
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +10
-0+if (amdgpu_read_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from ROM BAR\n" ); + goto success; + } + +if (amdgpu_read_platform_bios (adev)) { +dev_info (adev->dev,"Fetched VBIOS from platform\n" ); + goto success; + } +
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) · line 448
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +8
-0+dev_err (adev->dev,"Unable to locate a BIOS ROM\n" ); +return false; + +success: +return true; +} + +static bool amdgpu_get_bios_dgpu (struct amdgpu_device *adev) {if (amdgpu_atrm_get_bios (adev)) {
Better remove this check from this -
/* ATRM is for the discrete card only */
if (adev->flags & AMD_IS_APU)
return false;Thanks,
Lijo
Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +15
-1dev_info (adev->dev,"Fetched VBIOS from ATRM\n" );@@ -455,10 +484,24 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)return false; success: - adev->is_atom_fw = adev->asic_type >=CHIP_VEGA10 ;return true; } +bool amdgpu_get_bios (struct amdgpu_device *adev) +{ +bool found; + +if (adev->flags &AMD_IS_APU ) + found =amdgpu_get_bios_apu (adev); +else + found =amdgpu_get_bios_dgpu (adev); + +if (found) + adev->is_atom_fw = adev->asic_type >=CHIP_VEGA10 ; + +return found; +} +/* helper function for soc15 and onwards to read bios from rom */ bool amdgpu_soc15_read_bios_from_rom (struct amdgpu_device *adev,u8 *bios,u32 length_bytes)