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 62522C77B73 for ; Tue, 6 Jun 2023 12:06:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1163985F52; Tue, 6 Jun 2023 14:06:43 +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="caPNCqWk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7751585F52; Tue, 6 Jun 2023 14:06:41 +0200 (CEST) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 2AED785F3D for ; Tue, 6 Jun 2023 14:06:38 +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=ilias.apalodimas@linaro.org Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-30e4eec95c8so524608f8f.3 for ; Tue, 06 Jun 2023 05:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686053197; x=1688645197; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Nu4HczmOQMf+x/kBhCSadbGaOsa1TOttOMAIYQqpJJA=; b=caPNCqWkx1AB4Zz/4kJE/nWAGi2r6UQBiM/raU29pbd51yVUwmPDQLvgKVpyci7wDh RXHHedBWK1D2esss8PECGuA777KDkjR88mLYHDDXR5ibfnmHNOkvVXXyZG2hhCRyAgUM VYNJZZFoxyAikfwrLpbu7p67VtjtQxNXPAuCeKj2okBDTPJAE6x3650tWKfmqp1RJZs/ r4IJNWLt3gOIWS1h7o8kWNJvM/3WvVTrSCL0wLNCikSKBATInRm6IoZWact21D3SHp1S 8lYBr3pLZVs4S2xFMd2gc0jo12OlKlfR+XvQuTVpQDwtEvuylzOYLKq5TTcVBcSZYECY NFLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686053197; x=1688645197; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Nu4HczmOQMf+x/kBhCSadbGaOsa1TOttOMAIYQqpJJA=; b=bSM5t2g7WOPJwx50DrNbkHUPKuPt4KAML1Gj9EiqeHm5aYJVoZl7WhCd/Ttix6eIyF Ryxh41WugHtu4+/LkKQ9x5GaJSTHhWfk9ON42HI79AmwZW1T3J8r0duvXHt8PODWVHLq 4ld7VXByAEIcDeJIlbtid6lr7x0StxWQayfZxoyhnKtGMF/2z3Lf/9vGJYl8/A6csEQA 1xfMnLYkSI/WX5l7qS1TpGNWStdFFUwyAVnnRTN4j+fqiazVhuQnkfjXWiqykQxB9h0+ ihuD4llVV+If99kLIK+PHxFSBdhJv2QlLd6BTdybccJmpC4qQaUCP44kWHf/S+DjVUDa Iazg== X-Gm-Message-State: AC+VfDwCFETblAsNRmxIy34OrjJtQfurRgQ9Q4Tk9p5WtNFHkTiISWKC nuerMHPSW7IfsbrDWnN2weZw+Q== X-Google-Smtp-Source: ACHHUZ58KrSh7YL3wjQfIoYtN2aOcpjuEujIFkH1t4jwVtgxuSApFKCgRME2p7ROPdflbA382C2Trw== X-Received: by 2002:a5d:6147:0:b0:30a:dfb4:e300 with SMTP id y7-20020a5d6147000000b0030adfb4e300mr1929949wrt.28.1686053197615; Tue, 06 Jun 2023 05:06:37 -0700 (PDT) Received: from hera (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id y20-20020a05600c365400b003f60a446fe5sm13942412wmq.29.2023.06.06.05.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 05:06:37 -0700 (PDT) Date: Tue, 6 Jun 2023 15:06:35 +0300 From: Ilias Apalodimas To: Raymond Mao Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Masahisa Kojima Subject: Re: [PATCH v7 3/4] Boot var automatic management for removable medias Message-ID: References: <20230531174515.41758-1-raymond.mao@linaro.org> <20230531174515.41758-4-raymond.mao@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230531174515.41758-4-raymond.mao@linaro.org> 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, May 31, 2023 at 10:45:17AM -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. > The code seems fine, but I think there's some things that need to be clarified on the commit message for future reference. Can you add a short text describing *why* you only do that in efi_disk_probe() and not when the disk is signalled to be removed as well? IOW mention the fact that the _remove() callback is always called when we are exiting U-Boot trying to boot and OS, so running the same function in remove doesn't currently make sense. With that addition Reviewed-by: Ilias Apalodimas > Signed-off-by: Raymond Mao > --- > 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() > > 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 >