From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 4A034298CDE for ; Mon, 24 Nov 2025 09:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763976540; cv=none; b=lqn2b6LB8z610MSGe9ksbN96htSJfaPhPdIaIm0W8SvLL8gnhas4fs0JI4UYhWQh6zmNSsMG+BLb3zwo1z066sUTR2FjO6wKqoa75XFrzkdhjCNDC+Yu0Bgu/Do483J0tLH/AYXVk1la0uBL6LyLJs2rqhlWJW8UcM/OB2WO1F4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763976540; c=relaxed/simple; bh=PUxuEYfHaMXKyRQa8nksQ38OVmVCrv/2GMdnL6jPYFU=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ihmVK7vXud3//jOwNFO3LQrSV6oAm4OOEg5OercgpQ4a/HqvRIBRzoXooQT+JWC2FWJpNkRAjt+GC5pAQ6GZRM2DvZ7evQz8Ev2IA0CNgiy5fGrsfCsgo3XYR8HCMsAp+7sFHEBAc7KtqIA4FYuuDfQjoSbgNBfVMkriODIgq8g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=NghiHQ1X; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="NghiHQ1X" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-477a1c28778so44835525e9.3 for ; Mon, 24 Nov 2025 01:28:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1763976536; x=1764581336; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:date:from:from:to:cc:subject:date :message-id:reply-to; bh=qSUd6Iu5swY1yI3rOZ1kFsJAdObQXxI7F4AS/dEiKfI=; b=NghiHQ1XnuVAxJDYO9j5gFue3oxXZobpMnaAc0O0j+bvafBSaYiBWYoA8JSBTz/Fe7 ru1UeThmjk0uBr0A8Cv47ChE1AcEqOdOafnSq7D8rLKnbXcEahyM8/Rib+sLwp9XB06n beePpTwd/p6pNhHiDDAShLzH6NjAisRkRKqQU7K8qjgRuqMYoCKnYsGyRm0x+AdvRSOu 07JPh0E246JgrOqgkevqiOgE3wiQ8cevZCECmMZeVV+MNzWeZbXACSvm7LZXn6M4n90E vO0xdNpo/J2aFrwTJc0YwnKXiNfEbHTEuUC5Z6K/OUuykMKdW5VkCYcxmTBVl1w3ztNF XSTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763976536; x=1764581336; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:date:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qSUd6Iu5swY1yI3rOZ1kFsJAdObQXxI7F4AS/dEiKfI=; b=cnLq+FMhJOXZkREO11EKiZz/bhpppCjDlE2VN6J7ccE6sjOe9nSJ4zFNgUKOfTVb2C JH/Ft8XRJVEsNGdZ7+RU6ggHU9up/6skJ1Vk6XyhWzxsYF+az7guf+i0/UYztuzP7+Rh X8EJRmIH25oSqNogNEARbFJxSHveG4WnwM94kBVy+nmnwWwXQOQRtmAkWYpq4aZ+yjsF NtXMLerzYZlyyyGszndTskshKsfDs3oc8uWTXzZkpiv9ucC5gAutV1fY0oGyvOfd0Bsk B3wNJy5xt/C7JJei42v5BD5Drklz4Qcvp2vPfokRB2PXIlG/v4Gdz1U0NIFlnzLiz6vh bM6w== X-Forwarded-Encrypted: i=1; AJvYcCUixb6zrwRO1NwTa16QgUJ33L3usKYk5Sy1PFUGLCs7QPfG5ogr+df8azveMHzd4E2AwE0ew0hZisVVq2A=@vger.kernel.org X-Gm-Message-State: AOJu0Yym2/UkcI6S9pKXKSRU/hCVYmdcE22cIkV96TUU/d0B1YUBLL54 Ural7LnmeBR2UVlWr+Tje6U/Naxf37/D5oLyUDU8GSX7J8+PySC6Ud7D4i2F+ZexkhE= X-Gm-Gg: ASbGncsLGZYO2Myb1prQsues0Jn48ZnaykTgGsxAGlXz1SkGXfq++0KXybS4fsARdlP eujJ2dmTv6NMEG5ljluPe6X9YSdoWUncK0ObNlkdEOG6xeC9pPEhcPqowWFJ/qdfrc7EGgkecQ6 BdFqKvU/rLUB8qBE4mdifaMdmvSTy70Fi0RChNyWoy/9f1UgyfIs842xRv+GzfB9wByGMEVzxXq P828H8gpow4HzfyGO0OE4rZRc5y0tm5GDD1pVou3R7dKpWoQaV6KTfIgzXCzc3SiTGuoYoWRVlR i/PyVSbdFMq3bocqJuLaYiXBwpsflx1FZlLuU2tTBESYEjitSJRFqkpCZf1FMwAoA9PdUsGpn6Z oPYai0QSQzD5nyRIufMh/gKVGEXTIVbmjkEbsS0mm7igZpKPZz5hGP1Q/2uA72YIKp9DwFLfEiL UQNp+653zS+4hU9CVNm6X6NtKUOS4H0TDBgaVBx5u5 X-Google-Smtp-Source: AGHT+IGqX87Liusvu8VA+P6vAK2NQvQqKGFS75x4fPSdpk7QAnEFO6Q86alRxbuZVhECcom6UWrp6g== X-Received: by 2002:a05:600c:1c0c:b0:46e:7e22:ff6a with SMTP id 5b1f17b1804b1-477c018a099mr145588045e9.15.1763976536416; Mon, 24 Nov 2025 01:28:56 -0800 (PST) Received: from r1chard (220-129-146-231.dynamic-ip.hinet.net. [220.129.146.231]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-345b03c7515sm9757191a91.5.2025.11.24.01.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Nov 2025 01:28:56 -0800 (PST) From: Richard Lyu X-Google-Original-From: Richard Lyu Date: Mon, 24 Nov 2025 17:28:49 +0800 To: Thomas Zimmermann , ardb@kernel.org, javierm@redhat.com, arnd@arndb.de 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 Subject: Re: [PATCH 1/6] efi: earlycon: Reduce number of references to global screen_info Message-ID: References: <20251121135624.494768-1-tzimmermann@suse.de> <20251121135624.494768-2-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251121135624.494768-2-tzimmermann@suse.de> User-Agent: Mutt/2.2.13 (2024-03-09) Reviewed-by: Richard Lyu On 2025/11/21 14:36, Thomas Zimmermann wrote: > Replace usage of global screen_info with local pointers. This will > later reduce churn when screen_info is being moved. > > Signed-off-by: Thomas Zimmermann > --- > 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/earlycon.c > index d18a1a5de144..fac3a295c57f 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 = &screen_info; > + > /* bail if there is no bootconsole or it was unregistered already */ > if (!earlycon_console || !console_is_registered(earlycon_console)) > return 0; > > - efi_fb = memremap(fb_base, screen_info.lfb_size, > - fb_wb ? MEMREMAP_WB : MEMREMAP_WC); > + efi_fb = memremap(fb_base, si->lfb_size, fb_wb ? MEMREMAP_WB : MEMREMAP_WC); > > return efi_fb ? 0 : -ENOMEM; > } > @@ -71,12 +72,12 @@ static __ref void efi_earlycon_unmap(void *addr, unsigned long len) > early_memunmap(addr, len); > } > > -static void efi_earlycon_clear_scanline(unsigned int y) > +static void efi_earlycon_clear_scanline(unsigned int y, const struct screen_info *si) > { > unsigned long *dst; > u16 len; > > - len = screen_info.lfb_linelength; > + len = si->lfb_linelength; > dst = 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); > } > > -static void efi_earlycon_scroll_up(void) > +static void efi_earlycon_scroll_up(const struct screen_info *si) > { > unsigned long *dst, *src; > u16 maxlen = 0; > @@ -99,8 +100,8 @@ static void efi_earlycon_scroll_up(void) > } > maxlen *= 4; > > - len = screen_info.lfb_linelength; > - height = screen_info.lfb_height; > + len = si->lfb_linelength; > + height = si->lfb_height; > > for (i = 0; i < height - font->height; i++) { > dst = efi_earlycon_map(i*len, len); > @@ -120,7 +121,8 @@ static void efi_earlycon_scroll_up(void) > } > } > > -static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h) > +static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h, > + const struct screen_info *si) > { > const u32 color_black = 0x00000000; > const u32 color_white = 0x00ffffff; > @@ -145,13 +147,12 @@ static void efi_earlycon_write_char(u32 *dst, unsigned 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 = &screen_info; > u32 cur_efi_x = efi_x; > unsigned int len; > const char *s; > void *dst; > > - si = &screen_info; > len = si->lfb_linelength; > > while (num) { > @@ -174,7 +175,7 @@ efi_earlycon_write(struct console *con, const char *str, unsigned int num) > x = efi_x; > > while (n-- > 0) { > - efi_earlycon_write_char(dst + x*4, *s, h); > + efi_earlycon_write_char(dst + x*4, *s, h, si); > x += font->width; > s++; > } > @@ -207,10 +208,10 @@ efi_earlycon_write(struct console *con, const char *str, unsigned int num) > cur_line_y = (cur_line_y + 1) % max_line_y; > > efi_y -= font->height; > - efi_earlycon_scroll_up(); > + efi_earlycon_scroll_up(si); > > for (i = 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 = &screen_info; > u16 xres, yres; > u32 i; > > fb_wb = opt && !strcmp(opt, "ram"); > > - if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) { > + if (si->orig_video_isVGA != VIDEO_TYPE_EFI) { > fb_probed = true; > return -ENODEV; > } > > - fb_base = screen_info.lfb_base; > - if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) > - fb_base |= (u64)screen_info.ext_lfb_base << 32; > + fb_base = si->lfb_base; > + if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) > + fb_base |= (u64)si->ext_lfb_base << 32; > > - si = &screen_info; > xres = si->lfb_width; > yres = si->lfb_height; > > @@ -266,7 +266,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device, > > efi_y -= font->height; > for (i = 0; i < (yres - efi_y) / font->height; i++) > - efi_earlycon_scroll_up(); > + efi_earlycon_scroll_up(si); > > device->con->write = efi_earlycon_write; > earlycon_console = device->con; > -- > 2.51.1 > >