public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: <devel@edk2.groups.io>
Cc: Sami Mujawar <sami.mujawar@arm.com>, <ardb+tianocore@kernel.org>,
	<thomas.abraham@arm.com>, <Sudeep.Holla@arm.com>,
	<Pierre.Gondois@arm.com>, <Matteo.Carlini@arm.com>,
	<Akanksha.Jain2@arm.com>, <Ben.Adderson@arm.com>,
	<Sibel.Allinson@arm.com>, <nd@arm.com>
Subject: [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0
Date: Fri, 16 Jun 2023 13:40:59 +0100	[thread overview]
Message-ID: <20230616124059.19524-1-sami.mujawar@arm.com> (raw)

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)'


             reply	other threads:[~2023-06-16 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16 12:40 Sami Mujawar [this message]
2023-06-16 12:56 ` [PATCH edk2-platforms v1 1/1] Platform/Arm: Disable memmap platform timers for JunoR0 Sudeep Holla
2023-06-28 10:56 ` PierreGondois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230616124059.19524-1-sami.mujawar@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox