[PATCH AUTOSEL 6.18-6.12] drm/amdgpu: Prefer ROM BAR for default VGA device
From: Sasha Levin
Date: Mon Aug 31 2026 - 12:18:14 EST
From: Lijo Lazar <lijo.lazar@xxxxxxx>
[ Upstream commit 9e32d17592950478baffaecdbda8e2e60935fd3d ]
Fetching from platform ROM doesn't work with hybrid ROM images. For
default VGA devices also prefer ROM BAR.
Signed-off-by: Lijo Lazar <lijo.lazar@xxxxxxx>
Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
LLM Generated explanations, may be completely bogus:
The background `git log -S` search finished, but this stable tree’s
shallow history isn’t useful here — it only surfaced baseline import
commits (`19eef1d98eeda`, `ac3fd01e4c1ef`), not the real introduction.
The function was added upstream in `27145f78f56a` (“drm/amdgpu: Prefer
shadow rom when available”, March 2025), and that code is already
present in v6.18.43. This patch is a small follow-up for default VGA
devices with hybrid ROM images.
**Verdict: YES** — backport to this tree.
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 4e60753e16e90..dec312b0f3b0a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -33,6 +33,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/acpi.h>
+#include <linux/vgaarb.h>
/*
* BIOS.
*/
@@ -491,7 +492,8 @@ 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);
+ return (res->flags & IORESOURCE_ROM_SHADOW) ||
+ adev->pdev == vga_default_device();
}
static bool amdgpu_get_bios_dgpu(struct amdgpu_device *adev)
--
2.53.0