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 9A808C7EE43 for ; Wed, 7 Jun 2023 07:27:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B4B5385F55; Wed, 7 Jun 2023 09:27:24 +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="XIsGDn9B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC98385E35; Wed, 7 Jun 2023 09:27:22 +0200 (CEST) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 DE4DC85F89 for ; Wed, 7 Jun 2023 09:27:17 +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-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-256918803baso1419710a91.1 for ; Wed, 07 Jun 2023 00:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686122836; x=1688714836; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=dA+dec3Qg5ORrCbVhMnJ+wZKlzOOn5FxQAF778eVR1M=; b=XIsGDn9BQ1p8WTla56/zqqb+2N2lARCUtspPTT3xqe1HSSxlkac17M1lLY+bTolObP IIlAJO7BMD4CH3svTV++xUZrWECPXcx7nlTvLac/E4Xdd9YNhDWe5bbumk8uHIbOwySf R3hPjEqDTgar5CRLLp6ooorQL81b6zb5EmnkTLz/W/1dRXnfCJ117iVR3+vu9tCX+cwx 19lsT2MZTjnI5LESCINZVe0Y5lxJzxvJM3x3wyJ7VU4CJk4AiUrDVLp5wDsmkG/EVBaI uGuLfxgXhEyBW82Fz2Kr3iRKDDH7lc5eToN8ZlNuiS2yaRkLnPwyKJlrlJoVJB1c2T44 Ew7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686122836; x=1688714836; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dA+dec3Qg5ORrCbVhMnJ+wZKlzOOn5FxQAF778eVR1M=; b=WKVYebatTpyE99vrtetRaShWQya+bOloENeoR36XSyTiPdSc1d+NcAh55yg5nC9koG TJM67TJRRXsG9EQ+QpWAvPbVIOVCYUGf5MmUbE//RgN5IzhemEGAmuMJts5ZoalkDXmt gbEWz+APzKyDyP4ZbxrS9p6T01+adIWpv97m84nnWWM3um7s229qNCejCXkO9si9EPUz FtxsvmZeO5DKvWS+c/mQImOht2+n1h2/oaV9Cqm7TDC0siKQ/aiWaeBv48wQcyaM5x7L iE0IiMmlBH0VrfxcwsBuGHpPTcvDa58P2dAYM7U5KGH2aj97jTPERPX1NFByjWlQ+3RT Vl/g== X-Gm-Message-State: AC+VfDxVO2+TaWM5JDEHrQOd7Znr5Kbq7bw+cfyePnIxQcun3UUP+uYn M2TAe8mkdXsKfrWUXzFgPEbLkQ== X-Google-Smtp-Source: ACHHUZ6IiL+23woWFfi1WT/z3rT9QcZygKaQSxBA+iScsVM4qZXRYUvsaA6T1bYSAIEc22bci4Bl9g== X-Received: by 2002:a17:90b:1d0a:b0:256:9095:a368 with SMTP id on10-20020a17090b1d0a00b002569095a368mr5047480pjb.4.1686122835868; Wed, 07 Jun 2023 00:27:15 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:fc03:17ce:85e7:750]) by smtp.gmail.com with ESMTPSA id 20-20020a17090a195400b00259a3c99978sm771158pjh.17.2023.06.07.00.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 00:27:15 -0700 (PDT) Date: Wed, 7 Jun 2023 16:27:12 +0900 From: AKASHI Takahiro To: Ilias Apalodimas Cc: Raymond Mao , u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Masahisa Kojima Subject: Re: [PATCH v8 3/4] Boot var automatic management for removable medias Message-ID: Mail-Followup-To: AKASHI Takahiro , Ilias Apalodimas , Raymond Mao , u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Masahisa Kojima References: <20230606163722.198820-1-raymond.mao@linaro.org> <20230606163722.198820-4-raymond.mao@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean On Wed, Jun 07, 2023 at 10:00:37AM +0300, Ilias Apalodimas wrote: > On Wed, 7 Jun 2023 at 09:52, AKASHI Takahiro wrote: > > > > On Wed, Jun 07, 2023 at 09:38:30AM +0300, Ilias Apalodimas wrote: > > > On Wed, 7 Jun 2023 at 03:41, AKASHI Takahiro wrote: > > > > > > > > On Tue, Jun 06, 2023 at 09:37:20AM -0700, Raymond Mao wrote: > > > > > Changes for complying to EFI spec ยง3.5.1.1 > > > > > 'Removable Media Boot Behavior'. > > > > > Boot variables can be automatically generated during a removable > > > > > media is probed. At the same time, unused boot variables will be > > > > > detected and removed. > > > > > Please note that currently the function 'efi_disk_remove' is being > > > > > invoked during exiting U-Boot and booting an OS - that is why we > > > > > don't add the boot variables management inside 'efi_disk_remove'. > > > > > > > > It's not accurate. > > > > For instance, a user may run "scsi scan" or "usb reset" to re-enumerate > > > > devices added (or removed). They will invoke "remove" against pre-existing > > > > devices before invoking a "probe" routine. > > > > > > > > So the text above doesn't justify not implementing "remove" hook. > > > > > > I am not sure I am following you here. Yes resetting the device will > > > call the remove callback and it's a current problem of the existing > > > implementation, > > > > I think it is a design decision. > > It's not. Ideally, we should call the _remove() callbacks and > reconfigure the boot options correctly if a device gets unplugged or > the subsystem is restarted. However, at least in my opinion, the > problem isn't that big at the moment to prevent the patches from > getting merged. > If you restart the subsystem the same boot options will be rescanned > and the device will be able to boot. The corner case here is scanning > a few boot options and then *removing* the device. But in that case, > the device wasn't going to boot anyway from the removed media. First of all, we should distinguish two cases when you mention the *existing* issues in Raymond's current implementation: 1. Some device is added or removed when we are still on U-Boot 2. When we are existing U-Boot In the above text, you mention case(1) which is not covered by his original commit message. It is one reason why I think that the commit message is not accurate. > > > > > but why is the commit message inaccurate? Won't > > > exiting u-boot to jump to the OS call all the _remove() functions? > > > > Exiting U-Boot is irrelevant to maintaining boot options. > > In theory yes, but the reality is that you can't remove the boot > options and rewrite flashes of embedded boards, with a limited > lifetime, every time you boot your OS. So adding it on the _remove Here you have much more explanation than the original message has for case(2). It is another reason why the commit message is not accurate (or I should say 'not enough'). Without those texts, most people won't understand what the commit message tries to say. -Takahiro Akashi > We could in the future add an extra flag to the > callback *now* is a bad idea and that's what the commit message is > trying to hint. > remove callback which only gets set to false when we are exiting > u-boot > Thanks > /Ilias > > > > -Takahiro Akashi > > > > > Thanks > > > /Ilias > > > > > > > > -Takahiro Akashi > > > > > > > > > Signed-off-by: Raymond Mao > > > > > Reviewed-by: Heinrich Schuchardt > > > > > Reviewed-by: Ilias Apalodimas > > > > > --- > > > > > Changes in v3 > > > > > - Split the patch into moving and renaming functions and > > > > > individual patches for each changed functionality > > > > > Changes in v5 > > > > > - Move function call of efi_bootmgr_update_media_device_boot_option() > > > > > from efi_init_variables() to efi_init_obj_list() > > > > > Changes in v6 > > > > > - Revert unrelated changes > > > > > Changes in v7 > > > > > - adapt the return code of function > > > > > efi_bootmgr_update_media_device_boot_option() > > > > > Changes in v8 > > > > > - add a note in the commit message for future reference > > > > > > > > > > lib/efi_loader/efi_disk.c | 7 +++++++ > > > > > lib/efi_loader/efi_setup.c | 5 +++++ > > > > > 2 files changed, 12 insertions(+) > > > > > > > > > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c > > > > > index d2256713a8..d9b48ecf64 100644 > > > > > --- a/lib/efi_loader/efi_disk.c > > > > > +++ b/lib/efi_loader/efi_disk.c > > > > > @@ -687,6 +687,13 @@ int efi_disk_probe(void *ctx, struct event *event) > > > > > return -1; > > > > > } > > > > > > > > > > + /* only do the boot option management when UEFI sub-system is initialized */ > > > > > + if (efi_obj_list_initialized == EFI_SUCCESS) { > > > > > + ret = efi_bootmgr_update_media_device_boot_option(); > > > > > + if (ret != EFI_SUCCESS) > > > > > + return -1; > > > > > + } > > > > > + > > > > > return 0; > > > > > } > > > > > > > > > > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c > > > > > index 58d4e13402..877f3878d6 100644 > > > > > --- a/lib/efi_loader/efi_setup.c > > > > > +++ b/lib/efi_loader/efi_setup.c > > > > > @@ -245,6 +245,11 @@ efi_status_t efi_init_obj_list(void) > > > > > if (ret != EFI_SUCCESS) > > > > > goto out; > > > > > > > > > > + /* update boot option after variable service initialized */ > > > > > + ret = efi_bootmgr_update_media_device_boot_option(); > > > > > + if (ret != EFI_SUCCESS) > > > > > + goto out; > > > > > + > > > > > /* Define supported languages */ > > > > > ret = efi_init_platform_lang(); > > > > > if (ret != EFI_SUCCESS) > > > > > -- > > > > > 2.25.1 > > > > >