From nobody Tue Dec 2 02:18:59 2025 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0339D31196D for ; Wed, 19 Nov 2025 12:30:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763555426; cv=none; b=OTGO6kHJpVpeWkMtT8vjZ0vRf+yOFrvD9iyWhF1FfKimEmz3HcXE8HtbBU9Z982XBibNA4z7O/vlLfjWy+3ZPj07lFxJnAnToIX12C1ru3asxmlgGTFbn+/LhWp77yd6bHbqE8nqa0t8hK6Qg8bcZphY7qUDmYN71+ozqXUBEs8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763555426; c=relaxed/simple; bh=TA/i17Wc7R978mqCKogUp9xiyjvcSBcL5TkdOt9LVgk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=su8qmHvLgneOQPpZxK5vZsaDPnPc6ifMCBwhz5TswuSihaYs0O6nATzhXlGPLhhdZnYzW/V+c2U0DHR5BlEkzJczo1854qzgrkbyAA5KGtPgWUSaC988d5WaOftl2vWCW7JyyNftkjWE6RuVaDOf+N43BvVwoIEShuWMI0h9J7M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Nnw1+J6X; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Nnw1+J6X" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-477a0ddd1d4so27384965e9.0 for ; Wed, 19 Nov 2025 04:30:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763555421; x=1764160221; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=oBcg4cW+Fyl+51clDdaiGPMj2fI7AHh6peqeu95tb9Y=; b=Nnw1+J6XnIyFiED5quCFF0lp1BHOsY/cQ3XQb+atdz3PjfxtRCNmg83OVDkKqQMQ0f rqbliSs6giJ8ITA0AsuoPEyRMlfqezjA0RGft56vOQaaWE16j1loRhJILh2OwUlgukFm ZIjW5Gkd7H5Z8OVXrSmJVGJjmHcAe7fDPSsIr67wlJJvV9sbpgKADlg7vVeg4AMjzl0z KGGVSzE3IUl1qHP0ikry4Ysriv5VJ6g4e0r0BSA0dUr6aEZ3O5VlWfOKOdBBL4PHb6Ts YGLeAlBkgSeMKYPsauxCymMHmFpCU7LNQxi5AeohF0GC3V+KiE5pjgGcWF/NEfpRR4jW X1UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763555421; x=1764160221; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oBcg4cW+Fyl+51clDdaiGPMj2fI7AHh6peqeu95tb9Y=; b=DN7HthzGSehex9kDrq/ARts2MsqHBpB4zL580MEL6QJ7JyH3nymDy1+tg4iKM4Muat 5FKFrTMqbWak4WbjKSEEo91CId9qBHFKbti4ig1KnR7z5zMvGGQ0xHhEphwCK9uDmLB7 womKqC1VtPKP7BXoLQA9MfmImxgAVTX33/HdwKthZS//KkxpIPHEHeuORx6hw4S6Th16 Y7qikzMI7zoG6O4H1bxXKxg/SfydiPFZF1vVhFQm8P6PFYikSONpWJGfpBVevv1rnGbP ZGqwPNX829SrSzs4Pzoj8apHN0XYI2uoaSOHCmbsUAIiLQhc0d19iCP1pSJ1Eu/zhgaG gt8w== X-Gm-Message-State: AOJu0YyLinDJJWwWdCci45Rn8PtpDEX4uxHY2kbWkBxWceEiTywmbIsL fu5eZJNMNNhmxIaIRYrmB+xT0m3KJzYRpswKVYi/Smbjw5ca2JJecSpUW+pDEKu+vyeCUWK88Q= = X-Google-Smtp-Source: AGHT+IHIU5JM8aPAQkX43sPIm9FRIUcbtqqW7DYxT0FNPjjFH/q4e5q2X7SHQsQXEYDHfbvhiLNYFSZb X-Received: from wmmr12.prod.google.com ([2002:a05:600c:424c:b0:477:9c96:9fb9]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c4a2:b0:477:c37:2ea7 with SMTP id 5b1f17b1804b1-4778fe9ac28mr182388985e9.21.1763555421191; Wed, 19 Nov 2025 04:30:21 -0800 (PST) Date: Wed, 19 Nov 2025 13:30:13 +0100 In-Reply-To: <20251119123011.1187249-5-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251119123011.1187249-5-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=8249; i=ardb@kernel.org; h=from:subject; bh=f7i7AmKvznI5qoe+nE17mQh0HeBGMvSPz57uv3lycqw=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIVN2R5j8Y8tOjcu87I8yVm7eaTJh11Tdsvybjpnxq1YHW UbExx3uKGVhEONikBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABO5OYXhN8uEZSmvRfcqOpys n9J1deMFR8tXbUIHL78W+ZLQub7n1A+G/xlLmXxergvd68w4Z6GWgLPzvY4lM1+4//GerP130qO XOjwA X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251119123011.1187249-6-ardb+git@google.com> Subject: [PATCH 1/3] efi: Wrap screen_info in efi_screen_info so edid_info can be added later From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Thomas Zimmermann , Javier Martinez Canillas Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Prepare for adding support to the EFI stub to pass edid_info discovered using EFI boot services to the kernel proper via a EFI configuration table. Instead of passing struct screen_info directly, define a new struct efi_screen_info that encapsulates it. struct edid_info will be added there later. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/earlycon.c | 1 - drivers/firmware/efi/efi-init.c | 11 ++++++----- drivers/firmware/efi/libstub/efi-stub-entry.c | 3 +-- drivers/firmware/efi/libstub/efi-stub.c | 9 ++++----- drivers/firmware/efi/libstub/efistub.h | 6 +++--- drivers/firmware/efi/libstub/gop.c | 1 - drivers/firmware/efi/libstub/screen_info.c | 7 +++---- drivers/firmware/efi/libstub/zboot.c | 2 +- drivers/firmware/efi/sysfb_efi.c | 1 - include/linux/efi.h | 6 +++++- 10 files changed, 23 insertions(+), 24 deletions(-) diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlyco= n.c index d18a1a5de144..23fb23867b56 100644 --- a/drivers/firmware/efi/earlycon.c +++ b/drivers/firmware/efi/earlycon.c @@ -9,7 +9,6 @@ #include #include #include -#include #include =20 #include diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-ini= t.c index a65c2d5b9e7b..5896f4e699a1 100644 --- a/drivers/firmware/efi/efi-init.c +++ b/drivers/firmware/efi/efi-init.c @@ -19,7 +19,6 @@ #include #include #include -#include =20 #include =20 @@ -61,13 +60,15 @@ extern __weak const efi_config_table_type_t efi_arch_ta= bles[]; * everything else can get it from here. */ #if !defined(CONFIG_X86) && (defined(CONFIG_SYSFB) || defined(CONFIG_EFI_E= ARLYCON)) -struct screen_info screen_info __section(".data"); +struct efi_screen_info efi_screen_info __section(".data"); + +extern struct screen_info screen_info __alias(efi_screen_info); EXPORT_SYMBOL_GPL(screen_info); #endif =20 static void __init init_screen_info(void) { - struct screen_info *si; + struct efi_screen_info *si; =20 if (screen_info_table !=3D EFI_INVALID_TABLE_ADDR) { si =3D early_memremap(screen_info_table, sizeof(*si)); @@ -75,8 +76,8 @@ static void __init init_screen_info(void) pr_err("Could not map screen_info config table\n"); return; } - screen_info =3D *si; - memset(si, 0, sizeof(*si)); + efi_screen_info =3D *si; + si->screen_info =3D (struct screen_info){}; early_memunmap(si, sizeof(*si)); =20 if (memblock_is_map_memory(screen_info.lfb_base)) diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmwa= re/efi/libstub/efi-stub-entry.c index a6c049835190..520f5ea31cfd 100644 --- a/drivers/firmware/efi/libstub/efi-stub-entry.c +++ b/drivers/firmware/efi/libstub/efi-stub-entry.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only =20 #include -#include =20 #include =20 @@ -9,7 +8,7 @@ =20 static unsigned long screen_info_offset; =20 -struct screen_info *alloc_screen_info(void) +struct efi_screen_info *alloc_screen_info(void) { if (IS_ENABLED(CONFIG_ARM)) return __alloc_screen_info(); diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi= /libstub/efi-stub.c index 9cb814c5ba1b..fe77c285a547 100644 --- a/drivers/firmware/efi/libstub/efi-stub.c +++ b/drivers/firmware/efi/libstub/efi-stub.c @@ -10,7 +10,6 @@ */ =20 #include -#include #include =20 #include "efistub.h" @@ -48,13 +47,13 @@ static u64 virtmap_base =3D EFI_RT_VIRTUAL_BASE; static bool flat_va_mapping =3D (EFI_RT_VIRTUAL_OFFSET !=3D 0); =20 -void __weak free_screen_info(struct screen_info *si) +void __weak free_screen_info(struct efi_screen_info *si) { } =20 -static struct screen_info *setup_graphics(void) +static struct efi_screen_info *setup_graphics(void) { - struct screen_info *si, tmp =3D {}; + struct efi_screen_info *si, tmp =3D {}; =20 if (efi_setup_graphics(&tmp, NULL) !=3D EFI_SUCCESS) return NULL; @@ -145,7 +144,7 @@ efi_status_t efi_stub_common(efi_handle_t handle, unsigned long image_addr, char *cmdline_ptr) { - struct screen_info *si; + struct efi_screen_info *si; efi_status_t status; =20 status =3D check_platform_features(); diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/= libstub/efistub.h index b2fb0c3fa721..bdeb28d42a1a 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -1175,9 +1175,9 @@ efi_enable_reset_attack_mitigation(void) { } =20 void efi_retrieve_eventlog(void); =20 -struct screen_info *alloc_screen_info(void); -struct screen_info *__alloc_screen_info(void); -void free_screen_info(struct screen_info *si); +struct efi_screen_info *alloc_screen_info(void); +struct efi_screen_info *__alloc_screen_info(void); +void free_screen_info(struct efi_screen_info *si); =20 void efi_cache_sync_image(unsigned long image_base, unsigned long alloc_size); diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libs= tub/gop.c index 72d74436a7a4..db80f2ad2871 100644 --- a/drivers/firmware/efi/libstub/gop.c +++ b/drivers/firmware/efi/libstub/gop.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/firmware/efi/libstub/screen_info.c b/drivers/firmware/= efi/libstub/screen_info.c index 5d3a1e32d177..189da1efb7b2 100644 --- a/drivers/firmware/efi/libstub/screen_info.c +++ b/drivers/firmware/efi/libstub/screen_info.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 =20 #include -#include =20 #include =20 @@ -21,9 +20,9 @@ =20 static efi_guid_t screen_info_guid =3D LINUX_EFI_SCREEN_INFO_TABLE_GUID; =20 -struct screen_info *__alloc_screen_info(void) +struct efi_screen_info *__alloc_screen_info(void) { - struct screen_info *si; + struct efi_screen_info *si; efi_status_t status; =20 status =3D efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY, @@ -43,7 +42,7 @@ struct screen_info *__alloc_screen_info(void) return NULL; } =20 -void free_screen_info(struct screen_info *si) +void free_screen_info(struct efi_screen_info *si) { if (!si) return; diff --git a/drivers/firmware/efi/libstub/zboot.c b/drivers/firmware/efi/li= bstub/zboot.c index c47ace06f010..86f4814cfd47 100644 --- a/drivers/firmware/efi/libstub/zboot.c +++ b/drivers/firmware/efi/libstub/zboot.c @@ -26,7 +26,7 @@ void __weak efi_cache_sync_image(unsigned long image_base, // executable code loaded into memory to be safe for execution. } =20 -struct screen_info *alloc_screen_info(void) +struct efi_screen_info *alloc_screen_info(void) { return __alloc_screen_info(); } diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_= efi.c index 1e509595ac03..092c19771e17 100644 --- a/drivers/firmware/efi/sysfb_efi.c +++ b/drivers/firmware/efi/sysfb_efi.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include