[edk2-devel] [PATCH edk2-platforms v2 3/3] Platform/ARM: FVP: Add ETE device if supported by FVP

Sami Mujawar posted 3 patches 8 months, 2 weeks ago
There is a newer version of this series
[edk2-devel] [PATCH edk2-platforms v2 3/3] Platform/ARM: FVP: Add ETE device if supported by FVP
Posted by Sami Mujawar 8 months, 2 weeks ago
When ETE is enabled in the FVP model the firmware can check
the debug feature register ID_AA64DFR0_EL1.TraceVer field
to identify the presence of FEAT_ETE and add an ETE device
to the CPU node in the AML CPU hierarchy. This enables the
Operating System driver to probe and enable ETE support.

 Note: To enable ETE support in the FVP REvC model
    1. Build TF-A with the CTX_INCLUDE_AARCH32_REGS=0
       build flag set, otherwise this results in an
       exception when booting TF-A
    2. Set the model parameters to enable TRBE as this
       is required for ETE
        -C cluster0.has_trbe=1 -C cluster1.has_trbe=1
    3. Set the ETE plugin for the model
       --plugin <PLUGIN_PATH>\libete-plugin.[so|dll]

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---

Notes:
    v2:
    - No code change from v1 patch series.      [SAMI]

 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 25 ++++++++++++++++++++
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 221ccd44ca419edf030a0b37a6bbe64a1ab11273..b4855c6b6fdca0093744cad65cfabbb785a6c62c 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -366,6 +366,11 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
     FixedPcdGet32 (PcdPciBusMin),
     FixedPcdGet32 (PcdPciBusMax)
   },
+
+  // Embedded Trace device info
+  {
+    ArmEtTypeEte
+  }
 };
 
 /** A helper function for returning the Configuration Manager Objects.
@@ -478,6 +483,7 @@ InitializePlatformRepository (
   UINT64 DbgFeatures;
   UINTN  Index;
   UINT16 TrbeInterrupt;
+  CM_OBJECT_TOKEN EtToken;
 
   PlatformRepo = This->PlatRepoInfo;
 
@@ -497,6 +503,7 @@ InitializePlatformRepository (
   }
 
   TrbeInterrupt = 0;
+  EtToken = CM_NULL_TOKEN;
   DbgFeatures = ArmReadIdAA64Dfr0 ();
   DEBUG ((
     DEBUG_INFO,
@@ -510,8 +517,14 @@ InitializePlatformRepository (
     TrbeInterrupt = 31;
   }
 
+  // The ID_AA64DFR0_EL1.TraceVer field identifies the presence of FEAT_ETE.
+  if (((DbgFeatures >> 4) & 0xF) != 0) {
+    EtToken = (CM_OBJECT_TOKEN)&PlatformRepo->EtInfo;
+  }
+
   for (Index = 0; Index < PLAT_CPU_COUNT; Index++) {
     PlatformRepo->GicCInfo[Index].TrbeInterrupt = TrbeInterrupt;
+    PlatformRepo->GicCInfo[Index].EtToken = EtToken;
   }
 
   return EFI_SUCCESS;
@@ -983,6 +996,18 @@ GetArmNameSpaceObject (
                  );
       break;
 
+    case EArmObjEtInfo:
+      if (Token == (CM_OBJECT_TOKEN)&PlatformRepo->EtInfo) {
+        Status = HandleCmObject (
+                  CmObjectId,
+                  &PlatformRepo->EtInfo,
+                  sizeof (PlatformRepo->EtInfo),
+                  1,
+                  CmObject
+                  );
+      }
+      break;
+
     default: {
       Status = EFI_NOT_FOUND;
       DEBUG ((
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 1b52c2ebc7efb633c748f7316606e3dbe4e0b21c..be2b512911f897dc57328673ae4f4a2014ec20fb 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -171,6 +171,8 @@ typedef struct PlatformRepositoryInfo {
   /// PCI configuration space information
   CM_ARM_PCI_CONFIG_SPACE_INFO          PciConfigInfo;
 
+  CM_ARM_ET_INFO                        EtInfo;
+
   /// System ID
   UINT32                                SysId;
 } EDKII_PLATFORM_REPOSITORY_INFO;
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108596): https://edk2.groups.io/g/devel/message/108596
Mute This Topic: https://groups.io/mt/101335888/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-