public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH 1/1] Platform/RaspberryPi: Fix Linux kernel panic on reset/poweroff
@ 2021-01-05 14:09 Pete Batard
  2021-01-05 14:19 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Pete Batard @ 2021-01-05 14:09 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif, samer.el-haj-mahmoud, awarkentin

Commit 94e9fba43d7e132be3c582c676968a7f408072c1 introduced an unconditional
call to PcdGet32 after we exit boot services, that produces a kernel panic
on Linux reset.

This addendum to the previous commit ensures that we only read the PCD and
apply the delay while we are still in UEFI, which is what we want anyway as
the goal was to fix the storage of NV variables set by the user from within
the UEFI firmware interface.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Library/ResetLib/ResetLib.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Platform/RaspberryPi/Library/ResetLib/ResetLib.c b/Platform/RaspberryPi/Library/ResetLib/ResetLib.c
index 4a50166dd63b..a70eee485ddf 100644
--- a/Platform/RaspberryPi/Library/ResetLib/ResetLib.c
+++ b/Platform/RaspberryPi/Library/ResetLib/ResetLib.c
@@ -52,13 +52,13 @@ LibResetSystem (
      * Only if still in UEFI.
      */
     EfiEventGroupSignal (&gRaspberryPiEventResetGuid);
-  }
 
-  Delay = PcdGet32 (PcdPlatformResetDelay);
-  if (Delay != 0) {
-    DEBUG ((DEBUG_INFO, "Platform will be reset in %d.%d seconds...\n",
-            Delay / 1000000, (Delay % 1000000) / 100000));
-    MicroSecondDelay (Delay);
+    Delay = PcdGet32 (PcdPlatformResetDelay);
+    if (Delay != 0) {
+      DEBUG ((DEBUG_INFO, "Platform will be reset in %d.%d seconds...\n",
+              Delay / 1000000, (Delay % 1000000) / 100000));
+      MicroSecondDelay (Delay);
+    }
   }
   DEBUG ((DEBUG_INFO, "Platform %a.\n",
           (ResetType == EfiResetShutdown) ? "shutdown" : "reset"));
-- 
2.29.2.windows.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-platforms][PATCH 1/1] Platform/RaspberryPi: Fix Linux kernel panic on reset/poweroff
  2021-01-05 14:09 [edk2-platforms][PATCH 1/1] Platform/RaspberryPi: Fix Linux kernel panic on reset/poweroff Pete Batard
@ 2021-01-05 14:19 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2021-01-05 14:19 UTC (permalink / raw)
  To: Pete Batard, devel; +Cc: leif, samer.el-haj-mahmoud, awarkentin

On 1/5/21 3:09 PM, Pete Batard wrote:
> Commit 94e9fba43d7e132be3c582c676968a7f408072c1 introduced an unconditional
> call to PcdGet32 after we exit boot services, that produces a kernel panic
> on Linux reset.
> 
> This addendum to the previous commit ensures that we only read the PCD and
> apply the delay while we are still in UEFI, which is what we want anyway as
> the goal was to fix the storage of NV variables set by the user from within
> the UEFI firmware interface.
> 
> Signed-off-by: Pete Batard <pete@akeo.ie>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>

Pushed as 162f4a41a860..ae6c236e7610

Thanks Pete.

> ---
>  Platform/RaspberryPi/Library/ResetLib/ResetLib.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/Library/ResetLib/ResetLib.c b/Platform/RaspberryPi/Library/ResetLib/ResetLib.c
> index 4a50166dd63b..a70eee485ddf 100644
> --- a/Platform/RaspberryPi/Library/ResetLib/ResetLib.c
> +++ b/Platform/RaspberryPi/Library/ResetLib/ResetLib.c
> @@ -52,13 +52,13 @@ LibResetSystem (
>       * Only if still in UEFI.
>       */
>      EfiEventGroupSignal (&gRaspberryPiEventResetGuid);
> -  }
>  
> -  Delay = PcdGet32 (PcdPlatformResetDelay);
> -  if (Delay != 0) {
> -    DEBUG ((DEBUG_INFO, "Platform will be reset in %d.%d seconds...\n",
> -            Delay / 1000000, (Delay % 1000000) / 100000));
> -    MicroSecondDelay (Delay);
> +    Delay = PcdGet32 (PcdPlatformResetDelay);
> +    if (Delay != 0) {
> +      DEBUG ((DEBUG_INFO, "Platform will be reset in %d.%d seconds...\n",
> +              Delay / 1000000, (Delay % 1000000) / 100000));
> +      MicroSecondDelay (Delay);
> +    }
>    }
>    DEBUG ((DEBUG_INFO, "Platform %a.\n",
>            (ResetType == EfiResetShutdown) ? "shutdown" : "reset"));
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-05 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-05 14:09 [edk2-platforms][PATCH 1/1] Platform/RaspberryPi: Fix Linux kernel panic on reset/poweroff Pete Batard
2021-01-05 14:19 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox