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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C9DCC11F66 for ; Thu, 1 Jul 2021 00:49:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 122DB6108B for ; Thu, 1 Jul 2021 00:49:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 122DB6108B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD64B82BFE; Thu, 1 Jul 2021 02:49:20 +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="d1JTIE6e"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D780C82C0A; Thu, 1 Jul 2021 02:49:18 +0200 (CEST) Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (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 58F7C82BE9 for ; Thu, 1 Jul 2021 02:49:15 +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-x1034.google.com with SMTP id p17-20020a17090b0111b02901723ab8d11fso2848537pjz.1 for ; Wed, 30 Jun 2021 17:49:15 -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=d/2IqzlNrx3TtwNcRg8/u9L7OSWFU97VgU5tuKXuWgg=; b=d1JTIE6eXA16TkzvOQV1eCbbn9zhgIvNRO/FnFHzJMRYmz/DFm0YbCQD0AQAsUhOS8 e38O1MHub0gkG4T6VGE5hrfkTvMmLtc6lJXxpYB2VsWaIN4+yV9GKfTzXP4IpEpMxQkV /UotXk3b7rSLhtNLqSr/vE4M7er+RWvN8zrlbW9AO7uB+vRcPaXr9/cXmAGCv8wfOaFp Ge8uVF99e1jgnFl5ThawEDkfnPsJJq5oDcEMHY4RPquW4ErBMDseyvArsSdjxvzg/Ke8 0zdLGgAdSq1gWLlRyCMAeLgeSjHYO6lD+3JVYlsvJI3gPhUBt1m/KPygBIOIXt0FrLuv VzAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=d/2IqzlNrx3TtwNcRg8/u9L7OSWFU97VgU5tuKXuWgg=; b=LZ10tuC4UUk1vJilzaYY3W5C2CYPJKiNScPtA+uns5cWplw/o9M2kBVLkZ/jG9n9yt c6rwpl7VvS6V9gn8omBVkBggRsLxOShUFcc3C8HR9fQcNeuT4fKjbr7mRWMZzWbYV+k4 5cKE9s+U2d0nv8fnSFa1uf8DgXUqEl1sdUdaCmTfvOuIdPKU+FavKlfmS+qGaGl5q1Oq 3p42Q8J7p4oz1IwpIuwXfkUlmjQTJbCz24ok4QUztS0YOzHjZwy4IAMuL9e4FZpdNxDP 6KzDUWDIgstJHQarWMixVt9v4Bv70UYuw0vjlsv1G1J6xl59BiXbyF/eDgB+ZV26jDl4 P61Q== X-Gm-Message-State: AOAM532Cc+wPVcLXIEoZX1DPlEKcmpbl0j6N4NzkuHmcRg/6kiXT3qo8 i7QfGfkDFGTM2i2iK1D18s/omA== X-Google-Smtp-Source: ABdhPJw+OUpIY3c2NqnqEIwCAer4jfD+ANoMbV93Y42fIDlXvTelnspsU1doy/sN5gp6mcCwNshscg== X-Received: by 2002:a17:902:ea09:b029:129:324d:9b02 with SMTP id s9-20020a170902ea09b0290129324d9b02mr790658plg.58.1625100553255; Wed, 30 Jun 2021 17:49:13 -0700 (PDT) Received: from laputa (p3dd30534.tkyea130.ap.so-net.ne.jp. [61.211.5.52]) by smtp.gmail.com with ESMTPSA id w14sm23336121pjb.3.2021.06.30.17.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 17:49:12 -0700 (PDT) Date: Thu, 1 Jul 2021 09:49:09 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Alexander Graf , Ilias Apalodimas Subject: Re: [PATCH v2 1/2] efi_loader: fix set_capsule_result() Message-ID: <20210701004909.GA7183@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Alexander Graf , Ilias Apalodimas References: <20210630153116.26756-1-xypron.glpk@gmx.de> <20210630153116.26756-2-xypron.glpk@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210630153116.26756-2-xypron.glpk@gmx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean NAK. On Wed, Jun 30, 2021 at 05:31:15PM +0200, Heinrich Schuchardt wrote: > The log category must be LOG_CATEGORY LOGC_EFI. > > efi_set_variable() should be called with EFI_CALL(). Use > efi_set_variable_int() instead. > > A log text "Updating ..." if SetVariable() fails does not make sense for a > variable that is not required to be preexisting. > > CapsuleLast should always be immediately updated. As I said to your v1 in [1], You are trying to fix several irrelevant issues here. Please split them into separate patches as you have always asked me before. [1] https://lists.denx.de/pipermail/u-boot/2021-June/453148.html -Takahiro Akashi > Signed-off-by: Heinrich Schuchardt > --- > v2: > don't update OsIndications in set_capsule_result() > update CapsuleLast immediately > --- > lib/efi_loader/efi_capsule.c | 39 +++++++++++++++++++----------------- > 1 file changed, 21 insertions(+), 18 deletions(-) > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index 2c37a0d97b..f87ef2a514 100644 > --- a/lib/efi_loader/efi_capsule.c > +++ b/lib/efi_loader/efi_capsule.c > @@ -6,6 +6,8 @@ > * Author: AKASHI Takahiro > */ > > +#define LOG_CATEGORY LOGC_EFI > + > #include > #include > #include > @@ -95,13 +97,25 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule, > else > memset(&result.capsule_processed, 0, sizeof(time)); > result.capsule_status = return_status; > - ret = efi_set_variable(variable_name16, &efi_guid_capsule_report, > - EFI_VARIABLE_NON_VOLATILE | > - EFI_VARIABLE_BOOTSERVICE_ACCESS | > - EFI_VARIABLE_RUNTIME_ACCESS, > - sizeof(result), &result); > - if (ret) > - log_err("EFI: creating %ls failed\n", variable_name16); > + ret = efi_set_variable_int(variable_name16, &efi_guid_capsule_report, > + EFI_VARIABLE_NON_VOLATILE | > + EFI_VARIABLE_BOOTSERVICE_ACCESS | > + EFI_VARIABLE_RUNTIME_ACCESS, > + sizeof(result), &result, false); > + if (ret != EFI_SUCCESS) { > + log_err("Setting %ls failed\n", variable_name16); > + return; > + } > + > + /* Variable CapsuleLast must not include terminating 0x0000 */ > + ret = efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report, > + EFI_VARIABLE_READ_ONLY | > + EFI_VARIABLE_NON_VOLATILE | > + EFI_VARIABLE_BOOTSERVICE_ACCESS | > + EFI_VARIABLE_RUNTIME_ACCESS, > + 22, variable_name16, false); > + if (ret != EFI_SUCCESS) > + log_err("Setting %ls failed\n", L"CapsuleLast"); > } > > #ifdef CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT > @@ -988,7 +1002,6 @@ efi_status_t efi_launch_capsules(void) > struct efi_capsule_header *capsule = NULL; > u16 **files; > unsigned int nfiles, index, i; > - u16 variable_name16[12]; > efi_status_t ret; > > if (!check_run_capsules()) > @@ -1045,16 +1058,6 @@ efi_status_t efi_launch_capsules(void) > free(files[i]); > free(files); > > - /* CapsuleLast */ > - efi_create_indexed_name(variable_name16, sizeof(variable_name16), > - "Capsule", index - 1); > - efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report, > - EFI_VARIABLE_READ_ONLY | > - EFI_VARIABLE_NON_VOLATILE | > - EFI_VARIABLE_BOOTSERVICE_ACCESS | > - EFI_VARIABLE_RUNTIME_ACCESS, > - 22, variable_name16, false); > - > return ret; > } > #endif /* CONFIG_EFI_CAPSULE_ON_DISK */ > -- > 2.30.2 >