[edk2-devel] [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures

Etienne Carriere posted 4 patches 4 years, 9 months ago
[edk2-devel] [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
Posted by Etienne Carriere 4 years, 9 months ago
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



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


Re: [edk2-devel] [edk2-platforms][PATCH 4/4] Platform/StandaloneMm: build StandaloneMmRpmb for 32bit architectures
Posted by Sami Mujawar 4 years, 9 months ago
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



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