public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb
@ 2021-05-10  7:53 Etienne Carriere
  2021-05-10  7:53 ` [edk2-platforms][PATCH 1/4] sync with edk2 where StandaloneMmCpu moved to AArch64/ parent directory Etienne Carriere
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Etienne Carriere @ 2021-05-10  7:53 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sami Mujawar,
	Sughosh Ganu, Thomas Abraham, Etienne Carriere

This series brings support for building PlatformStandaloneMmRpmb for
32bit Arm architectures. This series is based on series [1] in edk2
that allows to build StandaloneMm package for 32bit Arm. This series
starts by syncing with paths changes from [1] series, then comes
changes for Arm 32bit support in OpTee drivers and last updates
PlatformStandaloneMmRpmb.dsc for 32bit the ARM architure.

[1] https://edk2.groups.io/g/devel/message/74734

Etienne Carriere (4):
  sync with edk2 where StandaloneMmCpu moved to AArch64/ parent
    directory
  Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
  Drivers/OpTee: address cast build warning issue in 32b mode
  Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures

 Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c     | 23 ++++++++++++-------
 Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h     | 16 +++++++++++--
 Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc  |  2 +-
 Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf  |  2 +-
 .../Socionext/DeveloperBox/DeveloperBoxMm.dsc |  2 +-
 .../Socionext/DeveloperBox/DeveloperBoxMm.fdf |  2 +-
 .../PlatformStandaloneMmRpmb.dsc              | 14 +++++++++--
 .../PlatformStandaloneMmRpmb.fdf              |  3 ++-
 8 files changed, 47 insertions(+), 17 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [edk2-platforms][PATCH 1/4] sync with edk2 where StandaloneMmCpu moved to AArch64/ parent directory
  2021-05-10  7:53 [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Etienne Carriere
@ 2021-05-10  7:53 ` Etienne Carriere
  2021-05-12 10:11   ` Sami Mujawar
  2021-05-10  7:53 ` [edk2-platforms][PATCH 2/4] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Etienne Carriere @ 2021-05-10  7:53 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sami Mujawar,
	Sughosh Ganu, Thomas Abraham, Etienne Carriere

Synchronize with edk2 package where StandaloneMmCpu component has moved
from StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
to StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Thomas Abraham <thomas.abraham@arm.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
 Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc                               | 2 +-
 Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf                               | 2 +-
 Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc                         | 2 +-
 Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf                         | 2 +-
 Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 2 +-
 Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf | 3 ++-
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
index e281d54909..1e0af23711 100644
--- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
+++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
@@ -122,7 +122,7 @@
   StandaloneMmPkg/Core/StandaloneMmCore.inf
 
 [Components.AARCH64]
-  StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
+  StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
 
 ###################################################################################################
 #
diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf b/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf
index 5a0772cd85..96b4272dd6 100644
--- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf
+++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf
@@ -49,7 +49,7 @@ READ_LOCK_CAP      = TRUE
 READ_LOCK_STATUS   = TRUE
 
   INF StandaloneMmPkg/Core/StandaloneMmCore.inf
-  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
+  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
 
 ################################################################################
 #
diff --git a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
index e078de4bbb..b5524f87a6 100644
--- a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
+++ b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
@@ -80,7 +80,7 @@
       gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2
   }
 
