[PATCH v3 3/6] LoongArch/PCI: Remove vga default device override

From: wuqianhai

Date: Tue Nov 10 2026 - 04:13:03 EST


From: wuqianhai <wuqianhai@xxxxxxxxxxx>

pci_fixup_vgadev() forces the VGA default device to a non-Loongson VGA
device whenever a Loongson display controller is present. This was
added to prefer a discrete graphics card as the default boot device, but
it makes vga_default_device() inconsistent with the firmware boot
display: the firmware framebuffer lives on the integrated controller,
while the override points the default at a discrete card (or leaves it
unset when there is no discrete card).

The fixup runs from pci_bus_add_device(), i.e. after the VGA arbiter has
already selected the default device through the firmware framebuffer, so
it overrides that choice. Drop it so vga_default_device() consistently
reflects the boot display.

Signed-off-by: wuqianhai <wuqianhai@xxxxxxxxxxx>
---
arch/loongarch/pci/pci.c | 18 ------------------
1 file changed, 18 deletions(-)

diff --git a/arch/loongarch/pci/pci.c b/arch/loongarch/pci/pci.c
index f33c7ea1443d..b756a44272ab 100644
--- a/arch/loongarch/pci/pci.c
+++ b/arch/loongarch/pci/pci.c
@@ -8,7 +8,6 @@
#include <linux/delay.h>
#include <linux/types.h>
#include <linux/pci.h>
-#include <linux/vgaarb.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <asm/cacheflush.h>
#include <asm/loongson.h>
@@ -88,23 +87,6 @@ int pcibios_alloc_irq(struct pci_dev *dev)
return acpi_pci_irq_enable(dev);
}

-static void pci_fixup_vgadev(struct pci_dev *pdev)
-{
- struct pci_dev *devp = NULL;
-
- while ((devp = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, devp))) {
- if (devp->vendor != PCI_VENDOR_ID_LOONGSON) {
- vga_set_default_device(devp);
- dev_info(&pdev->dev,
- "Overriding boot device as %X:%X\n",
- devp->vendor, devp->device);
- }
- }
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_DC1, pci_fixup_vgadev);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_DC2, pci_fixup_vgadev);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_DC3, pci_fixup_vgadev);
-
#define CRTC_NUM_MAX 2
#define CRTC_OUTPUT_ENABLE 0x100

--
2.34.1