Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI/VGA: Fix boot device detection after framebuffer relocation
@ 2026-10-28  9:46 wuqianhai
  2026-10-28 10:11 ` sashiko-bot
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: wuqianhai @ 2026-10-28  9:46 UTC (permalink / raw)
  To: bhelgaas
  Cc: wuqianhai, linux-pci, linux-kernel, tzimmermann, javierm,
	dri-devel

From: wuqianhai <wuqianhai@loongson.cn>

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@loongson.cn>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-10-29  8:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28  9:46 [PATCH] PCI/VGA: Fix boot device detection after framebuffer relocation wuqianhai
2026-10-28 10:11 ` sashiko-bot
2026-10-28 23:15 ` Bjorn Helgaas
2026-10-29  3:39   ` wuqianhai
2026-10-29  7:54   ` Thomas Zimmermann
2026-10-29  3:34 ` [PATCH v2] PCI/VGA: Enable firmware default device detection on LoongArch wuqianhai
2026-10-29  3:58   ` sashiko-bot
2026-10-29  8:10   ` Thomas Zimmermann
2026-10-29  7:00 ` [PATCH] PCI/VGA: Fix boot device detection after framebuffer relocation kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox