From: Achin Gupta <achin.gu...@arm.com>

This patch copies the value of the corresponding stack variable to a global
variable so that it can be used to determine whether FF-A v1.1 or earlier
ABIs should be used for communication with the SPMC.

Signed-off-by: Achin Gupta <achin.gu...@arm.com>
Signed-off-by: Nishant Sharma <nishant.sha...@arm.com>
---
 
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
index 8131b1984969..a763bf8509b2 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
@@ -42,6 +42,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define FFA_PAGE_16K 1
 #define FFA_PAGE_64K 2
 
+// Local variable to help Standalone MM Core decide whether FF-A ABIs can be
+// used for all communication. This variable is usable only after the StMM 
image
+// has been relocated and all image section permissions have been correctly
+// updated.
+STATIC BOOLEAN mUseOnlyFfaAbis = FALSE;
+
 PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT  CpuDriverEntryPoint = NULL;
 
 /**
@@ -639,6 +645,13 @@ InitArmSvcArgs (
   )
 {
   if (FixedPcdGet32 (PcdFfaEnable) != 0) {
+
+    // With FF-A v1.1 invoke FFA_MSG_WAIT to signal completion of SP init.
+    if (mUseOnlyFfaAbis) {
+      InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_WAIT_AARCH32;
+      return;
+    }
+
     InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP;
     InitMmFoundationSvcArgs->Arg1 = 0;
     InitMmFoundationSvcArgs->Arg2 = 0;
@@ -820,6 +833,9 @@ ModuleEntryPoint (
     ASSERT_EFI_ERROR (Status);
   }
 
+  // Update the global copy now that the image has been relocated.
+  mUseOnlyFfaAbis = UseOnlyFfaAbis;
+
   //
   // Create Hoblist based upon boot information passed by privileged software
   //
-- 
2.34.1



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


Reply via email to