From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C767BC433EF for ; Thu, 16 Jun 2022 00:33:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 527DC83E3A; Thu, 16 Jun 2022 02:33:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="K2IGM0JX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D295B83DB8; Thu, 16 Jun 2022 02:32:58 +0200 (CEST) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5AE3383DB8 for ; Thu, 16 Jun 2022 02:32:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x42b.google.com with SMTP id bo5so78069pfb.4 for ; Wed, 15 Jun 2022 17:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=fx9Nku3FhAnW3344HsJk3huHn+qxIQwRm4Ub/W7IFnQ=; b=K2IGM0JXFOXOQXuIMCUYqidpJQapiaiJpvZa8LGNPbky26qRD6CbUtysGuHE5+bq0y 514dPhPendwG/ElrvhJta0kTbldiddFRjSkc3CHrdrrGoMuZa8HnuvDcrDjicRPNXI45 4txibkqHdeRw+LS0JhNEY75QDzK/IWTEFaM4RknfKg0tjvN4vmr4El16aq78GuVVns/3 zTtoJxNFAjZrN/UfXpersvJH61KFKl8D9GHvpVFWeAnWfIEb0Q+tKfzat67mL4qulhCa Wx4TCSQ7ly5D18vV5zarEeqK9OJ5aXsyrtbfOAfmY0qoq0/sb6MzcLcZdTkbvzz6VIh7 2dcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=fx9Nku3FhAnW3344HsJk3huHn+qxIQwRm4Ub/W7IFnQ=; b=HELQeuUZeZ/zzrEG1WrnT6x56q/r8ij9s/jrlcAYLbVJXPjS5s5UUEhSTnzljtHAhC oz5ygDBgZDp9gPwrt3Ah40TmqwMDM17bIS2HhkR2+7+jd+OqmVvUw9DpKOf3rzKxr00H OKNFM0ZC2T+oCIvVrqYYLz2QFpICzKxZLG15rThTB/u+HHQm2l9kwYtoBV3pYidavPuC wie9LuYXDUYEQ6BiGFpXh0Y3sES7cgo9IPz6yY3eZ8YDT4ShcO4SLRr0yEcTtCrQNkQG XjQxVfHyMlK93g/VTXgMqLGgsR7k98Gcr99fyO832IJDrWumqbXe8wXiDDLWeoIyCARq Spdw== X-Gm-Message-State: AJIora9j2opDkFVnq3kWMfiCwES7d46qE0ESJLp4aIBJQjO7uSsGG1CY Y+MJN1z6cjzxisi0a0WK94EeEw== X-Google-Smtp-Source: AGRyM1vLI1RN4gGgqRo4iYIzcELh98iwsQPc/Qwc0DNBMM9p5Ar0v3DoUMgQDYGSidRYibTKmXWs+g== X-Received: by 2002:a63:7c51:0:b0:408:c3db:e248 with SMTP id l17-20020a637c51000000b00408c3dbe248mr2142304pgn.490.1655339572394; Wed, 15 Jun 2022 17:32:52 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:d0aa:98f9:9060:950b]) by smtp.gmail.com with ESMTPSA id q4-20020a170902f78400b001641670d1adsm231588pln.131.2022.06.15.17.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 17:32:51 -0700 (PDT) Date: Thu, 16 Jun 2022 09:32:47 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Fabio Estevam , Mark Kettenis , Neil Armstrong , Tom Rini , sughosh.ganu@linaro.org, Simon Glass Subject: Re: [PATCH 1/1] efi_loader: initialize console size late Message-ID: <20220616003247.GA52308@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Fabio Estevam , Mark Kettenis , Neil Armstrong , Tom Rini , sughosh.ganu@linaro.org, Simon Glass References: <20220614060203.33600-1-heinrich.schuchardt@canonical.com> <20220615061616.GD58082@laputa> <19b248fe-0e1f-75b3-d81f-27dcec90f5ff@canonical.com> <20220615063459.GF58082@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Wed, Jun 15, 2022 at 04:02:54PM +0200, Heinrich Schuchardt wrote: > On 6/15/22 08:34, AKASHI Takahiro wrote: > > On Wed, Jun 15, 2022 at 08:27:26AM +0200, Heinrich Schuchardt wrote: > > > > > > > > > On 6/15/22 08:16, AKASHI Takahiro wrote: > > > > On Tue, Jun 14, 2022 at 08:02:03AM +0200, Heinrich Schuchardt wrote: > > > > > From: Heinrich Schuchardt > > > > > > > > > > If CONFIG_VIDEO_DM=n we query the display size from the serial console. > > > > > Especially when using a remote console the response can be so late that > > > > > it interferes with autoboot. > > > > > > > > > > Only query the console size when running an EFI binary. > > > > > > > > > > Add debug output showing the determined console size. > > > > > > > > > > Reported-by: Fabio Estevam > > > > > Fixes: a9bf024b2933 ("efi_loader: disk: a helper function to create efi_disk objects from udevice") > > > > > > Said patch made CONFIG_EFI_SETUP_EARLY=y the default. > > > > I don't think so. > > Any config with this option enabled could cause the issue. > > We could additionally blame your patches that created this config option. That is what I said. > > > > > > > > > > If the key part of this patch is to move query_console_size() from > > > > efi_init_early() to efi_init_obj_list(), the to-be-fixed patch is not > > > > the one above but > > > > commit a57ad20d07e8 ("efi_loader: split efi_init_obj_list() into two stages") > > > > > > > > Moreover, this is just a warning but once Sughosh's patch, > > > > https://lists.denx.de/pipermail/u-boot/2022-June/485977.html > > > > is merged and FWU_MULTI_BANK_UPDATE is enabled, the said phenomenon can > > > > be triggered again because efi_init_obj_list(), hence query_console_size(), > > > > will be called in board_init_r() before showing the U-Boot prompt. > > > > > > Then we should not merge it as is. > > > > I think that your patch is a tentative workaround. > > What makes you think so? > Any better proposal that we can get in in time for v2022.07? I said that it was a "warning" against a foreseeable issue. -Takahiro Akashi > > Best regards > > Heinrich > > > > > -Takahiro Akashi > > > > > > > Best regards > > > > > > Heinrich > > > > > > > > > > > -Takahiro Akashi > > > > > > > > > Signed-off-by: Heinrich Schuchardt > > > > > --- > > > > > include/efi_loader.h | 2 ++ > > > > > lib/efi_loader/efi_console.c | 20 +++++++++++++------- > > > > > lib/efi_loader/efi_setup.c | 4 ++++ > > > > > 3 files changed, 19 insertions(+), 7 deletions(-) > > > > > > > > > > diff --git a/include/efi_loader.h b/include/efi_loader.h > > > > > index f6651e2c60..c1e00ebac3 100644 > > > > > --- a/include/efi_loader.h > > > > > +++ b/include/efi_loader.h > > > > > @@ -499,6 +499,8 @@ extern struct list_head efi_register_notify_events; > > > > > int efi_init_early(void); > > > > > /* Initialize efi execution environment */ > > > > > efi_status_t efi_init_obj_list(void); > > > > > +/* Set up console modes */ > > > > > +void efi_setup_console_size(void); > > > > > /* Install device tree */ > > > > > efi_status_t efi_install_fdt(void *fdt); > > > > > /* Run loaded UEFI image */ > > > > > diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c > > > > > index 60a3fc85ac..3164fd484e 100644 > > > > > --- a/lib/efi_loader/efi_console.c > > > > > +++ b/lib/efi_loader/efi_console.c > > > > > @@ -5,6 +5,8 @@ > > > > > * Copyright (c) 2016 Alexander Graf > > > > > */ > > > > > +#define LOG_CATEGORY LOGC_EFI > > > > > + > > > > > #include > > > > > #include > > > > > #include > > > > > @@ -12,6 +14,7 @@ > > > > > #include > > > > > #include > > > > > #include > > > > > +#include > > > > > #include > > > > > #include > > > > > #include > > > > > @@ -58,7 +61,12 @@ const efi_guid_t efi_guid_text_output_protocol = > > > > > #define cESC '\x1b' > > > > > #define ESC "\x1b" > > > > > -/* Default to mode 0 */ > > > > > +/* > > > > > + * efi_con_mode - mode information of the Simple Text Output Protocol > > > > > + * > > > > > + * Use safe settings before efi_setup_console_size() is called. > > > > > + * By default enable only the 80x25 mode which must always exist. > > > > > + */ > > > > > static struct simple_text_output_mode efi_con_mode = { > > > > > .max_mode = 1, > > > > > .mode = 0, > > > > > @@ -333,13 +341,13 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols) > > > > > } > > > > > /** > > > > > - * query_console_size() - update the mode table. > > > > > + * efi_setup_console_size() - update the mode table. > > > > > * > > > > > * By default the only mode available is 80x25. If the console has at least 50 > > > > > * lines, enable mode 80x50. If we can query the console size and it is neither > > > > > * 80x25 nor 80x50, set it as an additional mode. > > > > > */ > > > > > -static void query_console_size(void) > > > > > +void efi_setup_console_size(void) > > > > > { > > > > > int rows = 25, cols = 80; > > > > > int ret = -ENODEV; > > > > > @@ -351,6 +359,8 @@ static void query_console_size(void) > > > > > if (ret) > > > > > return; > > > > > + log_debug("Console size %dx%d\n", rows, cols); > > > > > + > > > > > /* Test if we can have Mode 1 */ > > > > > if (cols >= 80 && rows >= 50) { > > > > > efi_cout_modes[1].present = 1; > > > > > @@ -371,7 +381,6 @@ static void query_console_size(void) > > > > > } > > > > > } > > > > > - > > > > > /** > > > > > * efi_cout_query_mode() - get terminal size for a text mode > > > > > * > > > > > @@ -1262,9 +1271,6 @@ efi_status_t efi_console_register(void) > > > > > efi_status_t r; > > > > > struct efi_device_path *dp; > > > > > - /* Set up mode information */ > > > > > - query_console_size(); > > > > > - > > > > > /* Install protocols on root node */ > > > > > r = EFI_CALL(efi_install_multiple_protocol_interfaces > > > > > (&efi_root, > > > > > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c > > > > > index 250eeb2fcd..492ecf4cb1 100644 > > > > > --- a/lib/efi_loader/efi_setup.c > > > > > +++ b/lib/efi_loader/efi_setup.c > > > > > @@ -243,6 +243,10 @@ efi_status_t efi_init_obj_list(void) > > > > > goto out; > > > > > } > > > > > + /* Set up console modes */ > > > > > + efi_setup_console_size(); > > > > > + > > > > > + /* Install EFI_RNG_PROTOCOL */ > > > > > if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) { > > > > > ret = efi_rng_register(); > > > > > if (ret != EFI_SUCCESS) > > > > > -- > > > > > 2.36.1 > > > > > >