From: Thomas Zimmermann <tzimmermann@suse.de>
To: ardb@kernel.org, javierm@redhat.com, arnd@arndb.de, richard.lyu@suse.com
Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
loongarch@lists.linux.dev, linux-riscv@lists.infradead.org,
dri-devel@lists.freedesktop.org, linux-hyperv@vger.kernel.org,
linux-pci@vger.kernel.org, linux-fbdev@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 07/10] efi: Refactor init_primary_display() helpers
Date: Mon, 24 Nov 2025 17:40:19 +0100 [thread overview]
Message-ID: <20251124165116.502813-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20251124165116.502813-1-tzimmermann@suse.de>
Rework the kernel's init_primary_display() helpers to allow for later
support of additional config-table entries and EDID information. No
functional changes.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
arch/loongarch/kernel/efi.c | 22 +++++++++++-----------
drivers/firmware/efi/efi-init.c | 19 ++++++++++---------
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 638a392d2cd2..1ef38036e8ae 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -81,19 +81,19 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);
static void __init init_primary_display(void)
{
- struct screen_info *si;
-
- if (screen_info_table == EFI_INVALID_TABLE_ADDR)
- return;
-
- si = early_memremap(screen_info_table, sizeof(*si));
- if (!si) {
- pr_err("Could not map screen_info config table\n");
+ if (screen_info_table == EFI_INVALID_TABLE_ADDR) {
+ struct screen_info *si = early_memremap(screen_info_table, sizeof(*si));
+
+ if (!si) {
+ pr_err("Could not map screen_info config table\n");
+ return;
+ }
+ sysfb_primary_display.screen = *si;
+ memset(si, 0, sizeof(*si));
+ early_memunmap(si, sizeof(*si));
+ } else {
return;
}
- sysfb_primary_display.screen = *si;
- memset(si, 0, sizeof(*si));
- early_memunmap(si, sizeof(*si));
memblock_reserve(__screen_info_lfb_base(&sysfb_primary_display.screen),
sysfb_primary_display.screen.lfb_size);
diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
index d1d418a34407..ca697d485116 100644
--- a/drivers/firmware/efi/efi-init.c
+++ b/drivers/firmware/efi/efi-init.c
@@ -67,10 +67,9 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);
static void __init init_primary_display(void)
{
- struct screen_info *si;
-
if (screen_info_table != EFI_INVALID_TABLE_ADDR) {
- si = early_memremap(screen_info_table, sizeof(*si));
+ struct screen_info *si = early_memremap(screen_info_table, sizeof(*si));
+
if (!si) {
pr_err("Could not map screen_info config table\n");
return;
@@ -78,14 +77,16 @@ static void __init init_primary_display(void)
sysfb_primary_display.screen = *si;
memset(si, 0, sizeof(*si));
early_memunmap(si, sizeof(*si));
+ } else {
+ return;
+ }
- if (memblock_is_map_memory(sysfb_primary_display.screen.lfb_base))
- memblock_mark_nomap(sysfb_primary_display.screen.lfb_base,
- sysfb_primary_display.screen.lfb_size);
+ if (memblock_is_map_memory(sysfb_primary_display.screen.lfb_base))
+ memblock_mark_nomap(sysfb_primary_display.screen.lfb_base,
+ sysfb_primary_display.screen.lfb_size);
- if (IS_ENABLED(CONFIG_EFI_EARLYCON))
- efi_earlycon_reprobe();
- }
+ if (IS_ENABLED(CONFIG_EFI_EARLYCON))
+ efi_earlycon_reprobe();
}
static int __init uefi_init(u64 efi_system_table)
--
2.51.1
next prev parent reply other threads:[~2025-11-24 16:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 16:40 [PATCH v2 00/10] arch,sysfb,efi: Support EDID on non-x86 EFI systems Thomas Zimmermann
2025-11-24 16:40 ` [PATCH v2 01/10] efi: earlycon: Reduce number of references to global screen_info Thomas Zimmermann
2025-11-24 16:40 ` [PATCH v2 02/10] efi: sysfb_efi: " Thomas Zimmermann
2025-11-24 16:40 ` [PATCH v2 03/10] sysfb: Add struct sysfb_display_info Thomas Zimmermann
2025-11-24 16:40 ` [PATCH v2 04/10] sysfb: Replace screen_info with sysfb_primary_display Thomas Zimmermann
2025-11-24 23:56 ` Bjorn Helgaas
2025-11-24 16:40 ` [PATCH v2 05/10] sysfb: Pass sysfb_primary_display to devices Thomas Zimmermann
2025-11-24 16:40 ` [PATCH v2 06/10] sysfb: Move edid_info into sysfb_primary_display Thomas Zimmermann
2025-11-24 16:40 ` Thomas Zimmermann [this message]
2025-11-24 16:40 ` [PATCH v2 08/10] efi: Support EDID information Thomas Zimmermann
2025-11-24 17:01 ` Ard Biesheuvel
2025-11-24 17:04 ` Ard Biesheuvel
2025-11-25 7:19 ` Thomas Zimmermann
2025-11-24 16:40 ` [PATCH v2 09/10] efi: libstub: Transfer EDID to kernel Thomas Zimmermann
2025-11-24 16:40 ` [PATCH v2 10/10] efi: libstub: Simplify interfaces for primary_display Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251124165116.502813-8-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
--cc=richard.lyu@suse.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox