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+tianoc...@kernel.org>
Cc: Thomas Abraham <thomas.abra...@arm.com>
Cc: Sudeep Holla <sudeep.ho...@arm.com>

Signed-off-by: Sami Mujawar <sami.muja...@arm.com>
Reported-by: Sudeep Holla <sudeep.ho...@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)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106149): https://edk2.groups.io/g/devel/message/106149
Mute This Topic: https://groups.io/mt/99569509/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to