* [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change
@ 2021-05-17 5:50 Etienne Carriere
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 2/6] Platform/Socionext/DeveloperBox: " Etienne Carriere
` (6 more replies)
0 siblings, 7 replies; 17+ messages in thread
From: Etienne Carriere @ 2021-05-17 5:50 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>
---
Changes since v1:
- split change in 3: this change relates to Platform/ARM/SgiPkg only.
---
Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 2 +-
Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf | 2 +-
2 files changed, 2 insertions(+), 2 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
################################################################################
#
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [edk2-platforms][PATCH v2 2/6] Platform/Socionext/DeveloperBox: sync with edk2 StandaloneMmCpu path change
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
@ 2021-05-17 5:50 ` Etienne Carriere
2021-05-18 14:42 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: " Etienne Carriere
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Etienne Carriere @ 2021-05-17 5:50 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>
---
Changes since v1:
- split change in 3: this change relates to DeveloperBox only.
---
Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc | 2 +-
Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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
################################################################################
#
--
2.17.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: sync with edk2 StandaloneMmCpu path change
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 2/6] Platform/Socionext/DeveloperBox: " Etienne Carriere
@ 2021-05-17 5:50 ` Etienne Carriere
2021-05-17 12:44 ` Ilias Apalodimas
2021-05-18 14:42 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
` (4 subsequent siblings)
6 siblings, 2 replies; 17+ messages in thread
From: Etienne Carriere @ 2021-05-17 5:50 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>
---
Changes since v1:
- split change in 3: this change relates to StandaloneMm package only.
---
Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 2 +-
Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
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] 17+ messages in thread
* [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 2/6] Platform/Socionext/DeveloperBox: " Etienne Carriere
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: " Etienne Carriere
@ 2021-05-17 5:50 ` Etienne Carriere
2021-05-17 12:45 ` Ilias Apalodimas
2021-05-18 14:42 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
` (3 subsequent siblings)
6 siblings, 2 replies; 17+ messages in thread
From: Etienne Carriere @ 2021-05-17 5:50 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>
---
Changes since v1:
- Use _AARCH64 (resp. _AARCH32) suffix instead of _64 (resp. _32) in
the added macros.
---
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..9c2a4ea6a5 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_AARCH64 0xC4000066
+#define SP_SVC_RPMB_WRITE_AARCH64 0xC4000067
+
+#define SP_SVC_RPMB_READ_AARCH32 0x84000066
+#define SP_SVC_RPMB_WRITE_AARCH32 0x84000067
+
+#ifdef MDE_CPU_AARCH64
+#define SP_SVC_RPMB_READ SP_SVC_RPMB_READ_AARCH64
+#define SP_SVC_RPMB_WRITE SP_SVC_RPMB_WRITE_AARCH64
+#endif
+#ifdef MDE_CPU_ARM
+#define SP_SVC_RPMB_READ SP_SVC_RPMB_READ_AARCH32
+#define SP_SVC_RPMB_WRITE SP_SVC_RPMB_WRITE_AARCH32
+#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] 17+ messages in thread
* [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
` (2 preceding siblings ...)
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
@ 2021-05-17 5:50 ` Etienne Carriere
2021-05-17 12:46 ` Ilias Apalodimas
2021-05-18 14:43 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
` (2 subsequent siblings)
6 siblings, 2 replies; 17+ messages in thread
From: Etienne Carriere @ 2021-05-17 5:50 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>
---
No change since v1
---
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] 17+ messages in thread
* [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
` (3 preceding siblings ...)
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
@ 2021-05-17 5:50 ` Etienne Carriere
2021-05-17 12:47 ` Ilias Apalodimas
2021-05-18 14:43 ` Sami Mujawar
2021-05-17 14:21 ` [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Thomas Abraham
2021-05-18 14:42 ` Sami Mujawar
6 siblings, 2 replies; 17+ messages in thread
From: Etienne Carriere @ 2021-05-17 5:50 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>
---
Changes since v1:
- Remove useless duplication of ArmSvcLib loading.
- Move BaseStackCheckLib to generic library classes instead of ARM only.
- include MdePkg/MdeLibs.dsc.inc
instead of loading
RegisterFilterLibNull.inf for ARM architecture.
---
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..33364deb1e 100644
--- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
+++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
@@ -16,12 +16,14 @@
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
DEFINE DEBUG_MESSAGE = TRUE
+!include MdePkg/MdeLibs.dsc.inc
+
################################################################################
#
# Library Class section - list of all Library Classes needed by this Platform.
@@ -39,6 +41,7 @@
FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf
HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
@@ -68,6 +71,9 @@
#
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+[LibraryClasses.ARM]
+ ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.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] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: sync with edk2 StandaloneMmCpu path change
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: " Etienne Carriere
@ 2021-05-17 12:44 ` Ilias Apalodimas
2021-05-18 14:42 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Ilias Apalodimas @ 2021-05-17 12:44 UTC (permalink / raw)
To: Etienne Carriere
Cc: devel, Ard Biesheuvel, Leif Lindholm, Sami Mujawar, Sughosh Ganu,
Thomas Abraham
On Mon, May 17, 2021 at 07:50:44AM +0200, 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>
> ---
> Changes since v1:
> - split change in 3: this change relates to StandaloneMm package only.
> ---
> Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 2 +-
> Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> 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
>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
@ 2021-05-17 12:45 ` Ilias Apalodimas
2021-05-18 14:42 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Ilias Apalodimas @ 2021-05-17 12:45 UTC (permalink / raw)
To: Etienne Carriere
Cc: devel, Ard Biesheuvel, Leif Lindholm, Sami Mujawar, Sughosh Ganu,
Thomas Abraham
On Mon, May 17, 2021 at 07:50:45AM +0200, 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>
> ---
> Changes since v1:
> - Use _AARCH64 (resp. _AARCH32) suffix instead of _64 (resp. _32) in
> the added macros.
> ---
> 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..9c2a4ea6a5 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_AARCH64 0xC4000066
> +#define SP_SVC_RPMB_WRITE_AARCH64 0xC4000067
> +
> +#define SP_SVC_RPMB_READ_AARCH32 0x84000066
> +#define SP_SVC_RPMB_WRITE_AARCH32 0x84000067
> +
> +#ifdef MDE_CPU_AARCH64
> +#define SP_SVC_RPMB_READ SP_SVC_RPMB_READ_AARCH64
> +#define SP_SVC_RPMB_WRITE SP_SVC_RPMB_WRITE_AARCH64
> +#endif
> +#ifdef MDE_CPU_ARM
> +#define SP_SVC_RPMB_READ SP_SVC_RPMB_READ_AARCH32
> +#define SP_SVC_RPMB_WRITE SP_SVC_RPMB_WRITE_AARCH32
> +#endif
>
> #define FLASH_SIGNATURE SIGNATURE_32 ('r', 'p', 'm', 'b')
> #define INSTANCE_FROM_FVB_THIS(a) CR (a, MEM_INSTANCE, FvbProtocol, \
> --
> 2.17.1
>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
@ 2021-05-17 12:46 ` Ilias Apalodimas
2021-05-18 14:43 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Ilias Apalodimas @ 2021-05-17 12:46 UTC (permalink / raw)
To: Etienne Carriere
Cc: devel, Ard Biesheuvel, Leif Lindholm, Sami Mujawar, Sughosh Ganu,
Thomas Abraham
On Mon, May 17, 2021 at 07:50:46AM +0200, 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>
> ---
> No change since v1
> ---
> 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
>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
@ 2021-05-17 12:47 ` Ilias Apalodimas
2021-05-18 14:43 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Ilias Apalodimas @ 2021-05-17 12:47 UTC (permalink / raw)
To: Etienne Carriere
Cc: devel, Ard Biesheuvel, Leif Lindholm, Sami Mujawar, Sughosh Ganu,
Thomas Abraham
On Mon, May 17, 2021 at 07:50:47AM +0200, 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>
> ---
> Changes since v1:
> - Remove useless duplication of ArmSvcLib loading.
> - Move BaseStackCheckLib to generic library classes instead of ARM only.
> - include MdePkg/MdeLibs.dsc.inc
> instead of loading
> RegisterFilterLibNull.inf for ARM architecture.
> ---
> 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..33364deb1e 100644
> --- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> +++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> @@ -16,12 +16,14 @@
> 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
> DEFINE DEBUG_MESSAGE = TRUE
>
> +!include MdePkg/MdeLibs.dsc.inc
> +
> ################################################################################
> #
> # Library Class section - list of all Library Classes needed by this Platform.
> @@ -39,6 +41,7 @@
> FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf
> HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
> IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
> + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
> MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
> MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
> PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> @@ -68,6 +71,9 @@
> #
> NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
>
> +[LibraryClasses.ARM]
> + ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.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
>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
` (4 preceding siblings ...)
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
@ 2021-05-17 14:21 ` Thomas Abraham
2021-05-18 14:42 ` Sami Mujawar
6 siblings, 0 replies; 17+ messages in thread
From: Thomas Abraham @ 2021-05-17 14:21 UTC (permalink / raw)
To: Etienne Carriere, devel@edk2.groups.io
Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sami Mujawar,
Sughosh Ganu, nd
On 5/17/21 11:20 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>
> ---
> Changes since v1:
> - split change in 3: this change relates to Platform/ARM/SgiPkg only.
> ---
> Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 2 +-
> Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Thomas Abraham <thomas.abraham@arm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
` (5 preceding siblings ...)
2021-05-17 14:21 ` [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Thomas Abraham
@ 2021-05-18 14:42 ` Sami Mujawar
6 siblings, 0 replies; 17+ messages in thread
From: Sami Mujawar @ 2021-05-18 14:42 UTC (permalink / raw)
To: Etienne Carriere, devel
Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
Thomas Abraham, nd
Hi Etienn,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 17/05/2021 06:50 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>
> ---
> Changes since v1:
> - split change in 3: this change relates to Platform/ARM/SgiPkg only.
> ---
> Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 2 +-
> Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf | 2 +-
> 2 files changed, 2 insertions(+), 2 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
>
> ################################################################################
> #
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 2/6] Platform/Socionext/DeveloperBox: sync with edk2 StandaloneMmCpu path change
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 2/6] Platform/Socionext/DeveloperBox: " Etienne Carriere
@ 2021-05-18 14:42 ` Sami Mujawar
0 siblings, 0 replies; 17+ messages in thread
From: Sami Mujawar @ 2021-05-18 14:42 UTC (permalink / raw)
To: Etienne Carriere, devel
Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
Thomas Abraham, nd
Hi Etienn,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 17/05/2021 06:50 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>
> ---
> Changes since v1:
> - split change in 3: this change relates to DeveloperBox only.
> ---
> Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc | 2 +-
> Platform/Socionext/DeveloperBox/DeveloperBoxMm.fdf | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> 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
>
> ################################################################################
> #
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: sync with edk2 StandaloneMmCpu path change
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: " Etienne Carriere
2021-05-17 12:44 ` Ilias Apalodimas
@ 2021-05-18 14:42 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Sami Mujawar @ 2021-05-18 14:42 UTC (permalink / raw)
To: Etienne Carriere, devel
Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
Thomas Abraham, nd
Hi Etienn,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 17/05/2021 06:50 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>
> ---
> Changes since v1:
> - split change in 3: this change relates to StandaloneMm package only.
> ---
> Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc | 2 +-
> Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.fdf | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> 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] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
2021-05-17 12:45 ` Ilias Apalodimas
@ 2021-05-18 14:42 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Sami Mujawar @ 2021-05-18 14:42 UTC (permalink / raw)
To: Etienne Carriere, devel
Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
Thomas Abraham, nd
Hi Etienn,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 17/05/2021 06:50 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>
> ---
> Changes since v1:
> - Use _AARCH64 (resp. _AARCH32) suffix instead of _64 (resp. _32) in
> the added macros.
> ---
> 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..9c2a4ea6a5 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_AARCH64 0xC4000066
> +#define SP_SVC_RPMB_WRITE_AARCH64 0xC4000067
> +
> +#define SP_SVC_RPMB_READ_AARCH32 0x84000066
> +#define SP_SVC_RPMB_WRITE_AARCH32 0x84000067
> +
> +#ifdef MDE_CPU_AARCH64
> +#define SP_SVC_RPMB_READ SP_SVC_RPMB_READ_AARCH64
> +#define SP_SVC_RPMB_WRITE SP_SVC_RPMB_WRITE_AARCH64
> +#endif
> +#ifdef MDE_CPU_ARM
> +#define SP_SVC_RPMB_READ SP_SVC_RPMB_READ_AARCH32
> +#define SP_SVC_RPMB_WRITE SP_SVC_RPMB_WRITE_AARCH32
> +#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] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
2021-05-17 12:46 ` Ilias Apalodimas
@ 2021-05-18 14:43 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Sami Mujawar @ 2021-05-18 14:43 UTC (permalink / raw)
To: Etienne Carriere, devel
Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
Thomas Abraham, nd
Hi Etienn,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 17/05/2021 06:50 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>
> ---
> No change since v1
> ---
> 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;
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
2021-05-17 12:47 ` Ilias Apalodimas
@ 2021-05-18 14:43 ` Sami Mujawar
1 sibling, 0 replies; 17+ messages in thread
From: Sami Mujawar @ 2021-05-18 14:43 UTC (permalink / raw)
To: Etienne Carriere, devel
Cc: Ard Biesheuvel, Ilias Apalodimas, Leif Lindholm, Sughosh Ganu,
Thomas Abraham, nd
Hi Etienn,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 17/05/2021 06:50 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>
> ---
> Changes since v1:
> - Remove useless duplication of ArmSvcLib loading.
> - Move BaseStackCheckLib to generic library classes instead of ARM only.
> - include MdePkg/MdeLibs.dsc.inc
> instead of loading
> RegisterFilterLibNull.inf for ARM architecture.
> ---
> 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..33364deb1e 100644
> --- a/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> +++ b/Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc
> @@ -16,12 +16,14 @@
> 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
> DEFINE DEBUG_MESSAGE = TRUE
>
> +!include MdePkg/MdeLibs.dsc.inc
> +
> ################################################################################
> #
> # Library Class section - list of all Library Classes needed by this Platform.
> @@ -39,6 +41,7 @@
> FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf
> HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
> IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
> + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
> MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
> MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
> PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> @@ -68,6 +71,9 @@
> #
> NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
>
> +[LibraryClasses.ARM]
> + ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.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
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2021-05-18 14:43 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-17 5:50 [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Etienne Carriere
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 2/6] Platform/Socionext/DeveloperBox: " Etienne Carriere
2021-05-18 14:42 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 3/6] Platform/StandaloneMm: " Etienne Carriere
2021-05-17 12:44 ` Ilias Apalodimas
2021-05-18 14:42 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 4/6] Drivers/OpTee: Add Aarch32 SVC IDs for 32bit Arm targets Etienne Carriere
2021-05-17 12:45 ` Ilias Apalodimas
2021-05-18 14:42 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 5/6] Drivers/OpTee: address cast build warning issue in 32b mode Etienne Carriere
2021-05-17 12:46 ` Ilias Apalodimas
2021-05-18 14:43 ` Sami Mujawar
2021-05-17 5:50 ` [edk2-platforms][PATCH v2 6/6] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures Etienne Carriere
2021-05-17 12:47 ` Ilias Apalodimas
2021-05-18 14:43 ` Sami Mujawar
2021-05-17 14:21 ` [edk2-platforms][PATCH v2 1/6] Platform/ARM/SgiPkg: sync with edk2 StandaloneMmCpu path change Thomas Abraham
2021-05-18 14:42 ` Sami Mujawar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox