[PATCH] PCI/VGA: Fix boot device detection after framebuffer relocation
From: wuqianhai
Date: Wed Oct 28 2026 - 05:48:33 EST
From: wuqianhai <wuqianhai@xxxxxxxxxxx>
PCI resource assignment can relocate the firmware framebuffer BAR, which
leaves the base address in screen_info stale. The VGA arbiter then calls
screen_info_pci_dev() from vga_is_firmware_default(), which fails to match
the framebuffer against any PCI device's BARs. As a result, the boot VGA
device is not recognized and the arbiter may select the wrong default
device.
Fix this by calling screen_info_apply_fixups() in vga_arb_device_init()
before adding the VGA devices. This relocates lfb_base to the assigned
BAR address so that vga_is_firmware_default() matches the boot device
again.
Tested on a LoongArch platform, with vga_is_firmware_default()
additionally enabled for CONFIG_LOONGARCH via local changes.
Fixes: 337bf13aa9ddab8ae47f2677ab75cf69ae33437b ("PCI/VGA: Replace vga_is_firmware_default() with a screen info check")
Signed-off-by: wuqianhai <wuqianhai@xxxxxxxxxxx>
---
drivers/pci/vgaarb.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index 3e58b2c05c85..aca594651f58 100644
--- a/drivers/pci/vgaarb.c
+++ b/drivers/pci/vgaarb.c
@@ -1527,6 +1527,14 @@ static int __init vga_arb_device_init(void)
int rc;
struct pci_dev *pdev;
+ /*
+ * PCI resource assignment may have relocated the firmware
+ * framebuffer BAR. Update screen_info's lfb_base so that
+ * vga_is_firmware_default() can match it against the boot
+ * device's relocated resource.
+ */
+ screen_info_apply_fixups();
+
rc = misc_register(&vga_arb_device);
if (rc < 0)
pr_err("error %d registering device\n", rc);
--
2.34.1