[PATCH] drm/amdgpu: Prefer shadow rom when available
Alex Deucher
alexdeucher at gmail.com
Wed Mar 26 12:46:07 UTC 2025
On Tue, Mar 25, 2025 at 11:53 PM Lijo Lazar <lijo.lazar at amd.com> wrote:
>
> Fetch VBIOS from shadow ROM when available before trying other methods
> like EFI method.
>
> Signed-off-by: Lijo Lazar <lijo.lazar at amd.com>
> Fixes: 9c081c11c621 ("drm/amdgpu: Reorder to read EFI exported ROM first")
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4066
Fixes: 9c081c11c621 ("drm/amdgpu: Reorder to read EFI exported ROM first")
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 34 +++++++++++++++++++-----
> 1 file changed, 27 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index 75fcc521c171..00e96419fcda 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> @@ -447,6 +447,13 @@ static bool amdgpu_get_bios_apu(struct amdgpu_device *adev)
> return true;
> }
>
> +static bool amdgpu_prefer_rom_resource(struct amdgpu_device *adev)
> +{
> + struct resource *res = &adev->pdev->resource[PCI_ROM_RESOURCE];
> +
> + return (res->flags & IORESOURCE_ROM_SHADOW);
> +}
> +
> static bool amdgpu_get_bios_dgpu(struct amdgpu_device *adev)
> {
> if (amdgpu_atrm_get_bios(adev)) {
> @@ -465,14 +472,27 @@ static bool amdgpu_get_bios_dgpu(struct amdgpu_device *adev)
> goto success;
> }
>
> - if (amdgpu_read_platform_bios(adev)) {
> - dev_info(adev->dev, "Fetched VBIOS from platform\n");
> - goto success;
> - }
> + if (amdgpu_prefer_rom_resource(adev)) {
> + if (amdgpu_read_bios(adev)) {
> + dev_info(adev->dev, "Fetched VBIOS from ROM 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;
> + }
> +
> + } else {
> + if (amdgpu_read_platform_bios(adev)) {
> + dev_info(adev->dev, "Fetched VBIOS from platform\n");
> + goto success;
> + }
> +
> + if (amdgpu_read_bios(adev)) {
> + dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
> + goto success;
> + }
> }
>
> if (amdgpu_read_bios_from_rom(adev)) {
> --
> 2.25.1
>
More information about the amd-gfx
mailing list