# \[PATCH v3 5/6\] efi/libstub: Enable direct sysfb\_primary\_display access on LoongArch

- From: wuqianhai@loongson.cn
- Date: 2026-11-10 08:59:31 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2026/11/17904287
- Thread: https://ratatoskr.run/loongarch/2026/11/17904285/t.md

```text
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

```
