From patchwork Fri Mar 6 14:49:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 45487 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C014204BC for ; Fri, 6 Mar 2015 14:51:18 +0000 (UTC) Received: by wggx13 with SMTP id x13sf9832672wgg.0 for ; Fri, 06 Mar 2015 06:51:17 -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=ZQw21pPtHwdHQYrq1N+eOrW+Mbxtp3WMtAcZz4TKriQ=; b=dxTirlw6hwNdQUzu3pSMVIX19nuLnq0s8sKAMHPDJdttu4iKjGi4lPDqjTaIyTj6Y8 02SZInG79zZ2XXWvM4akRFcZdjzZLeE8SFzMSVTeSzL6PBKInHe/oi85oUXJFGZdXXSM ltTSXq3N0wEjAJ9Ptg34BdLF3V2e2aBvQRaSdQkz+vJ6rSdGg0Em89lTYxgJ40zIiqtz SeNhsztapPQ2oRJNwH3pA32B9FueoyUfE6Nbycq6FFtKbXpyBau5AvmhnaG1uRXIFIF3 XooPTFJ3pjsbdiEQ95gM76wL3BAgXTDdMOqc3jZl+srWivKMsIpVgw4aqbJ4HpfzF29w hAPw== X-Gm-Message-State: ALoCoQmdyJQE/gS+cjUu8+9eiSLpPR3OkfEySvm4K77lFIlZjatIQllzIUcabqWBn9iwabPpQxKz X-Received: by 10.152.4.229 with SMTP id n5mr2374112lan.1.1425653477612; Fri, 06 Mar 2015 06:51:17 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.180 with SMTP id jp20ls73088lab.64.gmail; Fri, 06 Mar 2015 06:51:17 -0800 (PST) X-Received: by 10.112.73.104 with SMTP id k8mr12834331lbv.120.1425653477316; Fri, 06 Mar 2015 06:51:17 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id cb4si7302098lad.35.2015.03.06.06.51.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2015 06:51:17 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by labhs14 with SMTP id hs14so58081260lab.4 for ; Fri, 06 Mar 2015 06:51:17 -0800 (PST) X-Received: by 10.112.8.101 with SMTP id q5mr7262687lba.19.1425653477123; Fri, 06 Mar 2015 06:51:17 -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 h5csp1181963lbj; Fri, 6 Mar 2015 06:51:16 -0800 (PST) X-Received: by 10.70.42.177 with SMTP id p17mr25574553pdl.91.1425653475374; Fri, 06 Mar 2015 06:51:15 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id y15si15031410pbt.141.2015.03.06.06.51.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2015 06:51:15 -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 1YTtZf-0002oB-NN; Fri, 06 Mar 2015 14:49:59 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YTtZa-0002fG-OL for linux-arm-kernel@lists.infradead.org; Fri, 06 Mar 2015 14:49:56 +0000 Received: by widem10 with SMTP id em10so4106637wid.5 for ; Fri, 06 Mar 2015 06:49:31 -0800 (PST) X-Received: by 10.180.210.228 with SMTP id mx4mr66099321wic.71.1425653371774; Fri, 06 Mar 2015 06:49:31 -0800 (PST) Received: from ards-macbook-pro.local ([213.143.61.133]) by mx.google.com with ESMTPSA id bo1sm15254843wjb.15.2015.03.06.06.49.29 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Mar 2015 06:49:30 -0800 (PST) From: Ard Biesheuvel To: mark.rutland@arm.com, leif.lindholm@linaro.org, roy.franz@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-arm-kernel@lists.infradead.org, msalter@redhat.com, matt.fleming@intel.com, linux-efi@vger.kernel.org Subject: [PATCH v2] efi/arm64: use UEFI for system reset and poweroff Date: Fri, 6 Mar 2015 15:49:24 +0100 Message-Id: <1425653364-12591-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-20150306_064954_981730_E9438BC7 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. 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 [209.85.212.170 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.170 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.54 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, they are preferred over direct PSCI calls or other methods to reset the system. For the reset case, we need to hook into machine_restart(), as the arm_pm_restart function pointer may be overwritten by modules. Tested-by: Mark Rutland Reviewed-by: Mark Rutland Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/efi.c | 9 +++++++++ arch/arm64/kernel/process.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index b42c7b480e1e..2b8d70164428 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -354,3 +354,12 @@ void efi_virtmap_unload(void) efi_set_pgd(current->active_mm); preempt_enable(); } + +/* + * UpdateCapsule() depends on the system being shutdown via + * ResetSystem(). + */ +bool efi_poweroff_required(void) +{ + return efi_enabled(EFI_RUNTIME_SERVICES); +} diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index fde9923af859..c6b1f3b96f45 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,13 @@ void machine_restart(char *cmd) local_irq_disable(); smp_send_stop(); + /* + * UpdateCapsule() depends on the system being reset via + * ResetSystem(). + */ + 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);