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 4CDCCC43334 for ; Wed, 15 Jun 2022 14:03:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 318FF844B9; Wed, 15 Jun 2022 16:03:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="tOJOVdVA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0142F844B9; Wed, 15 Jun 2022 16:03:03 +0200 (CEST) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 13896844A7 for ; Wed, 15 Jun 2022 16:03:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E66733FDEB for ; Wed, 15 Jun 2022 14:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1655301778; bh=szw4Kbr4U5EvjYu6E8WhEv6752u0TGbE7lKIZveIebU=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:Cc: In-Reply-To:Content-Type; b=tOJOVdVAM3A2ieN6KG5zyLIKVQ3ESvtf9tjfEs7I/q6+3wZDhae6YSyC1IZXNrqqI v4ebCeeoSG91q9B4T6VWVSdH+DHMmSnUFgSpBvbmS9Ihcn0NS5Mew9X1OQ/XJ8jW4+ luE+Ayvpf9BrhJXSItF7qybuo+8KRs1YbpvSip+0PGWy2pnK6aWIQU7wtd0+nqYfpk 6oNKp7StCoaYBczZ0BPiFhcsZsSg2gDa/McnFeOYxjvfcnlD8IfDS15dq0/n60BKLZ 7nIp/YHN1IP9PHNhaqKEBQBKCwQFzfDXfd7KsNSwt4EU4KOA8hRAup61YHion9dEhc 42UevT0enkrXA== Received: by mail-wr1-f70.google.com with SMTP id d5-20020adfa345000000b0021a2b352d06so366369wrb.13 for ; Wed, 15 Jun 2022 07:02:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:cc:in-reply-to :content-transfer-encoding; bh=szw4Kbr4U5EvjYu6E8WhEv6752u0TGbE7lKIZveIebU=; b=de9NKXY+8ZJKqMMV1vsgHns8JxtKnbu1Od/H8EOkBiPK8ts6O7e8i2hfbdtlLwyFqH wI4711QguhmeKB0x8WRynhREOjgh6Hsu08NR8oQ1PYmPdEWcJU7kmTjLO7fhI+Nvweh3 3hoD0H43HgHWZxt3FYI7X10Z8sBVtYLGLt03I/jEAn365dL0jcrFCDrMDuUY2TYd5JM/ q2wVCUtvtL9Zp+c7/FhtL6FZbNgm9Vj5tcnMhD7g9XNBMTBHDvmkPUlYEl5DFx53CBSz B27gIqDzSgIKRY5jGCOJhukz+srO/rm7lJ+Ba6IEgB/ygIaTq9iy/s+Vbe2/Vlv0rt9Y o/JA== X-Gm-Message-State: AOAM530sOtNr3qyNd7vah77Cb2p0S/9W7FxyDy4QxNyHRFPh4cnBZUk1 CdMenoxXnE6fvp6z+aa35LFP8HQMJzZYtX0DR/c05BPATkB3eKu3WGkGLGu/xDrEK77hv7Hvaq7 6C6ffAYs8ku0gfXhar3xhlqzpURDfZE4= X-Received: by 2002:a7b:c354:0:b0:39c:6753:21f8 with SMTP id l20-20020a7bc354000000b0039c675321f8mr10273736wmj.113.1655301776921; Wed, 15 Jun 2022 07:02:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWLcmSNlZ/qKyTLiP7QNVTFN9qCGPg2xbQALqdyJYcGUaHV5jnXsunE8VDYfPz2gWIU0fmKw== X-Received: by 2002:a7b:c354:0:b0:39c:6753:21f8 with SMTP id l20-20020a7bc354000000b0039c675321f8mr10273711wmj.113.1655301776620; Wed, 15 Jun 2022 07:02:56 -0700 (PDT) Received: from [192.168.123.67] (ip-062-143-094-109.um16.pools.vodafone-ip.de. [62.143.94.109]) by smtp.gmail.com with ESMTPSA id t9-20020a05600c198900b0039c4f53c4fdsm3216152wmq.45.2022.06.15.07.02.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jun 2022 07:02:55 -0700 (PDT) Message-ID: Date: Wed, 15 Jun 2022 16:02:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 1/1] efi_loader: initialize console size late Content-Language: en-US To: AKASHI Takahiro References: <20220614060203.33600-1-heinrich.schuchardt@canonical.com> <20220615061616.GD58082@laputa> <19b248fe-0e1f-75b3-d81f-27dcec90f5ff@canonical.com> <20220615063459.GF58082@laputa> From: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Fabio Estevam , Mark Kettenis , Neil Armstrong , Tom Rini , sughosh.ganu@linaro.org, Simon Glass In-Reply-To: <20220615063459.GF58082@laputa> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 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. > >>> >>> 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? 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 >>>>