From patchwork Thu Mar 5 12:51:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 45457 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6C28F21494 for ; Thu, 5 Mar 2015 12:53:13 +0000 (UTC) Received: by wibbs8 with SMTP id bs8sf4469060wib.3 for ; Thu, 05 Mar 2015 04:53:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=HkbWwY7GPzotWbCv3tWGYuzu/cAokkRqi1qtzrv7+X8=; b=A36gdBQBv5MWRLskO2uJvGxu2S7IiIGcU6bXLV3jQe1mNHkf8o2QM05CJfdBDg0alU LxqlXmOQLEjBHtkom2vXwyvjSoNz3Vn1h5ENKp7tYDUBJJuIkLxHJnoSBSnjjm+Ngbuu muN3E3ozneHDUqaNKei5EXK1Ol5fL6P//2tRxl4fDDxNdtF9QZHU6sGk8vA/BLW/tv8w yQXTq5JaGwfznDyXozP+r661PztJniTuxVOrspesCnD+wSGw0U3jBJOM4DJV4tcqXOzZ 2VIblbx2yX9fUcqPq1RLRGEuMck0SI+qP4SKShkt/HNSF34Pi351zasWDq+cOgktWXUh WPuw== X-Gm-Message-State: ALoCoQkJaVxCsiOtqxVpAj1AB6Vv6wJ08Qxo3cwaADQt5O3A2/jlrEUQEYV0sVUNatN3cL0u/Hdv X-Received: by 10.180.83.168 with SMTP id r8mr1937195wiy.6.1425559992612; Thu, 05 Mar 2015 04:53:12 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.50 with SMTP id bd18ls135615lab.108.gmail; Thu, 05 Mar 2015 04:53:12 -0800 (PST) X-Received: by 10.152.206.7 with SMTP id lk7mr7759811lac.55.1425559992306; Thu, 05 Mar 2015 04:53:12 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id cy6si4427097lad.81.2015.03.05.04.53.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 04:53:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labhs14 with SMTP id hs14so51126151lab.1 for ; Thu, 05 Mar 2015 04:53:12 -0800 (PST) X-Received: by 10.112.211.200 with SMTP id ne8mr7511891lbc.73.1425559992029; Thu, 05 Mar 2015 04:53:12 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp463166lbj; Thu, 5 Mar 2015 04:53:11 -0800 (PST) X-Received: by 10.70.131.41 with SMTP id oj9mr16032394pdb.12.1425559990333; Thu, 05 Mar 2015 04:53:10 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qh10si9096648pbc.224.2015.03.05.04.53.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 04:53:10 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YTVFp-0003yJ-8o; Thu, 05 Mar 2015 12:51:53 +0000 Received: from mail-wg0-f45.google.com ([74.125.82.45]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YTVFi-0003cO-Ky for linux-arm-kernel@lists.infradead.org; Thu, 05 Mar 2015 12:51:47 +0000 Received: by wggx13 with SMTP id x13so5916326wgg.12 for ; Thu, 05 Mar 2015 04:51:24 -0800 (PST) X-Received: by 10.194.186.236 with SMTP id fn12mr18544058wjc.51.1425559884624; Thu, 05 Mar 2015 04:51:24 -0800 (PST) Received: from ards-macbook-pro.local ([213.143.61.194]) by mx.google.com with ESMTPSA id u18sm10382909wjq.42.2015.03.05.04.51.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Mar 2015 04:51:23 -0800 (PST) From: Ard Biesheuvel To: matt.fleming@intel.com, roy.franz@linaro.org, leif.lindholm@linaro.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, msalter@redhat.com, linux-efi@vger.kernel.org Subject: [PATCH] arm64/efi: use UEFI ResetSystem() Runtime Service for system reset Date: Thu, 5 Mar 2015 13:51:11 +0100 Message-Id: <1425559871-3433-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150305_045146_885798_652965F0 X-CRM114-Status: GOOD ( 11.83 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.45 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.45 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 If UEFI Runtime Services are available, the ResetSystem() service should be preferred over direct PSCI calls or other methods to reset the system. The reason is that the UpdateCapsule() UEFI Runtime Service, which is used to perform firmware updates, relies on this. Signed-off-by: Ard Biesheuvel --- I sent roughly the same patch ~6 months ago, but at the time, we were still waiting for the restart notifier call chain patches to land. Since that code got rejected, I am proposing this again. Note that efi_enabled(x) always evaluates to 'false' on !CONFIG_EFI. This fixes reboot on my Seattle [although it doesn't make it any faster :-)] arch/arm64/kernel/process.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index fde9923af859..a52bc0c316a8 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -150,6 +151,14 @@ void machine_restart(char *cmd) local_irq_disable(); smp_send_stop(); + /* + * Prefer reboot via EFI if available, so that capsule updates [which + * rely on UEFI's ResetSystem() being called with the return value of + * UpdateCapsule()] have a chance of working as expected. + */ + if (efi_enabled(EFI_RUNTIME_SERVICES)) + efi_reboot(reboot_mode, NULL); + /* Now call the architecture specific reboot code. */ if (arm_pm_restart) arm_pm_restart(reboot_mode, cmd);