From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.3041.1649140161500723767 for ; Mon, 04 Apr 2022 23:29:21 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pranav.madhu@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6684CD6E; Mon, 4 Apr 2022 23:29:20 -0700 (PDT) Received: from usa.arm.com (a074742.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3E8593F73B; Mon, 4 Apr 2022 23:29:19 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2][PATCH V3 1/1] ArmPkg: Handle warm reboot request correctly Date: Tue, 5 Apr 2022 11:59:13 +0530 Message-Id: <20220405062913.4945-1-pranav.madhu@arm.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The warm reboot requests were mapped to cold reboot as the power control module was not capable of handling the warm reboot requests. That has changed now and power control module supports warm reboot. Accordingly, update ArmSmcPsciResetSystemLib and to invoke the PSCI call with parameters for warm reboot. Signed-off-by: Pranav Madhu --- ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 2 = ++ ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c | 19 = +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) Changes since V1: - Addressed comments from Ard. Changes since V2: - Remove 32 bit warm reboot PSCI support. - Update ResetWarm() to check whether platform support warm reset. - Addressed comments from Sami Link to github branch for this patch - https://github.com/Pranav-Madhu/edk2/tree/topics/warm_reboot diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h b/ArmPkg/Include= /IndustryStandard/ArmStdSmc.h index 655edc21b205..2025f5f10419 100644 --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h @@ -93,6 +93,8 @@ #define ARM_SMC_ID_PSCI_MIGRATE_AARCH32 0x84000005 #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x84000008 #define ARM_SMC_ID_PSCI_SYSTEM_RESET 0x84000009 +#define ARM_SMC_ID_PSCI_FEATURES 0x8400000A +#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64 0xc4000012 =20 /* The current PSCI version is: 0.2 */ #define ARM_SMC_PSCI_VERSION_MAJOR 0 diff --git a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSyste= mLib.c b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib= .c index af6738459e43..4cc91a508d09 100644 --- a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c +++ b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c @@ -3,6 +3,7 @@ =20 Copyright (c) 2017 - 2018, Linaro Ltd. All rights reserved.
Copyright (c) 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2022, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -47,8 +48,22 @@ ResetWarm ( VOID ) { - // Map a warm reset into a cold reset - ResetCold (); + UINTN Arg1 =3D ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64; + UINTN ret; + + // Is SYSTEM_RESET2 supported? + ret =3D ArmCallSmc0 (ARM_SMC_ID_PSCI_FEATURES, &Arg1, NULL, NULL); + if (ret =3D=3D ARM_SMC_PSCI_RET_SUCCESS) { + // Send PSCI SYSTEM_RESET2 command + ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64, NULL, NULL, NULL= ); + } else { + // Map a warm reset into a cold reset + DEBUG (( + DEBUG_INFO, + "Warm reboot not supported by platform, issuing cold reboot\n" + )); + ResetCold (); + } } =20 /** --=20 2.17.1