public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0
@ 2023-06-16 12:40 Sami Mujawar
  2023-06-16 12:56 ` Sudeep Holla
  2023-06-28 10:56 ` PierreGondois
  0 siblings, 2 replies; 3+ messages in thread
From: Sami Mujawar @ 2023-06-16 12:40 UTC (permalink / raw)
  To: devel
  Cc: Sami Mujawar, ardb+tianocore, thomas.abraham, Sudeep.Holla,
	Pierre.Gondois, Matteo.Carlini, Akanksha.Jain2, Ben.Adderson,
	Sibel.Allinson, nd

Juno includes a system-level wakeup timer which is an implementation
of the ARM Generic Timer architecture.
The CNTCTL frame contains some registers that are accessible using a
Non-Secure access. Juno R0 incorrectly limits these accesses to Secure
access only. This issue is documented in the Juno Errata
832219: APB port security breaks SBSA compliance
https://developer.arm.com/documentation/epm008857/latest

This results in a crash when the OS tries to access these registers.
Therefore, disable memory mapped platform timers for Juno R0.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Thomas Abraham <thomas.abraham@arm.com>
Cc: Sudeep Holla <Sudeep.Holla@arm.com>

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reported-by: Sudeep Holla <Sudeep.Holla@arm.com>
---
The changes can be seen at: https://github.com/samimujawar/edk2-platforms/tree/1496_junor0_disable_memmap_plat_timers_v1

 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 48 ++++++++++++--------
 1 file changed, 30 insertions(+), 18 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 48f0fd370f073c8fed1a649d8c4ab28b062a8290..91f035480dcfe81e93febfac2ef703d6c77737f1 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
 /** @file
   Configuration Manager Dxe
 
-  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -1380,26 +1380,38 @@ GetArmNameSpaceObject (
       break;
 
     case EArmObjPlatformGTBlockInfo:
-      Status = HandleCmObject (
-                 CmObjectId,
-                 PlatformRepo->GTBlockInfo,
-                 sizeof (PlatformRepo->GTBlockInfo),
-                 ARRAY_SIZE (PlatformRepo->GTBlockInfo),
-                 CmObject
-                 );
+      if (PlatformRepo->JunoRevision == JUNO_REVISION_R0) {
+        // Disable Memory Mapped Platform Timers for Juno R0
+        // due to Juno Erratum 832219.
+        Status = EFI_NOT_FOUND;
+      } else {
+        Status = HandleCmObject (
+                   CmObjectId,
+                   PlatformRepo->GTBlockInfo,
+                   sizeof (PlatformRepo->GTBlockInfo),
+                   ARRAY_SIZE (PlatformRepo->GTBlockInfo),
+                   CmObject
+                  );
+      }
       break;
 
     case EArmObjGTBlockTimerFrameInfo:
-      Status = HandleCmObjectRefByToken (
-                 This,
-                 CmObjectId,
-                 PlatformRepo->GTBlock0TimerInfo,
-                 sizeof (PlatformRepo->GTBlock0TimerInfo),
-                 ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
-                 Token,
-                 GetGTBlockTimerFrameInfo,
-                 CmObject
-                 );
+      if (PlatformRepo->JunoRevision == JUNO_REVISION_R0) {
+        // Disable Memory Mapped Platform Timers for Juno R0
+        // due to Juno Erratum 832219.
+        Status = EFI_NOT_FOUND;
+      } else {
+        Status = HandleCmObjectRefByToken (
+                   This,
+                   CmObjectId,
+                   PlatformRepo->GTBlock0TimerInfo,
+                   sizeof (PlatformRepo->GTBlock0TimerInfo),
+                   ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
+                   Token,
+                   GetGTBlockTimerFrameInfo,
+                   CmObject
+                   );
+      }
       break;
 
     case EArmObjGicCInfo:
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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

* Re: [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0
  2023-06-16 12:40 [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0 Sami Mujawar
@ 2023-06-16 12:56 ` Sudeep Holla
  2023-06-28 10:56 ` PierreGondois
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2023-06-16 12:56 UTC (permalink / raw)
  To: Sami Mujawar
  Cc: devel, ardb+tianocore, thomas.abraham, Pierre.Gondois,
	Matteo.Carlini, Akanksha.Jain2, Ben.Adderson, Sibel.Allinson, nd

On Fri, Jun 16, 2023 at 01:40:59PM +0100, Sami Mujawar wrote:
> Juno includes a system-level wakeup timer which is an implementation
> of the ARM Generic Timer architecture.
> The CNTCTL frame contains some registers that are accessible using a
> Non-Secure access. Juno R0 incorrectly limits these accesses to Secure
> access only. This issue is documented in the Juno Errata
> 832219: APB port security breaks SBSA compliance
> https://developer.arm.com/documentation/epm008857/latest
> 
> This results in a crash when the OS tries to access these registers.
> Therefore, disable memory mapped platform timers for Juno R0.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Thomas Abraham <thomas.abraham@arm.com>
> Cc: Sudeep Holla <Sudeep.Holla@arm.com>
>

Tested-by: Sudeep Holla <Sudeep.Holla@arm.com>

(fixes the ACPI based Linux boot on Juno R0 platform)


-- 
Regards,
Sudeep

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

* Re: [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0
  2023-06-16 12:40 [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0 Sami Mujawar
  2023-06-16 12:56 ` Sudeep Holla
@ 2023-06-28 10:56 ` PierreGondois
  1 sibling, 0 replies; 3+ messages in thread
From: PierreGondois @ 2023-06-28 10:56 UTC (permalink / raw)
  To: Sami Mujawar, devel
  Cc: ardb+tianocore, thomas.abraham, Sudeep.Holla, Matteo.Carlini,
	Akanksha.Jain2, Ben.Adderson, Sibel.Allinson, nd

Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>

On 6/16/23 14:40, Sami Mujawar wrote:
> Juno includes a system-level wakeup timer which is an implementation
> of the ARM Generic Timer architecture.
> The CNTCTL frame contains some registers that are accessible using a
> Non-Secure access. Juno R0 incorrectly limits these accesses to Secure
> access only. This issue is documented in the Juno Errata
> 832219: APB port security breaks SBSA compliance
> https://developer.arm.com/documentation/epm008857/latest
> 
> This results in a crash when the OS tries to access these registers.
> Therefore, disable memory mapped platform timers for Juno R0.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Thomas Abraham <thomas.abraham@arm.com>
> Cc: Sudeep Holla <Sudeep.Holla@arm.com>
> 
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
> Reported-by: Sudeep Holla <Sudeep.Holla@arm.com>
> ---
> The changes can be seen at: https://github.com/samimujawar/edk2-platforms/tree/1496_junor0_disable_memmap_plat_timers_v1
> 
>   Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 48 ++++++++++++--------
>   1 file changed, 30 insertions(+), 18 deletions(-)
> 
> diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> index 48f0fd370f073c8fed1a649d8c4ab28b062a8290..91f035480dcfe81e93febfac2ef703d6c77737f1 100644
> --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> @@ -1,7 +1,7 @@
>   /** @file
>     Configuration Manager Dxe
>   
> -  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
> +  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.<BR>
>   
>     SPDX-License-Identifier: BSD-2-Clause-Patent
>   
> @@ -1380,26 +1380,38 @@ GetArmNameSpaceObject (
>         break;
>   
>       case EArmObjPlatformGTBlockInfo:
> -      Status = HandleCmObject (
> -                 CmObjectId,
> -                 PlatformRepo->GTBlockInfo,
> -                 sizeof (PlatformRepo->GTBlockInfo),
> -                 ARRAY_SIZE (PlatformRepo->GTBlockInfo),
> -                 CmObject
> -                 );
> +      if (PlatformRepo->JunoRevision == JUNO_REVISION_R0) {
> +        // Disable Memory Mapped Platform Timers for Juno R0
> +        // due to Juno Erratum 832219.
> +        Status = EFI_NOT_FOUND;
> +      } else {
> +        Status = HandleCmObject (
> +                   CmObjectId,
> +                   PlatformRepo->GTBlockInfo,
> +                   sizeof (PlatformRepo->GTBlockInfo),
> +                   ARRAY_SIZE (PlatformRepo->GTBlockInfo),
> +                   CmObject
> +                  );
> +      }
>         break;
>   
>       case EArmObjGTBlockTimerFrameInfo:
> -      Status = HandleCmObjectRefByToken (
> -                 This,
> -                 CmObjectId,
> -                 PlatformRepo->GTBlock0TimerInfo,
> -                 sizeof (PlatformRepo->GTBlock0TimerInfo),
> -                 ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
> -                 Token,
> -                 GetGTBlockTimerFrameInfo,
> -                 CmObject
> -                 );
> +      if (PlatformRepo->JunoRevision == JUNO_REVISION_R0) {
> +        // Disable Memory Mapped Platform Timers for Juno R0
> +        // due to Juno Erratum 832219.
> +        Status = EFI_NOT_FOUND;
> +      } else {
> +        Status = HandleCmObjectRefByToken (
> +                   This,
> +                   CmObjectId,
> +                   PlatformRepo->GTBlock0TimerInfo,
> +                   sizeof (PlatformRepo->GTBlock0TimerInfo),
> +                   ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
> +                   Token,
> +                   GetGTBlockTimerFrameInfo,
> +                   CmObject
> +                   );
> +      }
>         break;
>   
>       case EArmObjGicCInfo:

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

end of thread, other threads:[~2023-06-28 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16 12:40 [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0 Sami Mujawar
2023-06-16 12:56 ` Sudeep Holla
2023-06-28 10:56 ` PierreGondois

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