Skip to contentSkip to conversation

drm/amdgpu: Reorder to read EFI exported ROM first

PATCH In review Lijo Lazar 4 participants 6 messages Aug 12, 2024 – Sep 25, 2024

Subsystems (2)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Reorder to read EFI exported ROM first

On EFI BIOSes, PCI ROM may be exported through EFI_PCI_IO_PROTOCOL and expansion ROM BARs may not be enabled. Choose to read from EFI exported ROM data before reading PCI Expansion ROM BAR.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +5 -5
index 618e469e3622..42e64bce661e 100644
@@ -431,6 +431,11 @@ bool amdgpu_get_bios(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_read_bios(adev)) {
 		dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
 		goto success;
@@ -446,11 +451,6 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
 		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;
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, August 12, 2024 12:50
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: Reorder to read EFI exported ROM first

On EFI BIOSes, PCI ROM may be exported through EFI_PCI_IO_PROTOCOL and expansion ROM BARs may not be enabled. Choose to read from EFI exported ROM data before reading PCI Expansion ROM BAR.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +5 -5
index 618e469e3622..42e64bce661e 100644
@@ -431,6 +431,11 @@ bool amdgpu_get_bios(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_read_bios(adev)) {
                dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
                goto success;
@@ -446,11 +451,6 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
                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;
 

--
2.25.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Lijo Lazar
Quoted 6 lines · Lijo Lazar

On EFI BIOSes, PCI ROM may be exported through EFI_PCI_IO_PROTOCOL and expansion ROM BARs may not be enabled. Choose to read from EFI exported ROM data before reading PCI Expansion ROM BAR.

Quoted 35 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +5 -6
index 618e469e3622..42e64bce661e 100644
@@ -431,6 +431,11 @@ bool amdgpu_get_bios(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_read_bios(adev)) {
                dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
                goto success;
@@ -446,11 +451,6 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
                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;
 
--

2.25.1

#3 lore raw

6.12-rc0/regression/bisected - 9c081c11c621 drm/amdgpu: Reorder to read EFI exported ROM first - breaks connector enumeration and discovery

In reply to Lijo Lazar

Hello,

This commit in mainline (9c081c11c621) breaks connector enumeration and discovery for me here so my PC->HDMI-to-DP->monitor stops showing
anything after amdgpu starts. Fedora rawhide 6.12 pre rc0 kernels.

There is some
...
amdgpu 0000:0e:00.0: amdgpu: Fetched VBIOS from platform
amdgpu: ATOM BIOS: 13-CEZANNE-019
...
... UBSAN splat ....
kernel: UBSAN: array-index-out-of-bounds in drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn21/dcn21_resource.c:1312:29
....
kernel: [drm:amdgpu_dm_init [amdgpu]] *ERROR* KMS: Failed to detect connector

Reverting the commit on top of mainline restores the video situation to normal. Without the UBSAN splat showing up.

amdgpu 0000:0e:00.0: amdgpu: Fetched VBIOS from ROM BAR
amdgpu: ATOM BIOS: 13-CEZANNE-019
...

Ryzen 7 5700G IGP
Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c8) (prog-if 00 [VGA controller]) Fairly old Gigabyte MB , but with BIOS from March this year.

Regards
- Yanko

Quoted 37 lines · Lijo Lazar

On EFI BIOSes, PCI ROM may be exported through EFI_PCI_IO_PROTOCOL and expansion ROM BARs may not be enabled. Choose to read from EFI exported ROM data before reading PCI Expansion ROM BAR.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +5 -5
index 618e469e3622..42e64bce661e 100644
@@ -431,6 +431,11 @@ bool amdgpu_get_bios(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_read_bios(adev)) {
 		dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
 		goto success;
@@ -446,11 +451,6 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
 		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;
 
#4 lore raw

Re: 6.12-rc0/regression/bisected - 9c081c11c621 drm/amdgpu: Reorder to read EFI exported ROM first - breaks connector enumeration and discovery

Quoted 6 lines · Yanko Kaneti

Hello,

This commit in mainline (9c081c11c621) breaks connector enumeration and discovery for me here so my PC->HDMI-to-DP->monitor stops showing
anything after amdgpu starts. Fedora rawhide 6.12 pre rc0 kernels.

Fixed in this commit:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/375b035f689735fd7a87ff31ccac3a42717252bf
Which is already in my pending PR from last week.

Alex

Quoted 66 lines

There is some
...
amdgpu 0000:0e:00.0: amdgpu: Fetched VBIOS from platform
amdgpu: ATOM BIOS: 13-CEZANNE-019
...
... UBSAN splat ....
kernel: UBSAN: array-index-out-of-bounds in drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn21/dcn21_resource.c:1312:29
....
kernel: [drm:amdgpu_dm_init [amdgpu]] *ERROR* KMS: Failed to detect connector

Reverting the commit on top of mainline restores the video situation to normal. Without the UBSAN splat showing up.

amdgpu 0000:0e:00.0: amdgpu: Fetched VBIOS from ROM BAR
amdgpu: ATOM BIOS: 13-CEZANNE-019
...

Ryzen 7 5700G IGP
Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c8) (prog-if 00 [VGA controller]) Fairly old Gigabyte MB , but with BIOS from March this year.

Regards
- Yanko

Quoted 37 lines · Lijo Lazar

On EFI BIOSes, PCI ROM may be exported through EFI_PCI_IO_PROTOCOL and expansion ROM BARs may not be enabled. Choose to read from EFI exported ROM data before reading PCI Expansion ROM BAR.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +5 -5
index 618e469e3622..42e64bce661e 100644
@@ -431,6 +431,11 @@ bool amdgpu_get_bios(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_read_bios(adev)) {
              dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
              goto success;
@@ -446,11 +451,6 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
              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;
 
#5 lore raw

Re: 6.12-rc0/regression/bisected - 9c081c11c621 drm/amdgpu: Reorder to read EFI exported ROM first - breaks connector enumeration and discovery

Quoted 11 lines · Alex Deucher
Quoted 6 lines · Yanko Kaneti

Hello,

This commit in mainline (9c081c11c621) breaks connector enumeration and discovery for me here so my PC->HDMI-to-DP->monitor stops showing
anything after amdgpu starts. Fedora rawhide 6.12 pre rc0 kernels.

Fixed in this commit:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/375b035f689735fd7a87ff31ccac3a42717252bf
Which is already in my pending PR from last week.

Ahh, sorry, should have dug deeper.

Tested the whole drm-fixes-6.12 PR on top of linus tip and it works fine here.

Thanks
- Yanko