-  StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
+  StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
   Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf {
diff --git a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf
index 33de03c8e7..89453477c9 100644
--- a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf
+++ b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf
@@ -111,7 +111,7 @@ READ_LOCK_STATUS   = TRUE
   INF Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf
   INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
   INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
-  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
+  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
 
 ################################################################################
 #
diff --git a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
index f99a47ebf6..cb3f1ddf52 100644
--- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
+++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
@@ -133,7 +133,7 @@
   #
   Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFv.inf
   StandaloneMmPkg/Core/StandaloneMmCore.inf
-  StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
+  StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf {
     <LibraryClasses>
       NULL|Drivers/OpTee/OpteeRpmbPkg/FixupPcd.inf
diff --git a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
index e175dc7b2d..c4295a3e63 100644
--- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
+++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
@@ -68,7 +68,8 @@ READ_LOCK_STATUS   = TRUE
   INF Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFv.inf
   INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
   INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
-  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
+  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
+
 ################################################################################
 #
 # Rules are use with the [FV] section's module INF type to define
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [edk2-platforms][PATCH 2/4] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
  2021-05-10  7:53 [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Etienne Carriere
  2021-05-10  7:53 ` [edk2-platforms][PATCH 1/4] sync with edk2 where StandaloneMmCpu moved to AArch64/ parent directory Etienne Carriere
@ 2021-05-10  7:53 ` Etienne Carriere
  2021-05-12 10:11   ` Sami Mujawar
  2021-05-10  7:53 ` [edk2-platforms][PATCH 3/4] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Etienne Carriere @ 2021-05-10  7:53 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sami Mujawar,
	Sughosh Ganu, Thomas Abraham, Etienne Carriere

Add SMCCC function IDs for RPMB read/write service on 32bit architectures.
Define generic SP_SVC_RPMB_READ/SP_SVC_RPMB_WRITE IDs for native target
architecture (32b or 64b).

Changes OpTeeRpmbFvb.c to use architecture agnostic macro
ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ for 32b and 64b support.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
 Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c |  2 +-
 Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
index 5197c95abd..6eb19bed0e 100644
--- a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
+++ b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
@@ -68,7 +68,7 @@ ReadWriteRpmb (
 
   ZeroMem (&SvcArgs, sizeof (SvcArgs));
 
-  SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64;
+  SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
   SvcArgs.Arg1 = mStorageId;
   SvcArgs.Arg2 = 0;
   SvcArgs.Arg3 = SvcAct;
diff --git a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h
index c17fc287ef..bf4a39b9db 100644
--- a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h
+++ b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h
@@ -13,8 +13,20 @@
  contract between OP-TEE and EDK2.
  For more details check core/arch/arm/include/kernel/stmm_sp.h in OP-TEE
 **/
-#define SP_SVC_RPMB_READ                0xC4000066
-#define SP_SVC_RPMB_WRITE               0xC4000067
+#define SP_SVC_RPMB_READ_64             0xC4000066
+#define SP_SVC_RPMB_WRITE_64            0xC4000067
+
+#define SP_SVC_RPMB_READ_32             0x84000066
+#define SP_SVC_RPMB_WRITE_32            0x84000067
+
+#ifdef MDE_CPU_AARCH64
+#define SP_SVC_RPMB_READ                SP_SVC_RPMB_READ_64
+#define SP_SVC_RPMB_WRITE               SP_SVC_RPMB_WRITE_64
+#endif
+#ifdef MDE_CPU_ARM
+#define SP_SVC_RPMB_READ                SP_SVC_RPMB_READ_32
+#define SP_SVC_RPMB_WRITE               SP_SVC_RPMB_WRITE_32
+#endif
 
 #define FLASH_SIGNATURE            SIGNATURE_32 ('r', 'p', 'm', 'b')
 #define INSTANCE_FROM_FVB_THIS(a)  CR (a, MEM_INSTANCE, FvbProtocol, \
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [edk2-platforms][PATCH 3/4] Drivers/OpTee: address cast build warning issue in 32b mode
  2021-05-10  7:53 [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Etienne Carriere
  2021-05-10  7:53 ` [edk2-platforms][PATCH 1/4] sync with edk2 where StandaloneMmCpu moved to AArch64/ parent directory Etienne Carriere
  2021-05-10  7:53 ` [edk2-platforms][PATCH 2/4] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
@ 2021-05-10  7:53 ` Etienne Carriere
  2021-05-12 10:24   ` Sami Mujawar
  2021-05-10  7:53 ` [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
  2021-05-10 15:57 ` [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Ard Biesheuvel
  4 siblings, 1 reply; 11+ messages in thread
From: Etienne Carriere @ 2021-05-10  7:53 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sami Mujawar,
	Sughosh Ganu, Thomas Abraham, Etienne Carriere

Use (UINTN) cast to cast physical or virtual address values to the
pointer size before casting from/to a pointer value.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
 Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
index 6eb19bed0e..83c2750368 100644
--- a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
+++ b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
@@ -305,7 +305,8 @@ OpTeeRpmbFvbRead (
     }
   }
 
-  Base = (VOID *)Instance->MemBaseAddress + (Lba * Instance->BlockSize) + Offset;
+  Base = (VOID *)(UINTN)Instance->MemBaseAddress + (Lba * Instance->BlockSize) +
+         Offset;
   // We could read the data from the RPMB instead of memory
   // The 2 copies should already be identical
   // Copy from memory image
@@ -387,7 +388,8 @@ OpTeeRpmbFvbWrite (
       return Status;
     }
   }
-  Base = (VOID *)Instance->MemBaseAddress + Lba * Instance->BlockSize + Offset;
+  Base = (VOID *)(UINTN)Instance->MemBaseAddress + (Lba * Instance->BlockSize) +
+         Offset;
   Status = ReadWriteRpmb (
              SP_SVC_RPMB_WRITE,
              (UINTN)Buffer,
@@ -477,7 +479,8 @@ OpTeeRpmbFvbErase (
       return EFI_INVALID_PARAMETER;
     }
     NumBytes = NumLba * Instance->BlockSize;
-    Base = (VOID *)Instance->MemBaseAddress + Start * Instance->BlockSize;
+    Base = (VOID *)(UINTN)Instance->MemBaseAddress +
+           (Start * Instance->BlockSize);
     Buf = AllocatePool (NumLba * Instance->BlockSize);
     if (Buf == NULL) {
       return EFI_DEVICE_ERROR;
@@ -689,7 +692,7 @@ InitializeFvAndVariableStoreHeaders (
     goto Exit;
   }
   // Install the combined header in memory
-  CopyMem ((VOID*)Instance->MemBaseAddress, Headers, HeadersLength);
+  CopyMem ((VOID*)(UINTN)Instance->MemBaseAddress, Headers, HeadersLength);
 
 Exit:
   FreePool (Headers);
@@ -747,14 +750,18 @@ FvbInitialize (
   // Read the file from disk and copy it to memory
   ReadEntireFlash (Instance);
 
-  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)Instance->MemBaseAddress;
+  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)Instance->MemBaseAddress;
   Status = ValidateFvHeader (FwVolHeader);
   if (EFI_ERROR (Status)) {
     // There is no valid header, so time to install one.
     DEBUG ((DEBUG_INFO, "%a: The FVB Header is not valid.\n", __FUNCTION__));
 
     // Reset memory
-    SetMem64 ((VOID *)Instance->MemBaseAddress, Instance->NBlocks * Instance->BlockSize, ~0UL);
+    SetMem64 (
+      (VOID *)(UINTN)Instance->MemBaseAddress,
+      Instance->NBlocks * Instance->BlockSize,
+      ~0UL
+      );
     DEBUG ((DEBUG_INFO, "%a: Erasing Flash.\n", __FUNCTION__));
     Status = ReadWriteRpmb (
                SP_SVC_RPMB_WRITE,
@@ -827,7 +834,7 @@ OpTeeRpmbFvbInit (
   mInstance.FvbProtocol.Write              = OpTeeRpmbFvbWrite;
   mInstance.FvbProtocol.Read               = OpTeeRpmbFvbRead;
 
-  mInstance.MemBaseAddress = (EFI_PHYSICAL_ADDRESS)Addr;
+  mInstance.MemBaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Addr;
   mInstance.Signature      = FLASH_SIGNATURE;
   mInstance.Initialize     = FvbInitialize;
   mInstance.BlockSize      = EFI_PAGE_SIZE;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
  2021-05-10  7:53 [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Etienne Carriere
                   ` (2 preceding siblings ...)
  2021-05-10  7:53 ` [edk2-platforms][PATCH 3/4] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
@ 2021-05-10  7:53 ` Etienne Carriere
  2021-05-12 10:13   ` Sami Mujawar
  2021-05-10 15:57 ` [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Ard Biesheuvel
  4 siblings, 1 reply; 11+ messages in thread
From: Etienne Carriere @ 2021-05-10  7:53 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sami Mujawar,
	Sughosh Ganu, Thomas Abraham, Etienne Carriere

Build PlatformStandaloneMmRpmb for ARM architecture (32bit arm machine).
The generated image targets an execution environment similar to AArch64
StMM secure partition in OP-TEE but in 32bit mode.

GCC flag -fno-stack-protector
added. The stack protection code bring
GOT dependencies we prefer avoid when StMM runs in OP-TEE.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
 Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
index cb3f1ddf52..996d4e4ba9 100644
--- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
+++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
@@ -16,7 +16,7 @@
   PLATFORM_VERSION               = 1.0
   DSC_SPECIFICATION              = 0x0001001C
   OUTPUT_DIRECTORY               = Build/$(PLATFORM_NAME)
-  SUPPORTED_ARCHITECTURES        = AARCH64
+  SUPPORTED_ARCHITECTURES        = ARM|AARCH64
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
   FLASH_DEFINITION               = Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
@@ -68,6 +68,12 @@
   #
   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
+[LibraryClasses.ARM]
+  ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
+  NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
+  NULL|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf
+  RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
+
 [LibraryClasses.common.MM_STANDALONE]
   HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
   MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
@@ -160,3 +166,7 @@
 [BuildOptions.AARCH64]
 GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv8-a+nofp
 GCC:*_*_*_CC_FLAGS = -mstrict-align
+
+[BuildOptions.ARM]
+GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv7-a
+GCC:*_*_*_CC_FLAGS = -fno-stack-protector
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb
  2021-05-10  7:53 [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Etienne Carriere
                   ` (3 preceding siblings ...)
  2021-05-10  7:53 ` [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
@ 2021-05-10 15:57 ` Ard Biesheuvel
  2021-05-10 18:04   ` Ilias Apalodimas
  4 siblings, 1 reply; 11+ messages in thread
From: Ard Biesheuvel @ 2021-05-10 15:57 UTC (permalink / raw)
  To: Etienne Carriere
  Cc: edk2-devel-groups-io, Ard Biesheuvel, Ilias Apalodimas,
	Leif Lindholm, Sami Mujawar, Sughosh Ganu, Thomas Abraham

On Mon, 10 May 2021 at 09:53, Etienne Carriere
<etienne.carriere@linaro.org> wrote:
>
> This series brings support for building PlatformStandaloneMmRpmb for
> 32bit Arm architectures. This series is based on series [1] in edk2
> that allows to build StandaloneMm package for 32bit Arm. This series
> starts by syncing with paths changes from [1] series, then comes
> changes for Arm 32bit support in OpTee drivers and last updates
> PlatformStandaloneMmRpmb.dsc for 32bit the ARM architure.
>
> [1] https://edk2.groups.io/g/devel/message/74734
>
> Etienne Carriere (4):
>   sync with edk2 where StandaloneMmCpu moved to AArch64/ parent
>     directory
>   Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
>   Drivers/OpTee: address cast build warning issue in 32b mode
>   Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
>

This looks fine to me

Acked-by: Ard Biesheuvel <ardb@kernel.org>

I'll pick these up once the EDK2 side is merged.

>  Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c     | 23 ++++++++++++-------
>  Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h     | 16 +++++++++++--
>  Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc  |  2 +-
>  Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf  |  2 +-
>  .../Socionext/DeveloperBox/DeveloperBoxMm.dsc |  2 +-
>  .../Socionext/DeveloperBox/DeveloperBoxMm.fdf |  2 +-
>  .../PlatformStandaloneMmRpmb.dsc              | 14 +++++++++--
>  .../PlatformStandaloneMmRpmb.fdf              |  3 ++-
>  8 files changed, 47 insertions(+), 17 deletions(-)
>
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb
  2021-05-10 15:57 ` [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Ard Biesheuvel
@ 2021-05-10 18:04   ` Ilias Apalodimas
  0 siblings, 0 replies; 11+ messages in thread
From: Ilias Apalodimas @ 2021-05-10 18:04 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Etienne Carriere, edk2-devel-groups-io, Ard Biesheuvel,
	Leif Lindholm, Sami Mujawar, Sughosh Ganu, Thomas Abraham

On Mon, May 10, 2021 at 05:57:08PM +0200, Ard Biesheuvel wrote:
> On Mon, 10 May 2021 at 09:53, Etienne Carriere
> <etienne.carriere@linaro.org> wrote:
> >
> > This series brings support for building PlatformStandaloneMmRpmb for
> > 32bit Arm architectures. This series is based on series [1] in edk2
> > that allows to build StandaloneMm package for 32bit Arm. This series
> > starts by syncing with paths changes from [1] series, then comes
> > changes for Arm 32bit support in OpTee drivers and last updates
> > PlatformStandaloneMmRpmb.dsc for 32bit the ARM architure.
> >
> > [1] https://edk2.groups.io/g/devel/message/74734
> >
> > Etienne Carriere (4):
> >   sync with edk2 where StandaloneMmCpu moved to AArch64/ parent
> >     directory
> >   Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
> >   Drivers/OpTee: address cast build warning issue in 32b mode
> >   Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
> >
> 
> This looks fine to me
> 
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> 
> I'll pick these up once the EDK2 side is merged.
> 

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> >  Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c     | 23 ++++++++++++-------
> >  Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h     | 16 +++++++++++--
> >  Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc  |  2 +-
> >  Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf  |  2 +-
> >  .../Socionext/DeveloperBox/DeveloperBoxMm.dsc |  2 +-
> >  .../Socionext/DeveloperBox/DeveloperBoxMm.fdf |  2 +-
> >  .../PlatformStandaloneMmRpmb.dsc              | 14 +++++++++--
> >  .../PlatformStandaloneMmRpmb.fdf              |  3 ++-
> >  8 files changed, 47 insertions(+), 17 deletions(-)
> >
> > --
> > 2.17.1
> >

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-platforms][PATCH 1/4] sync with edk2 where StandaloneMmCpu moved to AArch64/ parent directory
  2021-05-10  7:53 ` [edk2-platforms][PATCH 1/4] sync with edk2 where StandaloneMmCpu moved to AArch64/ parent directory Etienne Carriere
@ 2021-05-12 10:11   ` Sami Mujawar
  0 siblings, 0 replies; 11+ messages in thread
From: Sami Mujawar @ 2021-05-12 10:11 UTC (permalink / raw)
  To: Etienne Carriere, devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
	Thomas Abraham, nd

Hi Etienne,

Thank you for this patch.

I would have prefered this patch split in 3 parts (for SgiPkg, Socionext 
and Platform/StandaloneMm). In either case the changes look good to me.

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

Regards,

Sami Mujawar


On 10/05/2021 08:53 AM, Etienne Carriere wrote:
> Synchronize with edk2 package where StandaloneMmCpu component has moved
> from StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> to StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
> Cc: Thomas Abraham <thomas.abraham@arm.com>
> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
> ---
>   Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc                               | 2 +-
>   Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf                               | 2 +-
>   Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc                         | 2 +-
>   Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf                         | 2 +-
>   Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 2 +-
>   Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf | 3 ++-
>   6 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> index e281d54909..1e0af23711 100644
> --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc
> @@ -122,7 +122,7 @@
>     StandaloneMmPkg/Core/StandaloneMmCore.inf
>   
>   [Components.AARCH64]
> -  StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> +  StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
>   
>   ###################################################################################################
>   #
> diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf b/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf
> index 5a0772cd85..96b4272dd6 100644
> --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf
> +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf
> @@ -49,7 +49,7 @@ READ_LOCK_CAP      = TRUE
>   READ_LOCK_STATUS   = TRUE
>   
>     INF StandaloneMmPkg/Core/StandaloneMmCore.inf
> -  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> +  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
>   
>   ################################################################################
>   #
> diff --git a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> index e078de4bbb..b5524f87a6 100644
> --- a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> +++ b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> @@ -80,7 +80,7 @@
>         gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2
>     }
>   
> -  StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> +  StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
>     Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf
>     MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
>     MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf {
> diff --git a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf
> index 33de03c8e7..89453477c9 100644
> --- a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf
> +++ b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf
> @@ -111,7 +111,7 @@ READ_LOCK_STATUS   = TRUE
>     INF Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf
>     INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
>     INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
> -  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> +  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
>   
>   ################################################################################
>   #
> diff --git a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> index f99a47ebf6..cb3f1ddf52 100644
> --- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> +++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> @@ -133,7 +133,7 @@
>     #
>     Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFv.inf
>     StandaloneMmPkg/Core/StandaloneMmCore.inf
> -  StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> +  StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
>     MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf {
>       <LibraryClasses>
>         NULL|Drivers/OpTee/OpteeRpmbPkg/FixupPcd.inf
> diff --git a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
> index e175dc7b2d..c4295a3e63 100644
> --- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
> +++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
> @@ -68,7 +68,8 @@ READ_LOCK_STATUS   = TRUE
>     INF Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFv.inf
>     INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
>     INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
> -  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> +  INF StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
> +
>   ################################################################################
>   #
>   # Rules are use with the [FV] section's module INF type to define


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-platforms][PATCH 2/4] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
  2021-05-10  7:53 ` [edk2-platforms][PATCH 2/4] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
@ 2021-05-12 10:11   ` Sami Mujawar
  0 siblings, 0 replies; 11+ messages in thread
From: Sami Mujawar @ 2021-05-12 10:11 UTC (permalink / raw)
  To: Etienne Carriere, devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
	Thomas Abraham, nd

Hi Etienne,

I have some minor suggestion marked inline as [SAMI].

With that addressed.

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

Regards,

Sami Mujawar

On 10/05/2021 08:53 AM, Etienne Carriere wrote:
> Add SMCCC function IDs for RPMB read/write service on 32bit architectures.
> Define generic SP_SVC_RPMB_READ/SP_SVC_RPMB_WRITE IDs for native target
> architecture (32b or 64b).
>
> Changes OpTeeRpmbFvb.c to use architecture agnostic macro
> ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ for 32b and 64b support.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
> ---
>   Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c |  2 +-
>   Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h | 16 ++++++++++++++--
>   2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
> index 5197c95abd..6eb19bed0e 100644
> --- a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
> +++ b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
> @@ -68,7 +68,7 @@ ReadWriteRpmb (
>   
>     ZeroMem (&SvcArgs, sizeof (SvcArgs));
>   
> -  SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64;
> +  SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
>     SvcArgs.Arg1 = mStorageId;
>     SvcArgs.Arg2 = 0;
>     SvcArgs.Arg3 = SvcAct;
> diff --git a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h
> index c17fc287ef..bf4a39b9db 100644
> --- a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h
> +++ b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.h
> @@ -13,8 +13,20 @@
>    contract between OP-TEE and EDK2.
>    For more details check core/arch/arm/include/kernel/stmm_sp.h in OP-TEE
>   **/
> -#define SP_SVC_RPMB_READ                0xC4000066
> -#define SP_SVC_RPMB_WRITE               0xC4000067
> +#define SP_SVC_RPMB_READ_64             0xC4000066
> +#define SP_SVC_RPMB_WRITE_64            0xC4000067
> +
> +#define SP_SVC_RPMB_READ_32             0x84000066
> +#define SP_SVC_RPMB_WRITE_32            0x84000067
[SAMI] Is it possible to change the _64 and _32 postfixes to AARCH64 and 
AARCH32 appropriately, please?
[/SAMI]
> +
> +#ifdef MDE_CPU_AARCH64
> +#define SP_SVC_RPMB_READ                SP_SVC_RPMB_READ_64
> +#define SP_SVC_RPMB_WRITE               SP_SVC_RPMB_WRITE_64
> +#endif
> +#ifdef MDE_CPU_ARM
> +#define SP_SVC_RPMB_READ                SP_SVC_RPMB_READ_32
> +#define SP_SVC_RPMB_WRITE               SP_SVC_RPMB_WRITE_32
> +#endif
>   
>   #define FLASH_SIGNATURE            SIGNATURE_32 ('r', 'p', 'm', 'b')
>   #define INSTANCE_FROM_FVB_THIS(a)  CR (a, MEM_INSTANCE, FvbProtocol, \


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
  2021-05-10  7:53 ` [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
@ 2021-05-12 10:13   ` Sami Mujawar
  0 siblings, 0 replies; 11+ messages in thread
From: Sami Mujawar @ 2021-05-12 10:13 UTC (permalink / raw)
  To: Etienne Carriere, devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
	Thomas Abraham, nd

Hi Etienn,

Thank you for this patch.

Please find my feedback inline marked [SAMI] .

With those fixed.

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

Regards,

Sami Mujawar
On 10/05/2021 08:53 AM, Etienne Carriere wrote:
> Build PlatformStandaloneMmRpmb for ARM architecture (32bit arm machine).
> The generated image targets an execution environment similar to AArch64
> StMM secure partition in OP-TEE but in 32bit mode.
>
> GCC flag -fno-stack-protector
> added. The stack protection code bring
> GOT dependencies we prefer avoid when StMM runs in OP-TEE.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
> ---
>   Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> index cb3f1ddf52..996d4e4ba9 100644
> --- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> +++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> @@ -16,7 +16,7 @@
>     PLATFORM_VERSION               = 1.0
>     DSC_SPECIFICATION              = 0x0001001C
>     OUTPUT_DIRECTORY               = Build/$(PLATFORM_NAME)
> -  SUPPORTED_ARCHITECTURES        = AARCH64
> +  SUPPORTED_ARCHITECTURES        = ARM|AARCH64
>     BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>     SKUID_IDENTIFIER               = DEFAULT
>     FLASH_DEFINITION               = Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf
> @@ -68,6 +68,12 @@
>     #
>     NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
>   
> +[LibraryClasses.ARM]
> +  ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
> +  NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
[SAMI] I think BaseStackCheckLib.inf can be moved to the 
[LibraryClasses] section, right?
[/SAMI]
> +  NULL|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf
[SAMI] ArmSvcLib.inf is already present in the [LibraryClasses] section.
[/SAMI]
> +  RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
[SAMI] I think 'MdePkg/MdeLibs.dsc.inc' can be included instead, right 
after the [Defines] section.
This will also fix the build failure for AARCH64.
[/SAMI]
> +
>   [LibraryClasses.common.MM_STANDALONE]
>     HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
>     MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
> @@ -160,3 +166,7 @@
>   [BuildOptions.AARCH64]
>   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv8-a+nofp
>   GCC:*_*_*_CC_FLAGS = -mstrict-align
> +
> +[BuildOptions.ARM]
> +GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 -march=armv7-a
> +GCC:*_*_*_CC_FLAGS = -fno-stack-protector


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [edk2-platforms][PATCH 3/4] Drivers/OpTee: address cast build warning issue in 32b mode
  2021-05-10  7:53 ` [edk2-platforms][PATCH 3/4] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
@ 2021-05-12 10:24   ` Sami Mujawar
  0 siblings, 0 replies; 11+ messages in thread
From: Sami Mujawar @ 2021-05-12 10:24 UTC (permalink / raw)
  To: Etienne Carriere, devel
  Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
	Thomas Abraham

Hi Etienn,

Thank you for this patch.

These changes look good to me.

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

Regards,

Sami Mujawar

On 10/05/2021 08:53 AM, Etienne Carriere wrote:
> Use (UINTN) cast to cast physical or virtual address values to the
> pointer size before casting from/to a pointer value.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
> ---
>   Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c | 21 +++++++++++++-------
>   1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
> index 6eb19bed0e..83c2750368 100644
> --- a/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
> +++ b/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c
> @@ -305,7 +305,8 @@ OpTeeRpmbFvbRead (
>       }
>     }
>
> -  Base = (VOID *)Instance->MemBaseAddress + (Lba * Instance->BlockSize) + Offset;
> +  Base = (VOID *)(UINTN)Instance->MemBaseAddress + (Lba * Instance->BlockSize) +
> +         Offset;
>     // We could read the data from the RPMB instead of memory
>     // The 2 copies should already be identical
>     // Copy from memory image
> @@ -387,7 +388,8 @@ OpTeeRpmbFvbWrite (
>         return Status;
>       }
>     }
> -  Base = (VOID *)Instance->MemBaseAddress + Lba * Instance->BlockSize + Offset;
> +  Base = (VOID *)(UINTN)Instance->MemBaseAddress + (Lba * Instance->BlockSize) +
> +         Offset;
>     Status = ReadWriteRpmb (
>                SP_SVC_RPMB_WRITE,
>                (UINTN)Buffer,
> @@ -477,7 +479,8 @@ OpTeeRpmbFvbErase (
>         return EFI_INVALID_PARAMETER;
>       }
>       NumBytes = NumLba * Instance->BlockSize;
> -    Base = (VOID *)Instance->MemBaseAddress + Start * Instance->BlockSize;
> +    Base = (VOID *)(UINTN)Instance->MemBaseAddress +
> +           (Start * Instance->BlockSize);
>       Buf = AllocatePool (NumLba * Instance->BlockSize);
>       if (Buf == NULL) {
>         return EFI_DEVICE_ERROR;
> @@ -689,7 +692,7 @@ InitializeFvAndVariableStoreHeaders (
>       goto Exit;
>     }
>     // Install the combined header in memory
> -  CopyMem ((VOID*)Instance->MemBaseAddress, Headers, HeadersLength);
> +  CopyMem ((VOID*)(UINTN)Instance->MemBaseAddress, Headers, HeadersLength);
>
>   Exit:
>     FreePool (Headers);
> @@ -747,14 +750,18 @@ FvbInitialize (
>     // Read the file from disk and copy it to memory
>     ReadEntireFlash (Instance);
>
> -  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)Instance->MemBaseAddress;
> +  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)Instance->MemBaseAddress;
>     Status = ValidateFvHeader (FwVolHeader);
>     if (EFI_ERROR (Status)) {
>       // There is no valid header, so time to install one.
>       DEBUG ((DEBUG_INFO, "%a: The FVB Header is not valid.\n", __FUNCTION__));
>
>       // Reset memory
> -    SetMem64 ((VOID *)Instance->MemBaseAddress, Instance->NBlocks * Instance->BlockSize, ~0UL);
> +    SetMem64 (
> +      (VOID *)(UINTN)Instance->MemBaseAddress,
> +      Instance->NBlocks * Instance->BlockSize,
> +      ~0UL
> +      );
>       DEBUG ((DEBUG_INFO, "%a: Erasing Flash.\n", __FUNCTION__));
>       Status = ReadWriteRpmb (
>                  SP_SVC_RPMB_WRITE,
> @@ -827,7 +834,7 @@ OpTeeRpmbFvbInit (
>     mInstance.FvbProtocol.Write              = OpTeeRpmbFvbWrite;
>     mInstance.FvbProtocol.Read               = OpTeeRpmbFvbRead;
>
> -  mInstance.MemBaseAddress = (EFI_PHYSICAL_ADDRESS)Addr;
> +  mInstance.MemBaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Addr;
>     mInstance.Signature      = FLASH_SIGNATURE;
>     mInstance.Initialize     = FvbInitialize;
>     mInstance.BlockSize      = EFI_PAGE_SIZE;

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-05-12 10:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-10  7:53 [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Etienne Carriere
2021-05-10  7:53 ` [edk2-platforms][PATCH 1/4] sync with edk2 where StandaloneMmCpu moved to AArch64/ parent directory Etienne Carriere
2021-05-12 10:11   ` Sami Mujawar
2021-05-10  7:53 ` [edk2-platforms][PATCH 2/4] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
2021-05-12 10:11   ` Sami Mujawar
2021-05-10  7:53 ` [edk2-platforms][PATCH 3/4] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
2021-05-12 10:24   ` Sami Mujawar
2021-05-10  7:53 ` [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
2021-05-12 10:13   ` Sami Mujawar
2021-05-10 15:57 ` [edk2-platforms][PATCH 0/4] Arm 32bit support in StandaloneMmRpmb Ard Biesheuvel
2021-05-10 18:04   ` Ilias Apalodimas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox