[PATCH v3 1/6] LoongArch: efi: Provide sysfb_primary_display for screen_info users

From: wuqianhai

Date: Tue Nov 10 2026 - 04:00:56 EST


From: wuqianhai <wuqianhai@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---
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