* [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device
[not found] <20261029033440.973077-1-wuqianhai@loongson.cn>
@ 2026-11-10 8:56 ` wuqianhai
2026-11-10 8:56 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
` (2 more replies)
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
1 sibling, 3 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 8:56 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
On LoongArch the kernel cannot reliably identify the display device that
was set up by the firmware and used for the boot console. Two code paths
need this information and currently get it wrong:
* The PCI VGA arbiter: vga_is_firmware_default() is compiled only on
x86, so on LoongArch vga_default_device() may select the wrong GPU
when several are present (for example an integrated display
controller and a discrete card).
* The framebuffer console: LoongArch does not implement
video_is_primary_device(), so with
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y the console falls back to
the generic stub that always returns false and binds to the first
registered framebuffer instead of the boot display.
This series fixes both by publishing the firmware framebuffer information
through screen_info on LoongArch and consuming it the same way x86 does.
Patch 1 always defines and initializes sysfb_primary_display, and always
provides its EFI stub alias, instead of guarding them behind
SYSFB/EFI_EARLYCON.
Patch 2 refreshes screen_info from the PCI resource-assignment path after
the root-bus resources are assigned, so the framebuffer address is final
before the VGA arbiter and sysfb_init() consume it. The call is placed
in the LoongArch PCI scan path because only LoongArch has this ordering:
acpi_init() relocates the BAR before vga_arb_device_init() runs. On x86
the screen_info address is still accurate at that point. If you would
rather have the helper called from the generic
pci_assign_unassigned_root_bus_resources() path so that all architectures
share it, that can be done instead.
Patch 3 removes pci_fixup_vgadev(), which overrides the VGA default
device to a discrete card after the arbiter has already selected the
firmware framebuffer device, so vga_default_device() consistently
reflects the boot display.
Patch 4 implements video_is_primary_device() for LoongArch by reusing the
VGA default device selected by the arbiter.
Patch 5 lets the EFI stub link directly to sysfb_primary_display on
LoongArch, so the firmware framebuffer information is always populated.
Patch 6 lets the VGA arbiter use CONFIG_SCREEN_INFO instead of an
architecture check and makes VGA_ARB select SCREEN_INFO on LoongArch.
Patches 1-4 are LoongArch-specific. Patches 5 and 6 touch generic code
(the EFI stub and the PCI VGA arbiter) and are placed last so they can be
reviewed and merged separately. Patches 3 and 4 depend on patch 6 taking
effect, but are ordered ahead of it only to group the LoongArch changes
together.
Changes since v2:
- Split the screen_info refresh out of vga_arb_device_init() into the
LoongArch PCI resource-assignment path (patch 2), following Thomas'
suggestion to decouple it from sysfb_init().
- Drop the per-architecture check in vgaarb.c and the select of SYSFB
in favour of CONFIG_SCREEN_INFO and select SCREEN_INFO (patch 6).
- Always define and initialize sysfb_primary_display, and let the EFI
stub link to it directly (patches 1 and 5), instead of guarding them
behind SYSFB/EFI_EARLYCON.
- Remove the vga_default_device() override (patch 3) so the arbiter's
firmware-framebuffer selection takes effect.
- Implement video_is_primary_device() (patch 4) by reusing the arbiter's
default device, so FRAMEBUFFER_CONSOLE_DETECT_PRIMARY works.
Build-tested on loongarch64 with GCC 8.3.0.
wuqianhai (6):
LoongArch: efi: Provide sysfb_primary_display for screen_info users
LoongArch/PCI: Refresh screen_info after resource assignment
LoongArch/PCI: Remove vga default device override
LoongArch: video: Implement primary framebuffer device detection
efi/libstub: Enable direct sysfb_primary_display access on LoongArch
PCI/VGA: Enable firmware default device detection on LoongArch
arch/loongarch/Makefile | 3 ++
arch/loongarch/include/asm/video.h | 7 +++++
arch/loongarch/kernel/efi.c | 5 +---
arch/loongarch/kernel/image-vars.h | 2 --
arch/loongarch/pci/acpi.c | 4 +++
arch/loongarch/pci/pci.c | 18 ------------
arch/loongarch/video/Makefile | 3 ++
arch/loongarch/video/video-common.c | 29 +++++++++++++++++++
drivers/firmware/efi/libstub/efi-stub-entry.c | 1 +
drivers/pci/Kconfig | 2 +-
drivers/pci/vgaarb.c | 2 +-
11 files changed, 50 insertions(+), 26 deletions(-)
create mode 100644 arch/loongarch/video/Makefile
create mode 100644 arch/loongarch/video/video-common.c
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users
2026-11-10 8:56 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
@ 2026-11-10 8:56 ` wuqianhai
2026-11-10 14:34 ` Thomas Zimmermann
` (2 more replies)
2026-11-10 8:56 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
2026-11-10 8:56 ` [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override wuqianhai
2 siblings, 3 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 8:56 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
LoongArch defines and initializes sysfb_primary_display only when
CONFIG_SYSFB or CONFIG_EFI_EARLYCON is enabled. The PCI VGA arbiter and
the framebuffer console need the firmware framebuffer information through
screen_info whenever CONFIG_SCREEN_INFO is enabled, even if neither of
those options is set.
Drop the guards so sysfb_primary_display is always defined and
initialized, and its EFI stub alias is always provided, mirroring x86.
This avoids selecting SYSFB just to obtain the symbol.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
arch/loongarch/kernel/efi.c | 5 +----
arch/loongarch/kernel/image-vars.h | 2 --
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 69dd83f8082f..e491a82b2e0d 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -74,10 +74,8 @@ bool efi_poweroff_required(void)
unsigned long __initdata primary_display_table = EFI_INVALID_TABLE_ADDR;
-#if defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)
struct sysfb_display_info sysfb_primary_display __section(".data");
EXPORT_SYMBOL_GPL(sysfb_primary_display);
-#endif
static void __init init_primary_display(void)
{
@@ -129,8 +127,7 @@ void __init efi_init(void)
set_bit(EFI_CONFIG_TABLES, &efi.flags);
- if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
- init_primary_display();
+ init_primary_display();
if (boot_memmap == EFI_INVALID_TABLE_ADDR)
return;
diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
index e557ebd46c2b..4d1d7978553a 100644
--- a/arch/loongarch/kernel/image-vars.h
+++ b/arch/loongarch/kernel/image-vars.h
@@ -11,9 +11,7 @@ __efistub_strcmp = strcmp;
__efistub_kernel_entry = kernel_entry;
__efistub_kernel_asize = kernel_asize;
__efistub_kernel_fsize = kernel_fsize;
-#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
__efistub_sysfb_primary_display = sysfb_primary_display;
-#endif
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment
2026-11-10 8:56 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
2026-11-10 8:56 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
@ 2026-11-10 8:56 ` wuqianhai
2026-11-10 14:46 ` Thomas Zimmermann
2026-11-10 8:56 ` [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override wuqianhai
2 siblings, 1 reply; 20+ messages in thread
From: wuqianhai @ 2026-11-10 8:56 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
PCI resource assignment runs from acpi_init() at subsys_initcall time.
The firmware framebuffer BAR can be relocated, leaving screen_info's
lfb_base stale. vga_arb_device_init() runs later at subsys_initcall_sync
time and reads screen_info to identify the firmware default VGA device.
Update screen_info through the generic screen_info_apply_fixups() helper
right after the root bus resources have been assigned, so both the VGA
arbiter and sysfb_init() observe the final framebuffer address.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
arch/loongarch/pci/acpi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/loongarch/pci/acpi.c b/arch/loongarch/pci/acpi.c
index ccbcea61fcd9..cb313ff67f7e 100644
--- a/arch/loongarch/pci/acpi.c
+++ b/arch/loongarch/pci/acpi.c
@@ -9,6 +9,7 @@
#include <linux/slab.h>
#include <linux/pci-acpi.h>
#include <linux/pci-ecam.h>
+#include <linux/screen_info.h>
#include <asm/pci.h>
#include <asm/numa.h>
@@ -256,6 +257,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
*/
pci_assign_unassigned_root_bus_resources(bus);
+ if (IS_ENABLED(CONFIG_SCREEN_INFO))
+ screen_info_apply_fixups();
+
list_for_each_entry(child, &bus->children, node)
pcie_bus_configure_settings(child);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override
2026-11-10 8:56 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
2026-11-10 8:56 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
2026-11-10 8:56 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
@ 2026-11-10 8:56 ` wuqianhai
2 siblings, 0 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 8:56 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
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@loongson.cn>
---
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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection
@ 2026-11-10 8:57 wuqianhai
0 siblings, 0 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 8:57 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
The LoongArch port does not implement video_is_primary_device(), so it
falls back to the generic stub that always returns false. As a result,
with CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y the framebuffer console
cannot map itself to the primary display device and instead binds to the
first registered framebuffer, which is not necessarily the one the
firmware used for the boot console.
Implement video_is_primary_device() by returning whether the device is
the VGA default device. This reuses the VGA arbiter's choice instead of
matching the firmware framebuffer by address, so it is stable across BAR
resizing: the default device is fixed before any driver runs.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
arch/loongarch/Makefile | 3 +++
arch/loongarch/include/asm/video.h | 7 +++++++
arch/loongarch/video/Makefile | 3 +++
arch/loongarch/video/video-common.c | 29 +++++++++++++++++++++++++++++
4 files changed, 42 insertions(+)
create mode 100644 arch/loongarch/video/Makefile
create mode 100644 arch/loongarch/video/video-common.c
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index 4b22f95aaafb..7fca93298cef 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -166,6 +166,9 @@ bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y)
drivers-$(CONFIG_PCI) += arch/loongarch/pci/
+# framebuffer console primary device detection
+drivers-$(CONFIG_VIDEO) += arch/loongarch/video/
+
KBUILD_AFLAGS += $(cflags-y)
KBUILD_CFLAGS += $(cflags-y)
KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
diff --git a/arch/loongarch/include/asm/video.h b/arch/loongarch/include/asm/video.h
index 9f76845f2d4f..7b38881ea1d6 100644
--- a/arch/loongarch/include/asm/video.h
+++ b/arch/loongarch/include/asm/video.h
@@ -8,6 +8,13 @@
#include <linux/compiler.h>
#include <linux/string.h>
+struct device;
+
+#ifdef CONFIG_VIDEO
+bool video_is_primary_device(struct device *dev);
+#define video_is_primary_device video_is_primary_device
+#endif
+
static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
{
memcpy(to, (void __force *)from, n);
diff --git a/arch/loongarch/video/Makefile b/arch/loongarch/video/Makefile
new file mode 100644
index 000000000000..f1b2a7e54033
--- /dev/null
+++ b/arch/loongarch/video/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_VIDEO) += video-common.o
diff --git a/arch/loongarch/video/video-common.c b/arch/loongarch/video/video-common.c
new file mode 100644
index 000000000000..6fea46661cb6
--- /dev/null
+++ b/arch/loongarch/video/video-common.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2026 Loongson Technology Corporation Limited
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/vgaarb.h>
+
+#include <asm/video.h>
+
+bool video_is_primary_device(struct device *dev)
+{
+ struct pci_dev *pdev;
+
+ if (!dev_is_pci(dev))
+ return false;
+
+ pdev = to_pci_dev(dev);
+
+ if (!pci_is_display(pdev))
+ return false;
+
+ return pdev == vga_default_device();
+}
+EXPORT_SYMBOL(video_is_primary_device);
+
+MODULE_DESCRIPTION("LoongArch video helpers");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device
[not found] <20261029033440.973077-1-wuqianhai@loongson.cn>
2026-11-10 8:56 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
@ 2026-11-10 9:01 ` wuqianhai
2026-11-10 9:01 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
` (6 more replies)
1 sibling, 7 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 9:01 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
On LoongArch the kernel cannot reliably identify the display device that
was set up by the firmware and used for the boot console. Two code paths
need this information and currently get it wrong:
* The PCI VGA arbiter: vga_is_firmware_default() is compiled only on
x86, so on LoongArch vga_default_device() may select the wrong GPU
when several are present (for example an integrated display
controller and a discrete card).
* The framebuffer console: LoongArch does not implement
video_is_primary_device(), so with
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y the console falls back to
the generic stub that always returns false and binds to the first
registered framebuffer instead of the boot display.
This series fixes both by publishing the firmware framebuffer information
through screen_info on LoongArch and consuming it the same way x86 does.
Patch 1 always defines and initializes sysfb_primary_display, and always
provides its EFI stub alias, instead of guarding them behind
SYSFB/EFI_EARLYCON.
Patch 2 refreshes screen_info from the PCI resource-assignment path after
the root-bus resources are assigned, so the framebuffer address is final
before the VGA arbiter and sysfb_init() consume it. The call is placed
in the LoongArch PCI scan path because only LoongArch has this ordering:
acpi_init() relocates the BAR before vga_arb_device_init() runs. On x86
the screen_info address is still accurate at that point. If you would
rather have the helper called from the generic
pci_assign_unassigned_root_bus_resources() path so that all architectures
share it, that can be done instead.
Patch 3 removes pci_fixup_vgadev(), which overrides the VGA default
device to a discrete card after the arbiter has already selected the
firmware framebuffer device, so vga_default_device() consistently
reflects the boot display.
Patch 4 implements video_is_primary_device() for LoongArch by reusing the
VGA default device selected by the arbiter.
Patch 5 lets the EFI stub link directly to sysfb_primary_display on
LoongArch, so the firmware framebuffer information is always populated.
Patch 6 lets the VGA arbiter use CONFIG_SCREEN_INFO instead of an
architecture check and makes VGA_ARB select SCREEN_INFO on LoongArch.
Patches 1-4 are LoongArch-specific. Patches 5 and 6 touch generic code
(the EFI stub and the PCI VGA arbiter) and are placed last so they can be
reviewed and merged separately. Patches 3 and 4 depend on patch 6 taking
effect, but are ordered ahead of it only to group the LoongArch changes
together.
Changes since v2:
- Split the screen_info refresh out of vga_arb_device_init() into the
LoongArch PCI resource-assignment path (patch 2), following Thomas'
suggestion to decouple it from sysfb_init().
- Drop the per-architecture check in vgaarb.c and the select of SYSFB
in favour of CONFIG_SCREEN_INFO and select SCREEN_INFO (patch 6).
- Always define and initialize sysfb_primary_display, and let the EFI
stub link to it directly (patches 1 and 5), instead of guarding them
behind SYSFB/EFI_EARLYCON.
- Remove the vga_default_device() override (patch 3) so the arbiter's
firmware-framebuffer selection takes effect.
- Implement video_is_primary_device() (patch 4) by reusing the arbiter's
default device, so FRAMEBUFFER_CONSOLE_DETECT_PRIMARY works.
Build-tested on loongarch64 with GCC 8.3.0.
wuqianhai (6):
LoongArch: efi: Provide sysfb_primary_display for screen_info users
LoongArch/PCI: Refresh screen_info after resource assignment
LoongArch/PCI: Remove vga default device override
LoongArch: video: Implement primary framebuffer device detection
efi/libstub: Enable direct sysfb_primary_display access on LoongArch
PCI/VGA: Enable firmware default device detection on LoongArch
arch/loongarch/Makefile | 3 ++
arch/loongarch/include/asm/video.h | 7 +++++
arch/loongarch/kernel/efi.c | 5 +---
arch/loongarch/kernel/image-vars.h | 2 --
arch/loongarch/pci/acpi.c | 4 +++
arch/loongarch/pci/pci.c | 18 ------------
arch/loongarch/video/Makefile | 3 ++
arch/loongarch/video/video-common.c | 29 +++++++++++++++++++
drivers/firmware/efi/libstub/efi-stub-entry.c | 1 +
drivers/pci/Kconfig | 2 +-
drivers/pci/vgaarb.c | 2 +-
11 files changed, 50 insertions(+), 26 deletions(-)
create mode 100644 arch/loongarch/video/Makefile
create mode 100644 arch/loongarch/video/video-common.c
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
@ 2026-11-10 9:01 ` wuqianhai
2026-11-10 9:01 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
` (5 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 9:01 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
LoongArch defines and initializes sysfb_primary_display only when
CONFIG_SYSFB or CONFIG_EFI_EARLYCON is enabled. The PCI VGA arbiter and
the framebuffer console need the firmware framebuffer information through
screen_info whenever CONFIG_SCREEN_INFO is enabled, even if neither of
those options is set.
Drop the guards so sysfb_primary_display is always defined and
initialized, and its EFI stub alias is always provided, mirroring x86.
This avoids selecting SYSFB just to obtain the symbol.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
arch/loongarch/kernel/efi.c | 5 +----
arch/loongarch/kernel/image-vars.h | 2 --
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 69dd83f8082f..e491a82b2e0d 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -74,10 +74,8 @@ bool efi_poweroff_required(void)
unsigned long __initdata primary_display_table = EFI_INVALID_TABLE_ADDR;
-#if defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)
struct sysfb_display_info sysfb_primary_display __section(".data");
EXPORT_SYMBOL_GPL(sysfb_primary_display);
-#endif
static void __init init_primary_display(void)
{
@@ -129,8 +127,7 @@ void __init efi_init(void)
set_bit(EFI_CONFIG_TABLES, &efi.flags);
- if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
- init_primary_display();
+ init_primary_display();
if (boot_memmap == EFI_INVALID_TABLE_ADDR)
return;
diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
index e557ebd46c2b..4d1d7978553a 100644
--- a/arch/loongarch/kernel/image-vars.h
+++ b/arch/loongarch/kernel/image-vars.h
@@ -11,9 +11,7 @@ __efistub_strcmp = strcmp;
__efistub_kernel_entry = kernel_entry;
__efistub_kernel_asize = kernel_asize;
__efistub_kernel_fsize = kernel_fsize;
-#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
__efistub_sysfb_primary_display = sysfb_primary_display;
-#endif
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
2026-11-10 9:01 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
@ 2026-11-10 9:01 ` wuqianhai
2026-11-10 9:52 ` sashiko-bot
2026-11-10 9:02 ` [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override wuqianhai
` (4 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: wuqianhai @ 2026-11-10 9:01 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
PCI resource assignment runs from acpi_init() at subsys_initcall time.
The firmware framebuffer BAR can be relocated, leaving screen_info's
lfb_base stale. vga_arb_device_init() runs later at subsys_initcall_sync
time and reads screen_info to identify the firmware default VGA device.
Update screen_info through the generic screen_info_apply_fixups() helper
right after the root bus resources have been assigned, so both the VGA
arbiter and sysfb_init() observe the final framebuffer address.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
arch/loongarch/pci/acpi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/loongarch/pci/acpi.c b/arch/loongarch/pci/acpi.c
index ccbcea61fcd9..cb313ff67f7e 100644
--- a/arch/loongarch/pci/acpi.c
+++ b/arch/loongarch/pci/acpi.c
@@ -9,6 +9,7 @@
#include <linux/slab.h>
#include <linux/pci-acpi.h>
#include <linux/pci-ecam.h>
+#include <linux/screen_info.h>
#include <asm/pci.h>
#include <asm/numa.h>
@@ -256,6 +257,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
*/
pci_assign_unassigned_root_bus_resources(bus);
+ if (IS_ENABLED(CONFIG_SCREEN_INFO))
+ screen_info_apply_fixups();
+
list_for_each_entry(child, &bus->children, node)
pcie_bus_configure_settings(child);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
2026-11-10 9:01 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
2026-11-10 9:01 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
@ 2026-11-10 9:02 ` wuqianhai
2026-11-10 9:24 ` [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection wuqianhai
` (3 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 9:02 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
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@loongson.cn>
---
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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
` (2 preceding siblings ...)
2026-11-10 9:02 ` [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override wuqianhai
@ 2026-11-10 9:24 ` wuqianhai
2026-11-10 9:58 ` sashiko-bot
2026-11-10 9:24 ` [PATCH v3 5/6] efi/libstub: Enable direct sysfb_primary_display access on LoongArch wuqianhai
` (2 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: wuqianhai @ 2026-11-10 9:24 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
The LoongArch port does not implement video_is_primary_device(), so it
falls back to the generic stub that always returns false. As a result,
with CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y the framebuffer console
cannot map itself to the primary display device and instead binds to the
first registered framebuffer, which is not necessarily the one the
firmware used for the boot console.
Implement video_is_primary_device() by returning whether the device is
the VGA default device. This reuses the VGA arbiter's choice instead of
matching the firmware framebuffer by address, so it is stable across BAR
resizing: the default device is fixed before any driver runs.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
arch/loongarch/Makefile | 3 +++
arch/loongarch/include/asm/video.h | 7 +++++++
arch/loongarch/video/Makefile | 3 +++
arch/loongarch/video/video-common.c | 29 +++++++++++++++++++++++++++++
4 files changed, 42 insertions(+)
create mode 100644 arch/loongarch/video/Makefile
create mode 100644 arch/loongarch/video/video-common.c
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index 4b22f95aaafb..7fca93298cef 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -166,6 +166,9 @@ bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y)
drivers-$(CONFIG_PCI) += arch/loongarch/pci/
+# framebuffer console primary device detection
+drivers-$(CONFIG_VIDEO) += arch/loongarch/video/
+
KBUILD_AFLAGS += $(cflags-y)
KBUILD_CFLAGS += $(cflags-y)
KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
diff --git a/arch/loongarch/include/asm/video.h b/arch/loongarch/include/asm/video.h
index 9f76845f2d4f..7b38881ea1d6 100644
--- a/arch/loongarch/include/asm/video.h
+++ b/arch/loongarch/include/asm/video.h
@@ -8,6 +8,13 @@
#include <linux/compiler.h>
#include <linux/string.h>
+struct device;
+
+#ifdef CONFIG_VIDEO
+bool video_is_primary_device(struct device *dev);
+#define video_is_primary_device video_is_primary_device
+#endif
+
static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
{
memcpy(to, (void __force *)from, n);
diff --git a/arch/loongarch/video/Makefile b/arch/loongarch/video/Makefile
new file mode 100644
index 000000000000..f1b2a7e54033
--- /dev/null
+++ b/arch/loongarch/video/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_VIDEO) += video-common.o
diff --git a/arch/loongarch/video/video-common.c b/arch/loongarch/video/video-common.c
new file mode 100644
index 000000000000..6fea46661cb6
--- /dev/null
+++ b/arch/loongarch/video/video-common.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2026 Loongson Technology Corporation Limited
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/vgaarb.h>
+
+#include <asm/video.h>
+
+bool video_is_primary_device(struct device *dev)
+{
+ struct pci_dev *pdev;
+
+ if (!dev_is_pci(dev))
+ return false;
+
+ pdev = to_pci_dev(dev);
+
+ if (!pci_is_display(pdev))
+ return false;
+
+ return pdev == vga_default_device();
+}
+EXPORT_SYMBOL(video_is_primary_device);
+
+MODULE_DESCRIPTION("LoongArch video helpers");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 5/6] efi/libstub: Enable direct sysfb_primary_display access on LoongArch
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
` (3 preceding siblings ...)
2026-11-10 9:24 ` [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection wuqianhai
@ 2026-11-10 9:24 ` wuqianhai
2026-11-10 9:24 ` [PATCH v3 6/6] PCI/VGA: Enable firmware default device detection " wuqianhai
2026-11-10 10:00 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device Huacai Chen
6 siblings, 0 replies; 20+ messages in thread
From: wuqianhai @ 2026-11-10 9:24 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
alloc_primary_display() returns NULL on LoongArch when neither
CONFIG_EFI_EARLYCON nor CONFIG_SYSFB is enabled, so the EFI stub does not
populate the core kernel's sysfb_primary_display. Allow LoongArch to link
directly to sysfb_primary_display, like x86, so the firmware framebuffer
information is always available.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
drivers/firmware/efi/libstub/efi-stub-entry.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c
index efa3ab8ad1c6..2ac22720675c 100644
--- a/drivers/firmware/efi/libstub/efi-stub-entry.c
+++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
@@ -20,6 +20,7 @@ struct sysfb_display_info *alloc_primary_display(void)
return __alloc_primary_display();
if (IS_ENABLED(CONFIG_X86) ||
+ IS_ENABLED(CONFIG_LOONGARCH) ||
IS_ENABLED(CONFIG_EFI_EARLYCON) ||
IS_ENABLED(CONFIG_SYSFB))
return kernel_image_addr(&sysfb_primary_display);
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 6/6] PCI/VGA: Enable firmware default device detection on LoongArch
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
` (4 preceding siblings ...)
2026-11-10 9:24 ` [PATCH v3 5/6] efi/libstub: Enable direct sysfb_primary_display access on LoongArch wuqianhai
@ 2026-11-10 9:24 ` wuqianhai
2026-11-10 9:49 ` sashiko-bot
2026-11-10 10:00 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device Huacai Chen
6 siblings, 1 reply; 20+ messages in thread
From: wuqianhai @ 2026-11-10 9:24 UTC (permalink / raw)
To: chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel, wuqianhai
From: wuqianhai <wuqianhai@loongson.cn>
Use CONFIG_SCREEN_INFO rather than an architecture-specific condition to
guard vga_is_firmware_default(). LoongArch now provides
sysfb_primary_display whenever CONFIG_SCREEN_INFO is enabled, so have
VGA_ARB select SCREEN_INFO on LoongArch as well.
The screen_info staleness is handled by the PCI resource-assignment path
in the previous patch, so vga_arb_device_init() no longer has to refresh
screen_info itself.
Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
---
drivers/pci/Kconfig | 2 +-
drivers/pci/vgaarb.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 0c7408509ba2..01e6378effae 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -255,7 +255,7 @@ config VGA_ARB
bool "VGA Arbitration" if EXPERT
default y
depends on !S390
- select SCREEN_INFO if X86
+ select SCREEN_INFO if X86 || LOONGARCH
help
Some "legacy" VGA devices implemented on PCI typically have the same
hard-decoded addresses as they did on ISA. When multiple PCI devices
diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index 3e58b2c05c85..4528ad038610 100644
--- a/drivers/pci/vgaarb.c
+++ b/drivers/pci/vgaarb.c
@@ -566,7 +566,7 @@ EXPORT_SYMBOL(vga_put);
static bool vga_is_firmware_default(struct pci_dev *pdev)
{
-#if defined CONFIG_X86
+#ifdef CONFIG_SCREEN_INFO
return pdev == screen_info_pci_dev(&sysfb_primary_display.screen);
#else
return false;
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v3 6/6] PCI/VGA: Enable firmware default device detection on LoongArch
2026-11-10 9:24 ` [PATCH v3 6/6] PCI/VGA: Enable firmware default device detection " wuqianhai
@ 2026-11-10 9:49 ` sashiko-bot
0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-11-10 9:49 UTC (permalink / raw)
To: wuqianhai, chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, linux-pci, linux-efi, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] PCI/VGA: stale screen_info on DT/non-x86 paths in
vga_is_firmware_default()
--
commit cc9285f73294dc9c72f6466431882028a26deb92
Author: wuqianhai <wuqianhai@loongson.cn>
PCI/VGA: Enable firmware default device detection on LoongArch
This commit selects SCREEN_INFO for VGA_ARB on LoongArch and switches
vga_is_firmware_default() from a CONFIG_X86 guard to CONFIG_SCREEN_INFO.
> diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
> index 3e58b2c05c854..4528ad0386102 100644
> --- a/drivers/pci/vgaarb.c
> +++ b/drivers/pci/vgaarb.c
> @@ -566,7 +566,7 @@ EXPORT_SYMBOL(vga_put);
>
> static bool vga_is_firmware_default(struct pci_dev *pdev)
> {
> -#if defined CONFIG_X86
> +#ifdef CONFIG_SCREEN_INFO
> return pdev == screen_info_pci_dev(&sysfb_primary_display.screen);
> #else
> return false;
[Severity: Medium]
Does guarding this with CONFIG_SCREEN_INFO cause vga_is_firmware_default()
to read a stale sysfb_primary_display.screen.lfb_base on LoongArch
DeviceTree systems and other non-x86 EFI architectures (such as ARM64, ARM
and RISC-V with CONFIG_SYSFB=y)?
Commit "LoongArch/PCI: Refresh screen_info after resource assignment" only
adds screen_info_apply_fixups() to LoongArch's ACPI pci_acpi_scan_root().
When PCI probing runs via pci_host_probe() (e.g. loongson_pci_probe()) or
generic pci_acpi_scan_root() in drivers/pci/pci-acpi.c,
vga_arb_device_init() runs at subsys_initcall_sync time before
sysfb_init() calls screen_info_apply_fixups() at device_initcall time. If
the firmware framebuffer BAR was relocated during resource assignment or
sits behind a host bridge with a non-zero CPU-to-PCI offset,
screen_info_pci_dev() will not match pdev and fails to select the firmware
default VGA device.
Also, the second paragraph of the commit message says the previous patch
handled screen_info staleness so vga_arb_device_init() no longer needs to
refresh screen_info itself, which looks like leftover commentary from an
earlier version of the series.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110090203.2631481-1-wuqianhai@loongson.cn?part=6
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment
2026-11-10 9:01 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
@ 2026-11-10 9:52 ` sashiko-bot
0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-11-10 9:52 UTC (permalink / raw)
To: wuqianhai, chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, linux-pci, linux-efi, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] LoongArch/PCI: repeated fixup and UAF via
screen_info_apply_fixups()
--
commit 1413644b1b0b80d135ecb2502366b5c2eb670d52
Author: wuqianhai <wuqianhai@loongson.cn>
LoongArch/PCI: Refresh screen_info after resource assignment
This commit calls screen_info_apply_fixups() in pci_acpi_scan_root() after
assigning root bus resources so that screen_info reflects any relocated
firmware framebuffer BAR before vga_arb_device_init() and sysfb_init() run.
> diff --git a/arch/loongarch/pci/acpi.c b/arch/loongarch/pci/acpi.c
> index ccbcea61fcd9c..cb313ff67f7e7 100644
> --- a/arch/loongarch/pci/acpi.c
> +++ b/arch/loongarch/pci/acpi.c
[ ... ]
> @@ -256,6 +257,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
> */
> pci_assign_unassigned_root_bus_resources(bus);
>
> + if (IS_ENABLED(CONFIG_SCREEN_INFO))
> + screen_info_apply_fixups();
[Severity: Medium]
Is screen_info_apply_fixups() safe to call from pci_acpi_scan_root()?
screen_info_apply_fixups() was previously called only once from
sysfb_init(). When it updates the framebuffer address, it neither updates
screen_info_lfb_res_start nor clears screen_info_lfb_pdev:
drivers/video/screen_info_pci.c:screen_info_apply_fixups() {
...
if (screen_info_lfb_pdev) {
struct resource *pr = &screen_info_lfb_pdev->resource[screen_info_lfb_bar];
if (pr->start != screen_info_lfb_res_start) {
if (__screen_info_relocation_is_valid(si, pr)) {
__screen_info_set_lfb_base(si, pr->start + screen_info_lfb_offset);
pr_info("Relocating firmware framebuffer to offset %pa[d] within %pr\n",
&screen_info_lfb_offset, pr);
...
}
Because pr->start != screen_info_lfb_res_start remains true after a
relocation, every subsequent root bridge scan on multi-root systems and the
later call in sysfb_init() will re-run the relocation branch and emit
duplicate messages. If a built-in DRM driver probes before sysfb_init(),
calls sysfb_disable(), and resizes the BAR, sysfb_init() will also
re-evaluate the resized BAR before checking whether sysfb was disabled.
In addition, screen_info_lfb_pdev is an unreferenced pointer that is never
cleared on PCI device removal, while pci_acpi_scan_root() can be called
after boot via acpi_pci_root_add() hotplug. Removing the boot display PCI
device and hot-adding an ACPI PCI root bridge would dereference the freed
screen_info_lfb_pdev in screen_info_apply_fixups().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110090203.2631481-1-wuqianhai@loongson.cn?part=2
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection
2026-11-10 9:24 ` [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection wuqianhai
@ 2026-11-10 9:58 ` sashiko-bot
0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-11-10 9:58 UTC (permalink / raw)
To: wuqianhai, chenhuacai, kernel, tzimmermann, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, linux-pci, linux-efi, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] LoongArch: video: missing linux/export.h include in
video-common.c
--
commit 3e46d96932a555bf0346972f71660950e04f755d
Author: wuqianhai <wuqianhai@loongson.cn>
LoongArch: video: Implement primary framebuffer device detection
This commit implements video_is_primary_device() for LoongArch by checking
whether a PCI display device matches vga_default_device().
> diff --git a/arch/loongarch/video/video-common.c b/arch/loongarch/video/video-common.c
> new file mode 100644
> index 0000000000000..6fea46661cb64
> --- /dev/null
> +++ b/arch/loongarch/video/video-common.c
> @@ -0,0 +1,29 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2026 Loongson Technology Corporation Limited
> + */
> +
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/vgaarb.h>
> +
> +#include <asm/video.h>
> +
> +bool video_is_primary_device(struct device *dev)
> +{
> + struct pci_dev *pdev;
> +
> + if (!dev_is_pci(dev))
> + return false;
> +
> + pdev = to_pci_dev(dev);
> +
> + if (!pci_is_display(pdev))
> + return false;
> +
> + return pdev == vga_default_device();
> +}
> +EXPORT_SYMBOL(video_is_primary_device);
> +
> +MODULE_DESCRIPTION("LoongArch video helpers");
> +MODULE_LICENSE("GPL");
[Severity: Low]
Should this file include <linux/export.h> instead of <linux/module.h>?
Using EXPORT_SYMBOL() without a direct #include <linux/export.h> triggers
a scripts/misc-check warning when building with W=2:
arch/loongarch/video/video-common.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
Since CONFIG_VIDEO is a bool Kconfig symbol, video-common.o is only ever
built-in and does not need <linux/module.h>, MODULE_DESCRIPTION(), or
MODULE_LICENSE().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110090203.2631481-1-wuqianhai@loongson.cn?part=4
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
` (5 preceding siblings ...)
2026-11-10 9:24 ` [PATCH v3 6/6] PCI/VGA: Enable firmware default device detection " wuqianhai
@ 2026-11-10 10:00 ` Huacai Chen
6 siblings, 0 replies; 20+ messages in thread
From: Huacai Chen @ 2026-11-10 10:00 UTC (permalink / raw)
To: wuqianhai
Cc: kernel, tzimmermann, deller, bhelgaas, ardb, ilias.apalodimas,
javierm, loongarch, linux-pci, linux-efi, dri-devel, linux-fbdev,
linux-kernel
Hi, Qianhai,
On Tue, Nov 10, 2026 at 5:04 PM <wuqianhai@loongson.cn> wrote:
>
> From: wuqianhai <wuqianhai@loongson.cn>
>
> On LoongArch the kernel cannot reliably identify the display device that
> was set up by the firmware and used for the boot console. Two code paths
> need this information and currently get it wrong:
>
> * The PCI VGA arbiter: vga_is_firmware_default() is compiled only on
> x86, so on LoongArch vga_default_device() may select the wrong GPU
> when several are present (for example an integrated display
> controller and a discrete card).
>
> * The framebuffer console: LoongArch does not implement
> video_is_primary_device(), so with
> CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y the console falls back to
> the generic stub that always returns false and binds to the first
> registered framebuffer instead of the boot display.
>
> This series fixes both by publishing the firmware framebuffer information
> through screen_info on LoongArch and consuming it the same way x86 does.
>
> Patch 1 always defines and initializes sysfb_primary_display, and always
> provides its EFI stub alias, instead of guarding them behind
> SYSFB/EFI_EARLYCON.
>
> Patch 2 refreshes screen_info from the PCI resource-assignment path after
> the root-bus resources are assigned, so the framebuffer address is final
> before the VGA arbiter and sysfb_init() consume it. The call is placed
> in the LoongArch PCI scan path because only LoongArch has this ordering:
> acpi_init() relocates the BAR before vga_arb_device_init() runs. On x86
> the screen_info address is still accurate at that point. If you would
> rather have the helper called from the generic
> pci_assign_unassigned_root_bus_resources() path so that all architectures
> share it, that can be done instead.
>
> Patch 3 removes pci_fixup_vgadev(), which overrides the VGA default
> device to a discrete card after the arbiter has already selected the
> firmware framebuffer device, so vga_default_device() consistently
> reflects the boot display.
>
> Patch 4 implements video_is_primary_device() for LoongArch by reusing the
> VGA default device selected by the arbiter.
>
> Patch 5 lets the EFI stub link directly to sysfb_primary_display on
> LoongArch, so the firmware framebuffer information is always populated.
>
> Patch 6 lets the VGA arbiter use CONFIG_SCREEN_INFO instead of an
> architecture check and makes VGA_ARB select SCREEN_INFO on LoongArch.
>
> Patches 1-4 are LoongArch-specific. Patches 5 and 6 touch generic code
> (the EFI stub and the PCI VGA arbiter) and are placed last so they can be
> reviewed and merged separately. Patches 3 and 4 depend on patch 6 taking
> effect, but are ordered ahead of it only to group the LoongArch changes
> together.
>
> Changes since v2:
> - Split the screen_info refresh out of vga_arb_device_init() into the
> LoongArch PCI resource-assignment path (patch 2), following Thomas'
> suggestion to decouple it from sysfb_init().
> - Drop the per-architecture check in vgaarb.c and the select of SYSFB
> in favour of CONFIG_SCREEN_INFO and select SCREEN_INFO (patch 6).
> - Always define and initialize sysfb_primary_display, and let the EFI
> stub link to it directly (patches 1 and 5), instead of guarding them
> behind SYSFB/EFI_EARLYCON.
> - Remove the vga_default_device() override (patch 3) so the arbiter's
> firmware-framebuffer selection takes effect.
> - Implement video_is_primary_device() (patch 4) by reusing the arbiter's
> default device, so FRAMEBUFFER_CONSOLE_DETECT_PRIMARY works.
>
> Build-tested on loongarch64 with GCC 8.3.0.
>
> wuqianhai (6):
> LoongArch: efi: Provide sysfb_primary_display for screen_info users
> LoongArch/PCI: Refresh screen_info after resource assignment
> LoongArch/PCI: Remove vga default device override
> LoongArch: video: Implement primary framebuffer device detection
> efi/libstub: Enable direct sysfb_primary_display access on LoongArch
Please fold this patch to the first one.
And your signature should be:
Qianhai Wu <wuqianhai@loongson.cn>
Huacai
> PCI/VGA: Enable firmware default device detection on LoongArch
>
> arch/loongarch/Makefile | 3 ++
> arch/loongarch/include/asm/video.h | 7 +++++
> arch/loongarch/kernel/efi.c | 5 +---
> arch/loongarch/kernel/image-vars.h | 2 --
> arch/loongarch/pci/acpi.c | 4 +++
> arch/loongarch/pci/pci.c | 18 ------------
> arch/loongarch/video/Makefile | 3 ++
> arch/loongarch/video/video-common.c | 29 +++++++++++++++++++
> drivers/firmware/efi/libstub/efi-stub-entry.c | 1 +
> drivers/pci/Kconfig | 2 +-
> drivers/pci/vgaarb.c | 2 +-
> 11 files changed, 50 insertions(+), 26 deletions(-)
> create mode 100644 arch/loongarch/video/Makefile
> create mode 100644 arch/loongarch/video/video-common.c
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users
2026-11-10 8:56 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
@ 2026-11-10 14:34 ` Thomas Zimmermann
2026-11-10 14:39 ` Thomas Zimmermann
2026-11-10 16:25 ` Thomas Zimmermann
2 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-11-10 14:34 UTC (permalink / raw)
To: wuqianhai, chenhuacai, kernel, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel
Hi
Am 10.11.26 um 09:56 schrieb wuqianhai@loongson.cn:
> From: wuqianhai <wuqianhai@loongson.cn>
>
> LoongArch defines and initializes sysfb_primary_display only when
> CONFIG_SYSFB or CONFIG_EFI_EARLYCON is enabled. The PCI VGA arbiter and
> the framebuffer console need the firmware framebuffer information through
> screen_info whenever CONFIG_SCREEN_INFO is enabled, even if neither of
> those options is set.
>
> Drop the guards so sysfb_primary_display is always defined and
> initialized, and its EFI stub alias is always provided, mirroring x86.
> This avoids selecting SYSFB just to obtain the symbol.
>
> Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
> ---
> arch/loongarch/kernel/efi.c | 5 +----
> arch/loongarch/kernel/image-vars.h | 2 --
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
> index 69dd83f8082f..e491a82b2e0d 100644
> --- a/arch/loongarch/kernel/efi.c
> +++ b/arch/loongarch/kernel/efi.c
> @@ -74,10 +74,8 @@ bool efi_poweroff_required(void)
>
> unsigned long __initdata primary_display_table = EFI_INVALID_TABLE_ADDR;
>
> -#if defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)
> struct sysfb_display_info sysfb_primary_display __section(".data");
> EXPORT_SYMBOL_GPL(sysfb_primary_display);
> -#endif
I never understood how linking works. I would assume that this symbol
interferes with the shared one at [1]. Can't loongarch use that as well?
[1]
https://elixir.bootlin.com/linux/v7.3.1/source/drivers/firmware/efi/efi-init.c#L64
Best regards
Thomas
>
> static void __init init_primary_display(void)
> {
> @@ -129,8 +127,7 @@ void __init efi_init(void)
>
> set_bit(EFI_CONFIG_TABLES, &efi.flags);
>
> - if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
> - init_primary_display();
> + init_primary_display();
>
> if (boot_memmap == EFI_INVALID_TABLE_ADDR)
> return;
> diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
> index e557ebd46c2b..4d1d7978553a 100644
> --- a/arch/loongarch/kernel/image-vars.h
> +++ b/arch/loongarch/kernel/image-vars.h
> @@ -11,9 +11,7 @@ __efistub_strcmp = strcmp;
> __efistub_kernel_entry = kernel_entry;
> __efistub_kernel_asize = kernel_asize;
> __efistub_kernel_fsize = kernel_fsize;
> -#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
> __efistub_sysfb_primary_display = sysfb_primary_display;
> -#endif
>
> #endif
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users
2026-11-10 8:56 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
2026-11-10 14:34 ` Thomas Zimmermann
@ 2026-11-10 14:39 ` Thomas Zimmermann
2026-11-10 16:25 ` Thomas Zimmermann
2 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-11-10 14:39 UTC (permalink / raw)
To: wuqianhai, chenhuacai, kernel, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel
Hi
Am 10.11.26 um 09:56 schrieb wuqianhai@loongson.cn:
> From: wuqianhai <wuqianhai@loongson.cn>
>
> LoongArch defines and initializes sysfb_primary_display only when
> CONFIG_SYSFB or CONFIG_EFI_EARLYCON is enabled. The PCI VGA arbiter and
> the framebuffer console need the firmware framebuffer information through
> screen_info whenever CONFIG_SCREEN_INFO is enabled, even if neither of
> those options is set.
>
> Drop the guards so sysfb_primary_display is always defined and
> initialized, and its EFI stub alias is always provided, mirroring x86.
> This avoids selecting SYSFB just to obtain the symbol.
The idea is that you select SYSFB is you're interested in that
information. I guess we could make sysfb_primary_display available if
CONFIG_VGA_ARB=y.
Best regards
Thomas
>
> Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
> ---
> arch/loongarch/kernel/efi.c | 5 +----
> arch/loongarch/kernel/image-vars.h | 2 --
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
> index 69dd83f8082f..e491a82b2e0d 100644
> --- a/arch/loongarch/kernel/efi.c
> +++ b/arch/loongarch/kernel/efi.c
> @@ -74,10 +74,8 @@ bool efi_poweroff_required(void)
>
> unsigned long __initdata primary_display_table = EFI_INVALID_TABLE_ADDR;
>
> -#if defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)
> struct sysfb_display_info sysfb_primary_display __section(".data");
> EXPORT_SYMBOL_GPL(sysfb_primary_display);
> -#endif
>
> static void __init init_primary_display(void)
> {
> @@ -129,8 +127,7 @@ void __init efi_init(void)
>
> set_bit(EFI_CONFIG_TABLES, &efi.flags);
>
> - if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
> - init_primary_display();
> + init_primary_display();
>
> if (boot_memmap == EFI_INVALID_TABLE_ADDR)
> return;
> diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
> index e557ebd46c2b..4d1d7978553a 100644
> --- a/arch/loongarch/kernel/image-vars.h
> +++ b/arch/loongarch/kernel/image-vars.h
> @@ -11,9 +11,7 @@ __efistub_strcmp = strcmp;
> __efistub_kernel_entry = kernel_entry;
> __efistub_kernel_asize = kernel_asize;
> __efistub_kernel_fsize = kernel_fsize;
> -#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
> __efistub_sysfb_primary_display = sysfb_primary_display;
> -#endif
>
> #endif
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment
2026-11-10 8:56 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
@ 2026-11-10 14:46 ` Thomas Zimmermann
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-11-10 14:46 UTC (permalink / raw)
To: wuqianhai, chenhuacai, kernel, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel
Hi
Am 10.11.26 um 09:56 schrieb wuqianhai@loongson.cn:
> From: wuqianhai <wuqianhai@loongson.cn>
>
> PCI resource assignment runs from acpi_init() at subsys_initcall time.
> The firmware framebuffer BAR can be relocated, leaving screen_info's
> lfb_base stale. vga_arb_device_init() runs later at subsys_initcall_sync
> time and reads screen_info to identify the firmware default VGA device.
>
> Update screen_info through the generic screen_info_apply_fixups() helper
> right after the root bus resources have been assigned, so both the VGA
> arbiter and sysfb_init() observe the final framebuffer address.
I don't know much about the internals of the PCI subsystem. But I would
assume that there's a common function that sets up PCI resources on all
architectures. And this is the place where we'd want to call
screen_info_apply_fixups().
Best regards
Thomas
>
> Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
> ---
> arch/loongarch/pci/acpi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/loongarch/pci/acpi.c b/arch/loongarch/pci/acpi.c
> index ccbcea61fcd9..cb313ff67f7e 100644
> --- a/arch/loongarch/pci/acpi.c
> +++ b/arch/loongarch/pci/acpi.c
> @@ -9,6 +9,7 @@
> #include <linux/slab.h>
> #include <linux/pci-acpi.h>
> #include <linux/pci-ecam.h>
> +#include <linux/screen_info.h>
>
> #include <asm/pci.h>
> #include <asm/numa.h>
> @@ -256,6 +257,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
> */
> pci_assign_unassigned_root_bus_resources(bus);
>
> + if (IS_ENABLED(CONFIG_SCREEN_INFO))
> + screen_info_apply_fixups();
> +
> list_for_each_entry(child, &bus->children, node)
> pcie_bus_configure_settings(child);
> }
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users
2026-11-10 8:56 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
2026-11-10 14:34 ` Thomas Zimmermann
2026-11-10 14:39 ` Thomas Zimmermann
@ 2026-11-10 16:25 ` Thomas Zimmermann
2 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2026-11-10 16:25 UTC (permalink / raw)
To: wuqianhai, chenhuacai, kernel, deller, bhelgaas
Cc: ardb, ilias.apalodimas, javierm, loongarch, linux-pci, linux-efi,
dri-devel, linux-fbdev, linux-kernel
Hi
Am 10.11.26 um 09:56 schrieb wuqianhai@loongson.cn:
> From: wuqianhai <wuqianhai@loongson.cn>
>
> LoongArch defines and initializes sysfb_primary_display only when
> CONFIG_SYSFB or CONFIG_EFI_EARLYCON is enabled. The PCI VGA arbiter and
> the framebuffer console need the firmware framebuffer information through
> screen_info whenever CONFIG_SCREEN_INFO is enabled, even if neither of
> those options is set.
>
> Drop the guards so sysfb_primary_display is always defined and
> initialized, and its EFI stub alias is always provided, mirroring x86.
> This avoids selecting SYSFB just to obtain the symbol.
The idea is that you select SYSFB is you're interested in that
information. I guess we could make sysfb_primary_display available if
CONFIG_VGA_ARB=y.
Best regards
Thomas
>
> Signed-off-by: wuqianhai <wuqianhai@loongson.cn>
> ---
> arch/loongarch/kernel/efi.c | 5 +----
> arch/loongarch/kernel/image-vars.h | 2 --
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
> index 69dd83f8082f..e491a82b2e0d 100644
> --- a/arch/loongarch/kernel/efi.c
> +++ b/arch/loongarch/kernel/efi.c
> @@ -74,10 +74,8 @@ bool efi_poweroff_required(void)
>
> unsigned long __initdata primary_display_table = EFI_INVALID_TABLE_ADDR;
>
> -#if defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)
> struct sysfb_display_info sysfb_primary_display __section(".data");
> EXPORT_SYMBOL_GPL(sysfb_primary_display);
> -#endif
>
> static void __init init_primary_display(void)
> {
> @@ -129,8 +127,7 @@ void __init efi_init(void)
>
> set_bit(EFI_CONFIG_TABLES, &efi.flags);
>
> - if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
> - init_primary_display();
> + init_primary_display();
>
> if (boot_memmap == EFI_INVALID_TABLE_ADDR)
> return;
> diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
> index e557ebd46c2b..4d1d7978553a 100644
> --- a/arch/loongarch/kernel/image-vars.h
> +++ b/arch/loongarch/kernel/image-vars.h
> @@ -11,9 +11,7 @@ __efistub_strcmp = strcmp;
> __efistub_kernel_entry = kernel_entry;
> __efistub_kernel_asize = kernel_asize;
> __efistub_kernel_fsize = kernel_fsize;
> -#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
> __efistub_sysfb_primary_display = sysfb_primary_display;
> -#endif
>
> #endif
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-11-10 16:25 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261029033440.973077-1-wuqianhai@loongson.cn>
2026-11-10 8:56 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
2026-11-10 8:56 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
2026-11-10 14:34 ` Thomas Zimmermann
2026-11-10 14:39 ` Thomas Zimmermann
2026-11-10 16:25 ` Thomas Zimmermann
2026-11-10 8:56 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
2026-11-10 14:46 ` Thomas Zimmermann
2026-11-10 8:56 ` [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override wuqianhai
2026-11-10 9:01 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device wuqianhai
2026-11-10 9:01 ` [PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users wuqianhai
2026-11-10 9:01 ` [PATCH v3 2/6] LoongArch/PCI: Refresh screen_info after resource assignment wuqianhai
2026-11-10 9:52 ` sashiko-bot
2026-11-10 9:02 ` [PATCH v3 3/6] LoongArch/PCI: Remove vga default device override wuqianhai
2026-11-10 9:24 ` [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection wuqianhai
2026-11-10 9:58 ` sashiko-bot
2026-11-10 9:24 ` [PATCH v3 5/6] efi/libstub: Enable direct sysfb_primary_display access on LoongArch wuqianhai
2026-11-10 9:24 ` [PATCH v3 6/6] PCI/VGA: Enable firmware default device detection " wuqianhai
2026-11-10 9:49 ` sashiko-bot
2026-11-10 10:00 ` [PATCH v3 0/6] LoongArch: Identify the firmware/boot display device Huacai Chen
2026-11-10 8:57 [PATCH v3 4/6] LoongArch: video: Implement primary framebuffer device detection wuqianhai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox