From patchwork Tue Feb 1 08:33:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 538942 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp643352imr; Tue, 1 Feb 2022 00:33:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJygirnBVv59ZokJOPgROyG4dqB2gncahUrIb3GmHM8adznhTg8hGsKHJDK3Sv9BVCowg83z X-Received: by 2002:a05:6402:d0d:: with SMTP id eb13mr24044365edb.92.1643704405756; Tue, 01 Feb 2022 00:33:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643704405; cv=none; d=google.com; s=arc-20160816; b=B0i1XzFxR8ZOV2m2zX6nUuZq6agQLepPXNX/4vvImEzmg8Yuttf5TrqjFxDevyX63x 9MAjQbNrWGTBWW8KtTqkAWhmJB28na1Z8hLGhynhVwLSFFIVOMS2etZtoRa67TyLyv76 iyXeSeHSfUHIJ29Q09ZtXe6tNbLuVaLL7qUTYis8xmeqoAoV6QO93yX09VOvf9rrRE4x 3RtcpF0v2NS57fubnXfknmK72lVOmM0hLDjVhGMqd2kd9388TKrEpM2HhsLRNfSeBkVm dp3npgiYbBKKtkPhIMAPO/ilkD4Y4Wow9XiPx7SDhvVsypY0N3htWLO+lQVqVt76ah8P szIA== 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=MRUzeHIsqPIdSYepgjl6W0pN0UsuuSNKbv06RwTTcF4=; b=cJuzPlKZ+piuGmjiVU+7eEZme/TNyF/n+YRcDpvKumYE9KQngvIjFnLMlZVb/VvXwl mYW6B+mtTzpPss+4Wnn8OMvJN2ysdIiGStb3c7DTy25JhId7pNQV+cAO5kij2S7QirOM 5/a7sE0XkkcDjSUuIHXWVGy9A9Q7zWIOdKWmMSXzEnd09zZxP4yfSZ/7RwvNkwrBZ7Vs LNa0J9P736cWgPgqLOb6JFoyXte8o2n5eJRzhc+wFj6mpxcv7OQQfB0y4BXgt6DK30WB eACs6bUTcHMlFUp/BHDFNZofHquH4SjB0Ww5XU7x/T/hS3uTQtjbSiqNCyzAsED5IB3B jG1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LRhhimSj; 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 sh10si8721498ejc.10.2022.02.01.00.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 00:33:25 -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=LRhhimSj; 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 2ACB08341A; Tue, 1 Feb 2022 09:33:21 +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="LRhhimSj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 42A6580202; Tue, 1 Feb 2022 09:33:19 +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-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (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 47DC580202 for ; Tue, 1 Feb 2022 09:33:16 +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-x102f.google.com with SMTP id z10-20020a17090acb0a00b001b520826011so1963377pjt.5 for ; Tue, 01 Feb 2022 00:33:16 -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=MRUzeHIsqPIdSYepgjl6W0pN0UsuuSNKbv06RwTTcF4=; b=LRhhimSjOhD5N2p4iewcMKLLmiq7UJyPHKyWZAYtPQI0/ERQEEWdryrhmfKUQinHow 9/oSehrphOLqc05mPJbXLhwWr4FUGQaGtcXUiGpBoPmE+yeJerLN88C0MAgJC5fsspow AJFJ/nZoN9z2yGkskrMMYXyJvuRmy0Akz0H5wzY8WWZ69QVkoqhEYIQB9VgfcbBS8j0p edNgmb+MCmfZ7p/1PCIthTYpOUGv4SJmWZYcKRc8Yv+9feeiU1T5i9d7ePymgyywLAec mFTQuLX0bjVXPj5pUj0XmABJ/yo6XVpu/a2slrZorvPjIMQLFD2FvkDjpYDmQ1M2Ai3S cGUQ== 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=MRUzeHIsqPIdSYepgjl6W0pN0UsuuSNKbv06RwTTcF4=; b=g3+Xq/Z39bpZ0JYzsX7K8Y5fdhhR5npcxrFm6brM2LnmVHXuAEM0gOt9/S7biXXn4E iz5e+pE9Zts3y2e9ht2XM5rcv/HQPLEfcvJzo8b9HjXcwr14084TEtfTTSr6AVF+PwMo +vNREpKUDrEf3Wvzpg1z3qmxUhyTa8Nh6Q7fMGlV0A7YouedyWQ29CNYqlN2rTc5ewHq 9d11tWBl+6gqrvReA3DBs9KoPWMwtRbMtG5QXHnxZ8duKrWE6aaULSTuWfa7oFq9m0Ay DUpgvUNA3L8cTsNSE6U4fnXdpJgTGHAhgrytxyVVXfMJyz+5sFSGpWSIDRjTywMn50/G WOrQ== X-Gm-Message-State: AOAM531LlKnSlpe5EB/ukXlDcqewJDc29VaG3SHj5NsAZJ1+ILoSuD3p 9hOzK7yK1go/u92cRN9q58s5kU5pT84wTw== X-Received: by 2002:a17:903:2288:: with SMTP id b8mr24729764plh.39.1643704394376; Tue, 01 Feb 2022 00:33:14 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id q15sm1879678pjj.19.2022.02.01.00.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 00:33:14 -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 v2 2/2] efi_loader: Reset system after CapsuleUpdate on disk Date: Tue, 1 Feb 2022 17:33:09 +0900 Message-Id: <164370438970.365087.16509597865935044130.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164370436957.365087.15139421656192351360.stgit@localhost> References: <164370436957.365087.15139421656192351360.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. This also reports the result of each capsule update so that the user can notice that the capsule update has been succeeded or not from console log. Signed-off-by: Masami Hiramatsu --- Changes in v2: - Remove kconfig option to disable this feature. - Use panic() instead of do_reset() so that if the reset fails, the machine halt. - Log the result of each capsule update always. --- lib/efi_loader/efi_capsule.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 1ec7ea29ff..39bce714f7 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -1119,9 +1119,9 @@ efi_status_t efi_launch_capsules(void) ret = efi_capsule_read_file(files[i], &capsule); if (ret == EFI_SUCCESS) { ret = efi_capsule_update_firmware(capsule); - if (ret != EFI_SUCCESS) - log_err("Applying capsule %ls failed\n", - files[i]); + log_err("Applying capsule %ls %s\n", + files[i], + ret == EFI_SUCCESS ? "succeeded" : "failed"); /* create CapsuleXXXX */ set_capsule_result(index, capsule, ret); @@ -1142,6 +1142,12 @@ 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. + */ + panic("Reboot after firmware update"); + return ret; } #endif /* CONFIG_EFI_CAPSULE_ON_DISK */