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>, <Pierre.gondois@arm.com>,
	<Anshuman.Khandual@arm.com>, <Matteo.Carlini@arm.com>,
	<Akanksha.Jain2@arm.com>, <Sibel.Allinson@arm.com>, <nd@arm.com>
Subject: [edk2-devel] [PATCH edk2-platforms v1 3/3] Platform/ARM: FVP: Add ETE device if supported by FVP
Date: Tue, 25 Jul 2023 11:31:05 +0100	[thread overview]
Message-ID: <20230725103105.8068-4-sami.mujawar@arm.com> (raw)
In-Reply-To: <20230725103105.8068-1-sami.mujawar@arm.com>

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>
---
 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 03393905be1c627b7cdbaa0efed33e920072c8cb..86d5bbdb6219294d41b4ac314cc01139f975dc48 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 (#107243): https://edk2.groups.io/g/devel/message/107243
Mute This Topic: https://groups.io/mt/100347411/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      parent reply	other threads:[~2023-07-25 10:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 10:31 [edk2-devel] [PATCH edk2-platforms v1 0/3] Platform/ARM: Add dynamic CPU node, TRBE & ETE support to FVP Sami Mujawar
2023-07-25 10:31 ` [edk2-devel] [PATCH edk2-platforms v1 1/3] Platform/ARM: Add dynamic CPU node generation for FVP Sami Mujawar
2023-07-25 10:31 ` [edk2-devel] [PATCH edk2-platforms v1 2/3] Platform/ARM: FVP: Specify TRBE interrupt in MADT GICC Sami Mujawar
2023-08-01 15:38   ` Jeshua Smith via groups.io
2023-08-03  6:48     ` Sami Mujawar
     [not found]   ` <17774C7EDBBD6733.29484@groups.io>
2023-08-02 21:48     ` Jeshua Smith via groups.io
2023-08-03  7:00       ` Sami Mujawar
2023-08-03 14:47         ` Jeshua Smith via groups.io
2023-08-06 13:04           ` Sami Mujawar
2023-07-25 10:31 ` Sami Mujawar [this message]

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=20230725103105.8068-4-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