From nobody Mon Dec 1 23:06:22 2025 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 A09B933DECA for ; Wed, 26 Nov 2025 16:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764173352; cv=none; b=LdFPUBpYXauUrDkSNBH96fVGQ/cXrKpgl2i0FCIWX6kCwdBIhq4k9NPP/sN7czOMMQQi0qJSM4xOZdyt2P7DOV+k6NArM8Nz2JxszNO21zqL/ynbXGsSgA/dZ08xEqB1YKaCGTUPQW03HVeem1IyI7dYtibyEQSxZMMpp+fjVLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764173352; c=relaxed/simple; bh=L1aPOhyq8DGxlHXlPMvUQew9wYYpOFCTBbsUMdEBg7w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VMan9gRLR843AzXe9PHVt78iaYfSGCFEgfxAMScMUS5ENRQVZstu6m/26pkwcnaGg5lj9tcRb16qQYBiN67mg16TJhUSBAe7ra12sMVI0JNFhj1CKffxib6Yg25NkYcUYd/6jrBAf/9iQrmt2hkR/u8UtZW1HZcrpwogwFnAOyM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=HNlHLdT4; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=BtXYUld8; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=EyCENnQs; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=x1rd6/pA; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="HNlHLdT4"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="BtXYUld8"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="EyCENnQs"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="x1rd6/pA" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EB0005BE8D; Wed, 26 Nov 2025 16:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1764173340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=63HXk2asPcR6HKGFSmIOTJlWneEzg1F4AZ9qPy2VUyc=; b=HNlHLdT4+ftHDfSGcOLmy/wgSh5PB0cIxN3PxYieoVKiFvyEg8LqW4ET/7i469pmj8Lj8r FFYRB2BMSM5Cjq6CIf+WPNeq6UfL04Jz+h3N19417jz3JnfrAY52w+MeBLNLemJLqAjoTl pID0na9X6myqM8n7YH+zioeY7M/kMQ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1764173340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=63HXk2asPcR6HKGFSmIOTJlWneEzg1F4AZ9qPy2VUyc=; b=BtXYUld8tzzkYVjOlVGH33TFv6Kfv0PQxIUS+XyuDDZpunpaFqz3IKfrOFfn5OCn5VAeEF OOtQyrTU0ueFv8Dg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EyCENnQs; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="x1rd6/pA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1764173339; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=63HXk2asPcR6HKGFSmIOTJlWneEzg1F4AZ9qPy2VUyc=; b=EyCENnQsl8ql14ma1fvIBorWD44yIEHI8lT/qCunnUIaRK1Ao+djFjva9osjmJ1wh7q49T 46MPz3orf+H4x0zBFul1vfD9JsUmomlTSyzC/+g+duBwOe0GRJaZFyKigWcDkFEhhFI+MS MEdpWIq3AQR5UNvOlmCX8bmiicagCc8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1764173339; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=63HXk2asPcR6HKGFSmIOTJlWneEzg1F4AZ9qPy2VUyc=; b=x1rd6/pAixjpIpLzme3cxM2k/UuYVXhrQrtn+ltzf+fRuYOB2bhlwpUamTWylLS2vhJrV5 o3i4EkgeCsw7HDBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7CDC83EA65; Wed, 26 Nov 2025 16:08:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SHoMHRsmJ2lnIgAAD6G6ig (envelope-from ); Wed, 26 Nov 2025 16:08:59 +0000 From: Thomas Zimmermann To: ardb@kernel.org, javierm@redhat.com, arnd@arndb.de, richard.lyu@suse.com, helgaas@kernel.org 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 Subject: [PATCH v3 1/9] efi: earlycon: Reduce number of references to global screen_info Date: Wed, 26 Nov 2025 17:03:18 +0100 Message-ID: <20251126160854.553077-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251126160854.553077-1-tzimmermann@suse.de> References: <20251126160854.553077-1-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[16]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLtfyjk8sg4x43ngtem9djprcp)]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.com:email] X-Spam-Level: X-Spam-Score: -3.01 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: EB0005BE8D X-Rspamd-Action: no action X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" Replace usage of global screen_info with local pointers. This will later reduce churn when screen_info is being moved. v2: - fix coding style Signed-off-by: Thomas Zimmermann Reviewed-by: Richard Lyu Acked-by: Arnd Bergmann Acked-by: Ard Biesheuvel --- drivers/firmware/efi/earlycon.c | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlyco= n.c index d18a1a5de144..42e3a173dac1 100644 --- a/drivers/firmware/efi/earlycon.c +++ b/drivers/firmware/efi/earlycon.c @@ -32,12 +32,13 @@ static void *efi_fb; */ static int __init efi_earlycon_remap_fb(void) { + const struct screen_info *si =3D &screen_info; + /* bail if there is no bootconsole or it was unregistered already */ if (!earlycon_console || !console_is_registered(earlycon_console)) return 0; =20 - efi_fb =3D memremap(fb_base, screen_info.lfb_size, - fb_wb ? MEMREMAP_WB : MEMREMAP_WC); + efi_fb =3D memremap(fb_base, si->lfb_size, fb_wb ? MEMREMAP_WB : MEMREMAP= _WC); =20 return efi_fb ? 0 : -ENOMEM; } @@ -71,12 +72,12 @@ static __ref void efi_earlycon_unmap(void *addr, unsign= ed long len) early_memunmap(addr, len); } =20 -static void efi_earlycon_clear_scanline(unsigned int y) +static void efi_earlycon_clear_scanline(unsigned int y, const struct scree= n_info *si) { unsigned long *dst; u16 len; =20 - len =3D screen_info.lfb_linelength; + len =3D si->lfb_linelength; dst =3D efi_earlycon_map(y*len, len); if (!dst) return; @@ -85,7 +86,7 @@ static void efi_earlycon_clear_scanline(unsigned int y) efi_earlycon_unmap(dst, len); } =20 -static void efi_earlycon_scroll_up(void) +static void efi_earlycon_scroll_up(const struct screen_info *si) { unsigned long *dst, *src; u16 maxlen =3D 0; @@ -99,8 +100,8 @@ static void efi_earlycon_scroll_up(void) } maxlen *=3D 4; =20 - len =3D screen_info.lfb_linelength; - height =3D screen_info.lfb_height; + len =3D si->lfb_linelength; + height =3D si->lfb_height; =20 for (i =3D 0; i < height - font->height; i++) { dst =3D efi_earlycon_map(i*len, len); @@ -120,7 +121,8 @@ static void efi_earlycon_scroll_up(void) } } =20 -static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned in= t h) +static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned in= t h, + const struct screen_info *si) { const u32 color_black =3D 0x00000000; const u32 color_white =3D 0x00ffffff; @@ -145,13 +147,12 @@ static void efi_earlycon_write_char(u32 *dst, unsigne= d char c, unsigned int h) static void efi_earlycon_write(struct console *con, const char *str, unsigned int num) { - struct screen_info *si; + const struct screen_info *si =3D &screen_info; u32 cur_efi_x =3D efi_x; unsigned int len; const char *s; void *dst; =20 - si =3D &screen_info; len =3D si->lfb_linelength; =20 while (num) { @@ -174,7 +175,7 @@ efi_earlycon_write(struct console *con, const char *str= , unsigned int num) x =3D efi_x; =20 while (n-- > 0) { - efi_earlycon_write_char(dst + x*4, *s, h); + efi_earlycon_write_char(dst + x * 4, *s, h, si); x +=3D font->width; s++; } @@ -207,10 +208,10 @@ efi_earlycon_write(struct console *con, const char *s= tr, unsigned int num) cur_line_y =3D (cur_line_y + 1) % max_line_y; =20 efi_y -=3D font->height; - efi_earlycon_scroll_up(); + efi_earlycon_scroll_up(si); =20 for (i =3D 0; i < font->height; i++) - efi_earlycon_clear_scanline(efi_y + i); + efi_earlycon_clear_scanline(efi_y + i, si); } } } @@ -226,22 +227,21 @@ void __init efi_earlycon_reprobe(void) static int __init efi_earlycon_setup(struct earlycon_device *device, const char *opt) { - struct screen_info *si; + const struct screen_info *si =3D &screen_info; u16 xres, yres; u32 i; =20 fb_wb =3D opt && !strcmp(opt, "ram"); =20 - if (screen_info.orig_video_isVGA !=3D VIDEO_TYPE_EFI) { + if (si->orig_video_isVGA !=3D VIDEO_TYPE_EFI) { fb_probed =3D true; return -ENODEV; } =20 - fb_base =3D screen_info.lfb_base; - if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) - fb_base |=3D (u64)screen_info.ext_lfb_base << 32; + fb_base =3D si->lfb_base; + if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) + fb_base |=3D (u64)si->ext_lfb_base << 32; =20 - si =3D &screen_info; xres =3D si->lfb_width; yres =3D si->lfb_height; =20 @@ -266,7 +266,7 @@ static int __init efi_earlycon_setup(struct earlycon_de= vice *device, =20 efi_y -=3D font->height; for (i =3D 0; i < (yres - efi_y) / font->height; i++) - efi_earlycon_scroll_up(); + efi_earlycon_scroll_up(si); =20 device->con->write =3D efi_earlycon_write; earlycon_console =3D device->con; --=20 2.51.1