From patchwork Mon Jan 31 09:19:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 538480 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp1560749imr; Mon, 31 Jan 2022 01:19:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPeZeD5EAuXgT6aTuCAPKyDtbs9aZPWwn09haM2h9rjABEV6VKgrmQx4ljd1Bx+uNPKvud X-Received: by 2002:a17:907:968f:: with SMTP id hd15mr8142271ejc.208.1643620754685; Mon, 31 Jan 2022 01:19:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643620754; cv=none; d=google.com; s=arc-20160816; b=fd+MNPkEtd+zOblNChXfqp+JpQTVH0LmNCgUdWx7C2DIzw6YVJToQZnBTlg8qSFt28 GysjQgTuEJg1VhggOPLf5kZeFwdkndoQvDjm0cmL2kr1fTgPWiVXRbQLc4XJJrLywGAg y9LaC3tLDf4d0dkuXgYy+6I1ajddx4ZFM1VN1mNUA3XZcV+151mMo94DwYmhGQDL4JG4 Kb0cAJ/fedquVpnXn82/LfTCFB4UFulMvNOLIDzLdUy7C65ppEZxo4n19OqOFS6+/h8E /3oxbF4dFukD/bakZf8iZEJ+yA/aSY2+OMhfPYmh19b8NzJrw5ZETOTMVwcLuV+rNfCU 3lEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=q5iRLj5pXydNTfkMyNfbG+EJFce3wCGI5N7tlf/8VzA=; b=bLzfXlm42DvGGRN74Sg61XWSZMWsJ5dB/8zUE3TO14FaYpeTVIDL2rG+T+9gqxuKjJ /ShGKPnxf+/cWfLTkJmK09GTu/DGPnXeOMQvhAc8ZShtyzWguehOM/1X1SaHnkM1ZKKe cHIDx2WeTySO20hDdALB5cXLt5DS2hZLStZjfVXuFBPaq9Fc5OS+RyZpatec2uMI7pt2 5Q0xjrlZ6ZV9LxY6pxkaoRUdAGVG/7xE47sxvYlNfz7+9hzH8DPbvXdm1hUtuw8yHmFW ZY0WRl292ip5hGVKp1KbY3/aGn16fQy4hoPKb4/pOfmhb9J8NDZ1OK7bHsYggY9xCnSs RY6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ebFJjcXU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id x93si3754397ede.570.2022.01.31.01.19.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 01:19:14 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ebFJjcXU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9300483677; Mon, 31 Jan 2022 10:19:12 +0100 (CET) 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="ebFJjcXU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D8758342C; Mon, 31 Jan 2022 10:19:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 2D6AF831F8 for ; Mon, 31 Jan 2022 10:19:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pj1-x102d.google.com with SMTP id oa14-20020a17090b1bce00b001b61aed4a03so11811923pjb.5 for ; Mon, 31 Jan 2022 01:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=q5iRLj5pXydNTfkMyNfbG+EJFce3wCGI5N7tlf/8VzA=; b=ebFJjcXUYUrsXw7PBs7DVKTnUz1+1DY4DrmQe/Qf7FrXR/MhpOmXHzEkxLK2zbxNPK VBc56IYacYd8907RTo29YxOR0b0yZ7Y5Jwr4nAd4IAoHQ7s32bVDRAfV5SD0xiBFqMDq jFxO+TIdGaBOqLKTLof/b/Pf/ytlaQgjiO0i5wWQJa8I2Ao6f6G/CzbQtn2k6lgGcoPX QQZnJC/Rxj2nejgHma0ldb1nU1Gj4R2CpISh5JFFJ7zVKN1esCLg26bBFEZbRagsX7YO t05SJZbX37kVTCQV6jrQQuUJxrmlF5skWB7961PqpeBlCpMR+wS3vHiecUSvzJKI7yGr xvNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=q5iRLj5pXydNTfkMyNfbG+EJFce3wCGI5N7tlf/8VzA=; b=AUyyvab83YKbbGmUapqNUnDJVkFgdd2MHT+eIPV5Wp4ERlwVk9BLEUdzNF7Z2JB3IR o9Bls5iSnl1XVgFxWLY/Hu4smv04CIfyGpGplnN7M1UWJDIeyMm5apAxONhLMHguz3gX QTc1Z3QmVg0G413m1paA0Jae12K/mc5B3OLHW7hkMsWez00FRXWVkgQg5naea25hgRVD r5t4IinkdYoGXgIvCRxFvgJDsfGunzfk/tnmAdvZ6xLD/KSAoUQdZvwdqeOFDprf9Wml dE2Otae8fcKiFywDrFAOmhZLft9PheiydJX48ZIto75Eb6z6EJSmurwRCGVpb2ZUpGto KC6w== X-Gm-Message-State: AOAM532rObAJb2MZEiAOsUhLGvbmZe3CGuf+q8xp7eNjSpHcQfRj0o5b RGYEGP0TYy9ngZ8hkzs4UJVRqMJgW4meFQ== X-Received: by 2002:a17:902:d507:: with SMTP id b7mr19647936plg.11.1643620744417; Mon, 31 Jan 2022 01:19:04 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id 9sm9008049pjg.50.2022.01.31.01.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 01:19:04 -0800 (PST) From: Masami Hiramatsu To: u-boot@lists.denx.de Cc: Masami Hiramatsu , Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu , Paul Liu Subject: [PATCH 2/2] efi_loader: Reset system after CapsuleUpdate on disk Date: Mon, 31 Jan 2022 18:19:00 +0900 Message-Id: <164362073982.312714.10153796355309762567.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164362071931.312714.14793570668139727572.stgit@localhost> References: <164362071931.312714.14793570668139727572.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 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 Add a config option to reset system soon after processing capsule update on disk. This is required in UEFI specification 2.9 Section 8.5.5 "Delivery of Capsules via file on Mass Storage device" as; In all cases that a capsule is identified for processing the system is restarted after capsule processing is completed. Signed-off-by: Masami Hiramatsu --- lib/efi_loader/Kconfig | 10 ++++++++++ lib/efi_loader/efi_capsule.c | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 24f9a2bb75..db05c3ad90 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -146,6 +146,16 @@ config EFI_IGNORE_OSINDICATIONS without setting the EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED flag in variable OsIndications. +config EFI_RESET_AFTER_CAPSULE_ON_DISK + bool "Reset right after CapsuleUpdate on-disk" + depends on EFI_CAPSULE_ON_DISK + default y + help + UEFI specification requests the system to be restarted after capsule + processing is complete. This implements that, but for some reason, + if you want to keep the (old) system running after the capsule update + on-disk, you can say 'n' here. + config EFI_CAPSULE_ON_DISK_EARLY bool "Initiate capsule-on-disk at U-Boot boottime" depends on EFI_CAPSULE_ON_DISK diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 98dab1c6f5..44d4fa2f82 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -1142,6 +1142,15 @@ efi_status_t efi_launch_capsules(void) free(files[i]); free(files); + /* + * UEFI spec requires to reset system after complete processing capsule + * update on the storage. + */ + if (IS_ENABLED(CONFIG_EFI_RESET_AFTER_CAPSULE_ON_DISK)) { + log_info("Restarting the system to boot the updated firmware.\n"); + do_reset(NULL, 0, 0, NULL); + } + if (IS_ENABLED(CONFIG_EFI_ESRT)) { /* Rebuild the ESRT to reflect any updated FW images. */ ret = efi_esrt_populate();