* [edk2][PATCH V4 1/1] ArmPkg: Handle warm reboot request correctly
@ 2022-08-24 16:44 Pranav Madhu
2022-09-05 13:54 ` Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Pranav Madhu @ 2022-08-24 16:44 UTC (permalink / raw)
To: devel; +Cc: Ard Biesheuvel, Sami Mujawar
The warm reboot requests from OSPM are mapped to cold reboot. To handle
the warm reboot separately from a cold reboot, update
ArmSmcPsciResetSystemLib and to invoke the PSCI call with parameters
for warm reboot.
Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
---
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
Changes since V3:
- Rebased on top of latest upstream master branch.
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..78ce77cd734d 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
/* The current PSCI version is: 0.2 */
#define ARM_SMC_PSCI_VERSION_MAJOR 0
diff --git a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
index af6738459e43..b710cd066e8b 100644
--- a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
+++ b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
@@ -3,6 +3,7 @@
Copyright (c) 2017 - 2018, Linaro Ltd. All rights reserved.<BR>
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -47,8 +48,22 @@ ResetWarm (
VOID
)
{
- // Map a warm reset into a cold reset
- ResetCold ();
+ UINTN Arg1 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
+ UINTN ret;
+
+ // Is SYSTEM_RESET2 supported?
+ ret = ArmCallSmc0 (ARM_SMC_ID_PSCI_FEATURES, &Arg1, NULL, NULL);
+ if (ret == ARM_SMC_PSCI_RET_SUCCESS) {
+ // Send PSCI SYSTEM_RESET2 command
+ ArmCallSmc0 (Arg1, 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 ();
+ }
}
/**
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2][PATCH V4 1/1] ArmPkg: Handle warm reboot request correctly
2022-08-24 16:44 [edk2][PATCH V4 1/1] ArmPkg: Handle warm reboot request correctly Pranav Madhu
@ 2022-09-05 13:54 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2022-09-05 13:54 UTC (permalink / raw)
To: Pranav Madhu; +Cc: devel, Ard Biesheuvel, Sami Mujawar
On Wed, 24 Aug 2022 at 18:44, Pranav Madhu <pranav.madhu@arm.com> wrote:
>
> The warm reboot requests from OSPM are mapped to cold reboot. To handle
> the warm reboot separately from a cold reboot, update
> ArmSmcPsciResetSystemLib and to invoke the PSCI call with parameters
> for warm reboot.
>
> Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
Merged as #3287
> ---
> 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
>
> Changes since V3:
> - Rebased on top of latest upstream master branch.
>
> 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..78ce77cd734d 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
>
> /* The current PSCI version is: 0.2 */
> #define ARM_SMC_PSCI_VERSION_MAJOR 0
> diff --git a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
> index af6738459e43..b710cd066e8b 100644
> --- a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
> +++ b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
> @@ -3,6 +3,7 @@
>
> Copyright (c) 2017 - 2018, Linaro Ltd. All rights reserved.<BR>
> Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -47,8 +48,22 @@ ResetWarm (
> VOID
> )
> {
> - // Map a warm reset into a cold reset
> - ResetCold ();
> + UINTN Arg1 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
> + UINTN ret;
> +
> + // Is SYSTEM_RESET2 supported?
> + ret = ArmCallSmc0 (ARM_SMC_ID_PSCI_FEATURES, &Arg1, NULL, NULL);
> + if (ret == ARM_SMC_PSCI_RET_SUCCESS) {
> + // Send PSCI SYSTEM_RESET2 command
> + ArmCallSmc0 (Arg1, 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 ();
> + }
> }
>
> /**
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-05 13:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-24 16:44 [edk2][PATCH V4 1/1] ArmPkg: Handle warm reboot request correctly Pranav Madhu
2022-09-05 13:54 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox