public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3 00/14] Un-siloing Arm common code
@ 2021-11-11  0:24 Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 01/14] ArmPkg/ArmMmuBaseLib: Disallow STANDALONE_MM Bret Barkelew
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Bob Feng, Jiaxin Wu, Jiewen Yao, Leif Lindholm,
	Liming Gao, Maciej Rabeda, Michael D Kinney, Ray Ni, Sami Mujawar,
	Sean Brogan, Siyuan Fu, Supreeth Venkatesh, Yuwei Chen,
	Zhichao Gao, Zhiguang Liu

This series of patch commits moves a number of modules and libraries around in order
to better un-silo the Arm-specific code. Unnecessary abstractions were removed, some
duplicate code was abstracted, and generally things were cleaned up so that common
code (e.g. MdePkg, MdeModulePkg, StandaloneMmPkg) does not require ArmPkg or
ArmPlatformPkg.

Also, some things that were previously hidden away under ArmPkg are now located
with the core functionality or build tooling that makes sense for it.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>

Bret Barkelew (13):
  ArmPkg/ArmMmuBaseLib: Disallow STANDALONE_MM
  ArmPkg/ArmMmuStandaloneMmLib: Update to match ArmMmuLib
  ArmPkg/StandaloneMmCoreEntryPoint: Swap to ArmMmuLib
  ArmPkg: Disavow StandaloneMmMmuLib. It's just ArmMmuLib
  ArmPkg and MdePkg: Move the Arm CompilerIntrinsicsLib to MdePkg
  ArmPkg and BaseTools: Move the GccLto binaries from ArmPkg to
    BaseTools
  ArmPkg and MdePkg: Move the AsmMacroIoLib from ArmPkg to MdePkg
  MdePkg: Create the MMU access lib to abstract memory protection
    settings
  MdeModulePkg: Swap to MmuLib instead of Arm-specific lib
  StandaloneMmPkg: Switch to the MmuLib abstraction
  ArmPkg: Move the StandaloneMmCpu driver to ArmPkg
  StandaloneMmPkg: Add StandaloneMmCoreEntryNull to satisfy CI on all
    archs
  ArmPkg: Create an Arm-specific version of StandaloneMmCoreEntryPoint

Sean Brogan (1):
  ArmPkg: Add Basic MMU Lib for Arm silicon

 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/EventHandle.c                                   |   0
 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.c                               |   0
 ArmPkg/Library/MmuLib/MmuLib.c                                                                      | 120 ++++++++++++++++++++
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c                  |   0
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c                 |   0
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c     |   0
 ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c                                           |  67 +++++++++++
 MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c                                                      |   4 +-
 MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.c                                                      |  86 ++++++++++++++
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcmp_ms.c                                        |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy.c                                           |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy_ms.c                                        |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c                                           |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c                                        |   0
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.c             |  51 +++++++++
 StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c |  82 ++++++++++++-
 ArmPkg/ArmPkg.ci.yaml                                                                               |   3 +-
 ArmPkg/ArmPkg.dec                                                                                   |   4 -
 ArmPkg/ArmPkg.dsc                                                                                   |  14 ++-
 ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc                                                  |   2 +-
 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.h                               |   0
 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf                             |   0
 ArmPkg/Include/Library/StandaloneMmMmuLib.h                                                         |  36 ------
 ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf                                                          |   2 +-
 ArmPkg/Library/MmuLib/BaseMmuLib.inf                                                                |  30 +++++
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf       |   8 +-
 ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf                                         |   2 +-
 ArmPlatformPkg/ArmPlatformPkg.dsc                                                                   |   2 +-
 ArmVirtPkg/ArmVirt.dsc.inc                                                                          |   2 +-
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-aarch64.a                                           | Bin
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-aarch64.s                                           |   0
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-arm.a                                               | Bin
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-arm.s                                               |   0
 BaseTools/Conf/tools_def.template                                                                   |  19 ++--
 CryptoPkg/CryptoPkg.dsc                                                                             |   2 +-
 DynamicTablesPkg/DynamicTablesPkg.dsc                                                               |   2 +-
 EmbeddedPkg/EmbeddedPkg.dsc                                                                         |   2 +-
 FatPkg/FatPkg.dsc                                                                                   |   2 +-
 FmpDevicePkg/FmpDevicePkg.dsc                                                                       |   2 +-
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf                                                             |   4 +-
 MdeModulePkg/MdeModulePkg.dsc                                                                       |   5 +-
 {ArmPkg/Include => MdePkg/Include/AArch64}/AsmMacroIoLibV8.h                                        |   0
 {ArmPkg/Include => MdePkg/Include/Arm}/AsmMacroIoLib.h                                              |   0
 MdePkg/Include/Library/MmuLib.h                                                                     |  75 ++++++++++++
 MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf                                                    |  28 +++++
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/AArch64/Atomics.S                                  |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashldi3.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/clzsi2.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.S                                          |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.asm                                        |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divdi3.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divsi3.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.S                                         |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.asm                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm                                    |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.S                                         |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.asm                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.S                                         |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.asm                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.asm                                    |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/moddi3.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/modsi3.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/muldi3.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.S                                        |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.asm                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/sourcery.S                                     |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch.asm                                     |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch16.S                                     |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch32.S                                     |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch8.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switchu8.S                                     |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivdi3.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S                                   |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivsi3.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.S                                        |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.asm                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umoddi3.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umodsi3.S                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.S                                        |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.asm                                      |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.S                                       |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.asm                                     |   0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf                          |   1 -
 MdePkg/MdePkg.dec                                                                                   |   5 +
 MdePkg/MdePkg.dsc                                                                                   |   3 +
 NetworkPkg/NetworkPkg.dsc                                                                           |   2 +-
 RedfishPkg/RedfishPkg.dsc                                                                           |   2 +-
 SecurityPkg/SecurityPkg.dsc                                                                         |   2 +-
 ShellPkg/ShellPkg.dsc                                                                               |   2 +-
 SignedCapsulePkg/SignedCapsulePkg.dsc                                                               |   2 +-
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf                   |  25 ----
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf           |  32 ++++++
 StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf       |   3 +-
 StandaloneMmPkg/StandaloneMmPkg.dsc                                                                 |  14 ++-
 StandaloneMmPkg/{StandaloneMmPkg.dsc => StandaloneMmPkg.dsc.orig}                                   |  20 +++-
 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc                                             |   2 +-
 103 files changed, 649 insertions(+), 122 deletions(-)
 rename {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/EventHandle.c (100%)
 rename {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.c (100%)
 create mode 100644 ArmPkg/Library/MmuLib/MmuLib.c
 rename {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c (100%)
 rename {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c (100%)
 rename {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c (100%)
 create mode 100644 MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.c
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcmp_ms.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy_ms.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c (100%)
 create mode 100644 StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.c
 rename {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.h (100%)
 rename {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf (100%)
 delete mode 100644 ArmPkg/Include/Library/StandaloneMmMmuLib.h
 create mode 100644 ArmPkg/Library/MmuLib/BaseMmuLib.inf
 copy {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf (84%)
 rename {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-aarch64.a (100%)
 rename {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-aarch64.s (100%)
 rename {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-arm.a (100%)
 rename {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-arm.s (100%)
 rename {ArmPkg/Include => MdePkg/Include/AArch64}/AsmMacroIoLibV8.h (100%)
 rename {ArmPkg/Include => MdePkg/Include/Arm}/AsmMacroIoLib.h (100%)
 create mode 100644 MdePkg/Include/Library/MmuLib.h
 create mode 100644 MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/AArch64/Atomics.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashldi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/clzsi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/moddi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/modsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/muldi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/sourcery.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch16.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch32.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch8.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switchu8.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivdi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umoddi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umodsi3.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.S (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.asm (100%)
 rename {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf (95%)
 create mode 100644 StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
 copy StandaloneMmPkg/{StandaloneMmPkg.dsc => StandaloneMmPkg.dsc.orig} (90%)

-- 
2.31.1.windows.1


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

* [PATCH v3 01/14] ArmPkg/ArmMmuBaseLib: Disallow STANDALONE_MM
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 02/14] ArmPkg/ArmMmuStandaloneMmLib: Update to match ArmMmuLib Bret Barkelew
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

Not sure what all module types this HAS been validated against, but it
doesn't work with STANDALONE_MM or STANDALONE_MM_CORE.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3647

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
 ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
index 2a7e7147958c..d0988b27d582 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
@@ -13,7 +13,7 @@ [Defines]
   FILE_GUID                      = da8f0232-fb14-42f0-922c-63104d2c70bd
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = ArmMmuLib
+  LIBRARY_CLASS                  = ArmMmuLib | DXE_DRIVER PEIM PEI_CORE DXE_CORE DXE_RUNTIME_DRIVER SEC
 
 [Defines.AARCH64]
   CONSTRUCTOR                    = ArmMmuBaseLibConstructor
-- 
2.31.1.windows.1


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

* [PATCH v3 02/14] ArmPkg/ArmMmuStandaloneMmLib: Update to match ArmMmuLib
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 01/14] ArmPkg/ArmMmuBaseLib: Disallow STANDALONE_MM Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 03/14] ArmPkg/StandaloneMmCoreEntryPoint: Swap to ArmMmuLib Bret Barkelew
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

Drop switch from the custom "StandaloneMmMmuLib" class to the
more generic "ArmMmuLib" class and add the missing functions
to fulfill that interface.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3647

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
 ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c   | 67 ++++++++++++++++++++
 ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf |  2 +-
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c
index 20f873e6802c..dde623f8ec69 100644
--- a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c
+++ b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c
@@ -325,3 +325,70 @@ ArmClearMemoryRegionReadOnly (
   }
   return Status;
 }
+
+/**
+  Placeholder function to fulfill API.
+
+  @param [in]  MemoryTable
+  @param [out] TranslationTableBase
+  @param [out] TranslationTableSize
+
+  @retval EFI_UNSUPPORTED         This function is not implemented by the
+                                  callee.
+
+**/
+EFI_STATUS
+EFIAPI
+ArmConfigureMmu (
+  IN  ARM_MEMORY_REGION_DESCRIPTOR  *MemoryTable,
+  OUT VOID                          **TranslationTableBase OPTIONAL,
+  OUT UINTN                         *TranslationTableSize  OPTIONAL
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a() interface not implemented!\n", __FUNCTION__));
+  ASSERT (FALSE);
+  return EFI_UNSUPPORTED;
+}
+
+/**
+  Placeholder function to fulfill API.
+
+  @param [in]  Entry
+  @param [in]  Value
+  @param [in]  RegionStart
+
+**/
+VOID
+EFIAPI
+ArmReplaceLiveTranslationEntry (
+  IN  UINT64  *Entry,
+  IN  UINT64  Value,
+  IN  UINT64  RegionStart
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a() interface not implemented!\n", __FUNCTION__));
+  ASSERT (FALSE);
+}
+
+/**
+  Placeholder function to fulfill API.
+
+  @param [in]  BaseAddress
+  @param [in]  Length
+  @param [in]  Attributes
+
+  @retval EFI_UNSUPPORTED         This function is not implemented by the
+                                  callee.
+
+**/
+EFI_STATUS
+ArmSetMemoryAttributes (
+  IN EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN UINT64                    Length,
+  IN UINT64                    Attributes
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a() interface not implemented!\n", __FUNCTION__));
+  ASSERT (FALSE);
+  return EFI_UNSUPPORTED;
+}
diff --git a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
index ff20e5898051..d34086853d32 100644
--- a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
+++ b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
@@ -13,7 +13,7 @@ [Defines]
   FILE_GUID                      = 44a741c2-655f-41fc-b066-179f5a9aa78a
   MODULE_TYPE                    = MM_CORE_STANDALONE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = StandaloneMmMmuLib
+  LIBRARY_CLASS                  = ArmMmuLib | MM_CORE_STANDALONE MM_STANDALONE
   PI_SPECIFICATION_VERSION       = 0x00010032
 
 [Sources]
-- 
2.31.1.windows.1


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

* [PATCH v3 03/14] ArmPkg/StandaloneMmCoreEntryPoint: Swap to ArmMmuLib
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 01/14] ArmPkg/ArmMmuBaseLib: Disallow STANDALONE_MM Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 02/14] ArmPkg/ArmMmuStandaloneMmLib: Update to match ArmMmuLib Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 04/14] ArmPkg: Disavow StandaloneMmMmuLib. It's just ArmMmuLib Bret Barkelew
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh,
	Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

StandaloneMmMmuLib has been turned into an implementation of the
ArmMmuLib class (without any change to the interface itself), so
this module can now change its dependency.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3647

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
index 75cfb98c0e75..a0629cbc1a6f 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
@@ -42,7 +42,7 @@ [LibraryClasses]
   DebugLib
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  StandaloneMmMmuLib
+  ArmMmuLib
   ArmSvcLib
 
 [Guids]
-- 
2.31.1.windows.1


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

* [PATCH v3 04/14] ArmPkg: Disavow StandaloneMmMmuLib. It's just ArmMmuLib
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (2 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 03/14] ArmPkg/StandaloneMmCoreEntryPoint: Swap to ArmMmuLib Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 05/14] ArmPkg and MdePkg: Move the Arm CompilerIntrinsicsLib to MdePkg Bret Barkelew
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

This extra interface is redundant and unnecessary. Dropping it is
more EDK2-ish.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3647

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
 ArmPkg/ArmPkg.dec                           |  4 ---
 ArmPkg/Include/Library/StandaloneMmMmuLib.h | 36 --------------------
 2 files changed, 40 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index 9da1bbc9f216..f5c235ecc11b 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -88,10 +88,6 @@ [LibraryClasses.common]
   #
   SemihostLib|Include/Library/SemihostLib.h
 
-  ##  @libraryclass  Provides an interface for a StandaloneMm Mmu.
-  #
-  StandaloneMmMmuLib|Include/Library/StandaloneMmMmuLib.h
-
 [Guids.common]
   gArmTokenSpaceGuid       = { 0xBB11ECFE, 0x820F, 0x4968, { 0xBB, 0xA6, 0xF7, 0x6A, 0xFE, 0x30, 0x25, 0x96 } }
 
diff --git a/ArmPkg/Include/Library/StandaloneMmMmuLib.h b/ArmPkg/Include/Library/StandaloneMmMmuLib.h
deleted file mode 100644
index ccc016d0350a..000000000000
--- a/ArmPkg/Include/Library/StandaloneMmMmuLib.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
-
-  Copyright (c) 2018, ARM Ltd. All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef STANDALONE_MM_MMU_LIB_
-#define STANDALONE_MM_MMU_LIB_
-
-EFI_STATUS
-ArmSetMemoryRegionNoExec (
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
-  IN  UINT64                    Length
-  );
-
-EFI_STATUS
-ArmClearMemoryRegionNoExec (
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
-  IN  UINT64                    Length
-  );
-
-EFI_STATUS
-ArmSetMemoryRegionReadOnly (
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
-  IN  UINT64                    Length
-  );
-
-EFI_STATUS
-ArmClearMemoryRegionReadOnly (
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
-  IN  UINT64                    Length
-  );
-
-#endif /* STANDALONE_MM_MMU_LIB_ */
-- 
2.31.1.windows.1


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

* [PATCH v3 05/14] ArmPkg and MdePkg: Move the Arm CompilerIntrinsicsLib to MdePkg
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (3 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 04/14] ArmPkg: Disavow StandaloneMmMmuLib. It's just ArmMmuLib Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 06/14] ArmPkg and BaseTools: Move the GccLto binaries from ArmPkg to BaseTools Bret Barkelew
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Leif Lindholm, Ard Biesheuvel, Michael D Kinney, Liming Gao,
	Zhiguang Liu, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh,
	Maciej Rabeda, Jiaxin Wu, Siyuan Fu, Ray Ni, Zhichao Gao,
	Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

This aligns better with Mu's philosophy around dependency structuring
and is one of the steps to enable Basecore to have zero CI dependencies
on other Mu repos.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3649

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcmp_ms.c               | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy.c                  | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memcpy_ms.c               | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memmove_ms.c              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset.c                  | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/memset_ms.c               | 0
 ArmPkg/ArmPkg.dsc                                                          | 3 +--
 ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc                         | 2 +-
 ArmPlatformPkg/ArmPlatformPkg.dsc                                          | 2 +-
 ArmVirtPkg/ArmVirt.dsc.inc                                                 | 2 +-
 CryptoPkg/CryptoPkg.dsc                                                    | 2 +-
 DynamicTablesPkg/DynamicTablesPkg.dsc                                      | 2 +-
 EmbeddedPkg/EmbeddedPkg.dsc                                                | 2 +-
 FatPkg/FatPkg.dsc                                                          | 2 +-
 FmpDevicePkg/FmpDevicePkg.dsc                                              | 2 +-
 MdeModulePkg/MdeModulePkg.dsc                                              | 2 +-
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/AArch64/Atomics.S         | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashldi3.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/clzsi2.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.S                 | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/div.asm               | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divdi3.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/divsi3.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.S                | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lasr.asm              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm           | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.S                | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsl.asm              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.S                | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/llsr.asm              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/memmove.asm           | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/moddi3.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/modsi3.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/muldi3.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.S               | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/mullu.asm             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/sourcery.S            | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch.asm            | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch16.S            | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch32.S            | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switch8.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/switchu8.S            | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivdi3.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S          | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/udivsi3.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.S               | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uldiv.asm             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umoddi3.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/umodsi3.S             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.S               | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uread.asm             | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.S              | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/Arm/uwrite.asm            | 0
 {ArmPkg => MdePkg}/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf | 1 -
 MdePkg/MdePkg.dsc                                                          | 1 +
 NetworkPkg/NetworkPkg.dsc                                                  | 2 +-
 RedfishPkg/RedfishPkg.dsc                                                  | 2 +-
 SecurityPkg/SecurityPkg.dsc                                                | 2 +-
 ShellPkg/ShellPkg.dsc                                                      | 2 +-
 SignedCapsulePkg/SignedCapsulePkg.dsc                                      | 2 +-
 StandaloneMmPkg/StandaloneMmPkg.dsc                                        | 2 +-
 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc                    | 2 +-
 68 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memcmp_ms.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/MdePkg/Library/CompilerIntrinsicsLib/memcpy.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memcpy.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memcpy_ms.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memmove_ms.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c b/MdePkg/Library/CompilerIntrinsicsLib/memset.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memset.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memset.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c b/MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
rename to MdePkg/Library/CompilerIntrinsicsLib/memset_ms.c
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 59fd8f295d4f..f9268de8347e 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -101,7 +101,7 @@ [LibraryClasses.common.PEIM]
   PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
@@ -109,7 +109,6 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
 [Components.common]
   ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
-  ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
   ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
   ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
diff --git a/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc b/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
index 2818ce65db98..ac818f0d98a2 100644
--- a/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
+++ b/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
@@ -43,7 +43,7 @@ [LibraryClasses]
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
 
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 [Components.common]
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
index 661a4cea220d..b146e4fe8a69 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg.dsc
@@ -76,7 +76,7 @@ [LibraryClasses.common]
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
 
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 [LibraryClasses.common.PEIM]
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 5a1598d90ca7..502ddee78529 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -96,7 +96,7 @@ [LibraryClasses.common]
   # It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions.
   # This library provides the instrinsic functions such a compiler may generate calls to.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 0aa72ed87846..2d4d4c2797e5 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -74,7 +74,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # [LibraryClasses.ARM, LibraryClasses.AARCH64] and NULL mean link this library
   # into all ARM and AARCH64 images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index e1439a130143..d0b2110a05aa 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -34,7 +34,7 @@ [LibraryClasses]
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
 
diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
index f7ed61545c2e..4c4a6029d6fd 100644
--- a/EmbeddedPkg/EmbeddedPkg.dsc
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
@@ -128,7 +128,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
   ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
   SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/FatPkg/FatPkg.dsc b/FatPkg/FatPkg.dsc
index 4ddb5c3e004b..32708b1e58cf 100644
--- a/FatPkg/FatPkg.dsc
+++ b/FatPkg/FatPkg.dsc
@@ -57,7 +57,7 @@ [LibraryClasses.common.PEIM]
   MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 ###################################################################################################
diff --git a/FmpDevicePkg/FmpDevicePkg.dsc b/FmpDevicePkg/FmpDevicePkg.dsc
index 7b1af285dd65..258b5ce0cded 100644
--- a/FmpDevicePkg/FmpDevicePkg.dsc
+++ b/FmpDevicePkg/FmpDevicePkg.dsc
@@ -78,7 +78,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # [LibraryClasses.ARM, LibraryClasses.AARCH64] and NULL mean link this library
   # into all ARM and AARCH64 images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index b1d83461865e..e3146c378800 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -183,7 +183,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generated by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   #
   # Since software stack checking may be heuristically enabled by the compiler
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S b/MdePkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S
rename to MdePkg/Library/CompilerIntrinsicsLib/AArch64/Atomics.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/div.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/div.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/div.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/div.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/div.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/lasr.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsl.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/llsr.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/memmove.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/mullu.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch16.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch16.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch16.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch16.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch32.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch32.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch32.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch32.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch8.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switch8.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switch8.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switch8.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/switchu8.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uldiv.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uread.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uread.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.S
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm b/MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
similarity index 100%
rename from ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
rename to MdePkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
similarity index 95%
rename from ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
rename to MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
index fcf48c678119..6fa09e5f0dec 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+++ b/MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@@ -84,7 +84,6 @@ [Sources.AARCH64]
 
 [Packages]
   MdePkg/MdePkg.dec
-  ArmPkg/ArmPkg.dec
 
 [BuildOptions]
   MSFT:*_*_*_CC_FLAGS = /GL-
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index a94959169b2f..a04f0aec8c20 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -183,5 +183,6 @@ [Components.EBC]
 [Components.ARM, Components.AARCH64]
   MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
   MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
+  MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
 [BuildOptions]
diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index 8691a0f5d07a..3e2df982c0fb 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -75,7 +75,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generated by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
 
diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index 16139146ff83..0dc120d82699 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -45,7 +45,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   #
   # This library provides the instrinsic functions generated by a given compiler.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
 
diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 73a93c2285b1..2b5ef67016b8 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -79,7 +79,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the intrinsic functions generate by a given compiler.
   # And NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc
index 6f0d0929319d..4d050d215510 100644
--- a/ShellPkg/ShellPkg.dsc
+++ b/ShellPkg/ShellPkg.dsc
@@ -69,7 +69,7 @@ [LibraryClasses.ARM,LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generate by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/SignedCapsulePkg/SignedCapsulePkg.dsc b/SignedCapsulePkg/SignedCapsulePkg.dsc
index 8a27207a6f20..72b533cd04e8 100644
--- a/SignedCapsulePkg/SignedCapsulePkg.dsc
+++ b/SignedCapsulePkg/SignedCapsulePkg.dsc
@@ -104,7 +104,7 @@ [LibraryClasses.AARCH64, LibraryClasses.ARM]
   # This library provides the instrinsic functions generate by a given compiler.
   # And NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index 8012f93b7dcc..e9488538cb21 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -67,7 +67,7 @@ [LibraryClasses.AARCH64, LibraryClasses.ARM]
   CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   PeCoffExtraActionLib|StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
 
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
 [LibraryClasses.common.MM_CORE_STANDALONE]
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index 8adf690098ae..9f2b671f7c86 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -37,7 +37,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # This library provides the instrinsic functions generated by a given compiler.
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
   #
-  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+  NULL|MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
   #
   # Since software stack checking may be heuristically enabled by the compiler
-- 
2.31.1.windows.1


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

* [PATCH v3 06/14] ArmPkg and BaseTools: Move the GccLto binaries from ArmPkg to BaseTools
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (4 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 05/14] ArmPkg and MdePkg: Move the Arm CompilerIntrinsicsLib to MdePkg Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 07/14] ArmPkg and MdePkg: Move the AsmMacroIoLib from ArmPkg to MdePkg Bret Barkelew
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Leif Lindholm, Ard Biesheuvel, Bob Feng, Liming Gao, Yuwei Chen,
	Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

This aligns better with Mu's philosophy around dependency structuring
and is one of the steps to enable Basecore to have zero CI dependencies
on other Mu repos.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3650

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-aarch64.a | Bin
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-aarch64.s |   0
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-arm.a     | Bin
 {ArmPkg/Library => BaseTools/Bin}/GccLto/liblto-arm.s     |   0
 BaseTools/Conf/tools_def.template                         |  19 ++++++++++---------
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.a b/BaseTools/Bin/GccLto/liblto-aarch64.a
similarity index 100%
rename from ArmPkg/Library/GccLto/liblto-aarch64.a
rename to BaseTools/Bin/GccLto/liblto-aarch64.a
diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.s b/BaseTools/Bin/GccLto/liblto-aarch64.s
similarity index 100%
rename from ArmPkg/Library/GccLto/liblto-aarch64.s
rename to BaseTools/Bin/GccLto/liblto-aarch64.s
diff --git a/ArmPkg/Library/GccLto/liblto-arm.a b/BaseTools/Bin/GccLto/liblto-arm.a
similarity index 100%
rename from ArmPkg/Library/GccLto/liblto-arm.a
rename to BaseTools/Bin/GccLto/liblto-arm.a
diff --git a/ArmPkg/Library/GccLto/liblto-arm.s b/BaseTools/Bin/GccLto/liblto-arm.s
similarity index 100%
rename from ArmPkg/Library/GccLto/liblto-arm.s
rename to BaseTools/Bin/GccLto/liblto-arm.s
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 2e6b382ab623..cd8899d24d4a 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -15,7 +15,8 @@
 # 2.00 - Initial version with changes for CI
 #      - Change RC path to use plugin
 #
-#!VERSION=2.00
+# 2.10 - Move GccLto files to a tools path to be more repository layout agnostic
+#!VERSION=2.10
 
 IDENTIFIER = Default TOOL_CHAIN_CONF
 
@@ -2386,10 +2387,10 @@ RELEASE_GCC5_X64_DLINK_FLAGS     = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
 *_GCC5_ARM_CC_XIPFLAGS           = DEF(GCC5_ARM_CC_XIPFLAGS)
 
   DEBUG_GCC5_ARM_CC_FLAGS        = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
-  DEBUG_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+  DEBUG_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
 
 RELEASE_GCC5_ARM_CC_FLAGS        = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
-RELEASE_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+RELEASE_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
 
   NOOPT_GCC5_ARM_CC_FLAGS        = DEF(GCC5_ARM_CC_FLAGS) -O0
   NOOPT_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -O0
@@ -2420,11 +2421,11 @@ RELEASE_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS
 *_GCC5_AARCH64_CC_XIPFLAGS       = DEF(GCC5_AARCH64_CC_XIPFLAGS)
 
   DEBUG_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
-  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
+  DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
   DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
 RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
-RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
+RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
 RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
   NOOPT_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -O0
@@ -2681,11 +2682,11 @@ DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLA
 *_CLANG38_ARM_CC_XIPFLAGS        = DEF(GCC_ARM_CC_XIPFLAGS)
 
   DEBUG_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O1
-  DEBUG_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+  DEBUG_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
   NOOPT_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
   NOOPT_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS)
 RELEASE_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3
-RELEASE_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+RELEASE_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
 
 ##################
 # CLANG38 AARCH64 definitions
@@ -2727,11 +2728,11 @@ DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH6
 *_CLANG38_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)
 
   DEBUG_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O1
-  DEBUG_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+  DEBUG_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
   NOOPT_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
   NOOPT_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS)
 RELEASE_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3
-RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/BaseTools/Bin/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
 
 ####################################################################################
 #
-- 
2.31.1.windows.1


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

* [PATCH v3 07/14] ArmPkg and MdePkg: Move the AsmMacroIoLib from ArmPkg to MdePkg
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (5 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 06/14] ArmPkg and BaseTools: Move the GccLto binaries from ArmPkg to BaseTools Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 08/14] MdePkg: Create the MMU access lib to abstract memory protection settings Bret Barkelew
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Leif Lindholm, Ard Biesheuvel, Michael D Kinney, Liming Gao,
	Zhiguang Liu, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
 {ArmPkg/Include => MdePkg/Include/AArch64}/AsmMacroIoLibV8.h | 0
 {ArmPkg/Include => MdePkg/Include/Arm}/AsmMacroIoLib.h       | 0
 2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/ArmPkg/Include/AsmMacroIoLibV8.h b/MdePkg/Include/AArch64/AsmMacroIoLibV8.h
similarity index 100%
rename from ArmPkg/Include/AsmMacroIoLibV8.h
rename to MdePkg/Include/AArch64/AsmMacroIoLibV8.h
diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/MdePkg/Include/Arm/AsmMacroIoLib.h
similarity index 100%
rename from ArmPkg/Include/AsmMacroIoLib.h
rename to MdePkg/Include/Arm/AsmMacroIoLib.h
-- 
2.31.1.windows.1


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

* [PATCH v3 08/14] MdePkg: Create the MMU access lib to abstract memory protection settings
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (6 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 07/14] ArmPkg and MdePkg: Move the AsmMacroIoLib from ArmPkg to MdePkg Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 09/14] ArmPkg: Add Basic MMU Lib for Arm silicon Bret Barkelew
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

There are a number of Arm-specific accesses that are abstracted
behind this. It may need to be refactored to work better across
architectures.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3651

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.c   | 86 ++++++++++++++++++++
 MdePkg/Include/Library/MmuLib.h                  | 75 +++++++++++++++++
 MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf | 28 +++++++
 MdePkg/MdePkg.dec                                |  5 ++
 MdePkg/MdePkg.dsc                                |  2 +
 5 files changed, 196 insertions(+)

diff --git a/MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.c b/MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.c
new file mode 100644
index 000000000000..0398bc03f8f7
--- /dev/null
+++ b/MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.c
@@ -0,0 +1,86 @@
+/** @file
+This lib abstracts some of the MMU accesses currently hardcoded against
+an Arm lib. It's likely that this will need to be refactored at some point.
+
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+
+/**
+  Bitwise sets the memory attributes on a range of memory based on an attributes mask.
+
+  @param  BaseAddress           The start of the range for which to set attributes.
+  @param  Length                The length of the range.
+  @param  Attributes            A bitmask of the attributes to set. See "Physical memory
+                                protection attributes" in UefiSpec.h
+
+  @return EFI_SUCCESS
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuSetAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length,
+  IN  UINT64                    Attributes
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a() NULL implementation used!\n", __FUNCTION__));
+  ASSERT (FALSE);
+  return EFI_UNSUPPORTED;
+}
+
+
+/**
+  Bitwise clears the memory attributes on a range of memory based on an attributes mask.
+
+  @param  BaseAddress           The start of the range for which to clear attributes.
+  @param  Length                The length of the range.
+  @param  Attributes            A bitmask of the attributes to clear. See "Physical memory
+                                protection attributes" in UefiSpec.h
+
+  @return EFI_SUCCESS
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuClearAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length,
+  IN  UINT64                    Attributes
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a() NULL implementation used!\n", __FUNCTION__));
+  ASSERT (FALSE);
+  return EFI_UNSUPPORTED;
+}
+
+
+/**
+  Returns the memory attributes on a range of memory.
+
+  @param  BaseAddress           The start of the range for which to set attributes.
+  @param  Attributes            A return pointer for the attributes.
+
+  @return EFI_SUCCESS
+  @return EFI_INVALID_PARAMETER   A return pointer is NULL.
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuGetAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  OUT UINT64                    *Attributes
+  )
+{
+  DEBUG ((DEBUG_ERROR, "%a() NULL implementation used!\n", __FUNCTION__));
+  ASSERT (FALSE);
+  return EFI_UNSUPPORTED;
+}
diff --git a/MdePkg/Include/Library/MmuLib.h b/MdePkg/Include/Library/MmuLib.h
new file mode 100644
index 000000000000..34b363bf712f
--- /dev/null
+++ b/MdePkg/Include/Library/MmuLib.h
@@ -0,0 +1,75 @@
+/** @file
+This lib abstracts some of the MMU accesses currently hardcoded against
+an Arm lib. It's likely that this will need to be refactored at some point.
+
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MMU_LIB_H_
+#define MMU_LIB_H_
+
+#include <Uefi.h>
+
+/**
+  Bitwise sets the memory attributes on a range of memory based on an attributes mask.
+
+  @param  BaseAddress           The start of the range for which to set attributes.
+  @param  Length                The length of the range.
+  @param  Attributes            A bitmask of the attributes to set. See "Physical memory
+                                protection attributes" in UefiSpec.h
+
+  @return EFI_SUCCESS
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuSetAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length,
+  IN  UINT64                    Attributes
+  );
+
+
+/**
+  Bitwise clears the memory attributes on a range of memory based on an attributes mask.
+
+  @param  BaseAddress           The start of the range for which to clear attributes.
+  @param  Length                The length of the range.
+  @param  Attributes            A bitmask of the attributes to clear. See "Physical memory
+                                protection attributes" in UefiSpec.h
+
+  @return EFI_SUCCESS
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuClearAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length,
+  IN  UINT64                    Attributes
+  );
+
+
+/**
+  Returns the memory attributes on a range of memory.
+
+  @param  BaseAddress           The start of the range for which to set attributes.
+  @param  Attributes            A return pointer for the attributes.
+
+  @return EFI_SUCCESS
+  @return EFI_INVALID_PARAMETER   A return pointer is NULL.
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuGetAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  OUT UINT64                    *Attributes
+  );
+
+#endif
diff --git a/MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf b/MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
new file mode 100644
index 000000000000..9f1b4422cc04
--- /dev/null
+++ b/MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
@@ -0,0 +1,28 @@
+## @file
+# This lib abstracts some of the MMU accesses currently hardcoded against
+# an Arm lib. It's likely that this will need to be refactored at some point.
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+
+[Defines]
+  INF_VERSION         = 0x00010017
+  BASE_NAME           = BaseMmuLibNull
+  FILE_GUID           = 97196A48-00C0-4487-802A-CC5540583EEB
+  VERSION_STRING      = 1.0
+  MODULE_TYPE         = BASE
+  LIBRARY_CLASS       = MmuLib
+
+
+[Sources]
+  BaseMmuLibNull.c
+
+
+[LibraryClasses]
+  DebugLib
+
+
+[Packages]
+  MdePkg/MdePkg.dec
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 8b18415b107a..43ad9726bf7f 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -267,6 +267,11 @@ [LibraryClasses]
   #
   RegisterFilterLib|Include/Library/RegisterFilterLib.h
 
+  ##  @libraryclass This lib abstracts some of the MMU accesses currently hardcoded against
+  #                 an Arm lib. It's likely that this will need to be refactored at some point.
+  #
+  MmuLib|Include/Library/MmuLib.h
+
 [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]
   ##  @libraryclass  Provides services to generate random number.
   #
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index a04f0aec8c20..c0f9bac787f2 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -131,6 +131,8 @@ [Components]
 
   MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
 
+  MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
+
 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
   #
   # Add UEFI Target Based Unit Tests
-- 
2.31.1.windows.1


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

* [PATCH v3 09/14] ArmPkg: Add Basic MMU Lib for Arm silicon
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (7 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 08/14] MdePkg: Create the MMU access lib to abstract memory protection settings Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 10/14] MdeModulePkg: Swap to MmuLib instead of Arm-specific lib Bret Barkelew
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Sean Brogan

From: Sean Brogan <sean.brogan@microsoft.com>

After adding the abstract MmuLib to MdePkg, add an implementation
backed by the existing ArmMmuLib to ArmPkg.

This implementation is currently just a shim to the
old library, while enabling higher-level code to be more
common.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3651

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 ArmPkg/Library/MmuLib/MmuLib.c       | 120 ++++++++++++++++++++
 ArmPkg/ArmPkg.dsc                    |   1 +
 ArmPkg/Library/MmuLib/BaseMmuLib.inf |  30 +++++
 3 files changed, 151 insertions(+)

diff --git a/ArmPkg/Library/MmuLib/MmuLib.c b/ArmPkg/Library/MmuLib/MmuLib.c
new file mode 100644
index 000000000000..6f3b664971da
--- /dev/null
+++ b/ArmPkg/Library/MmuLib/MmuLib.c
@@ -0,0 +1,120 @@
+/** @file
+This library instance implements a very limited MMU Lib instance
+for the ARM/AARCH64 architectures.  This library shims a common library
+interface to the ArmPkg defined ArmMmuLib.ib.
+
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/ArmMmuLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MmuLib.h>
+
+/**
+  Bitwise sets the memory attributes on a range of memory based on an attributes mask.
+
+  @param  BaseAddress           The start of the range for which to set attributes.
+  @param  Length                The length of the range.
+  @param  Attributes            A bitmask of the attributes to set. See "Physical memory
+                                protection attributes" in UefiSpec.h
+
+  @return EFI_SUCCESS
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuSetAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length,
+  IN  UINT64                    Attributes
+  )
+{
+    EFI_STATUS Status;
+
+    Status = EFI_UNSUPPORTED;
+
+    if ((Attributes & EFI_MEMORY_XP) == EFI_MEMORY_XP) {
+      Status = ArmSetMemoryRegionNoExec (BaseAddress, Length);
+      if (EFI_ERROR(Status)) {
+        DEBUG((DEBUG_ERROR, "%a - Failed to set NX.  Status = %r\n", __FUNCTION__, Status));
+      }
+    }
+
+    ASSERT_EFI_ERROR(Status);
+    return Status;
+}
+
+
+/**
+  Bitwise clears the memory attributes on a range of memory based on an attributes mask.
+
+  @param  BaseAddress           The start of the range for which to clear attributes.
+  @param  Length                The length of the range.
+  @param  Attributes            A bitmask of the attributes to clear. See "Physical memory
+                                protection attributes" in UefiSpec.h
+
+  @return EFI_SUCCESS
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuClearAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length,
+  IN  UINT64                    Attributes
+  )
+{
+    EFI_STATUS Status;
+
+    Status = EFI_UNSUPPORTED;
+
+    if ((Attributes & EFI_MEMORY_XP) == EFI_MEMORY_XP) {
+      Status = ArmClearMemoryRegionNoExec (BaseAddress, Length);
+      if (EFI_ERROR(Status)) {
+        DEBUG((DEBUG_ERROR, "%a - Failed to clear NX.  Status = %r\n", __FUNCTION__, Status));
+      }
+    }
+
+    if ((Attributes & EFI_MEMORY_RO) == EFI_MEMORY_RO) {
+      Status = ArmClearMemoryRegionReadOnly(BaseAddress, Length);
+      if (EFI_ERROR(Status)) {
+        DEBUG((DEBUG_ERROR, "%a - Failed to clear RO.  Status = %r\n", __FUNCTION__, Status));
+      }
+    }
+
+    ASSERT_EFI_ERROR(Status);
+    return Status;
+}
+
+
+/**
+  Returns the memory attributes on a range of memory.
+
+  @param  BaseAddress           The start of the range for which to set attributes.
+  @param  Attributes            A return pointer for the attributes.
+
+  @return EFI_SUCCESS
+  @return EFI_INVALID_PARAMETER   A return pointer is NULL.
+  @return Others
+
+**/
+EFI_STATUS
+EFIAPI
+MmuGetAttributes (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  OUT UINT64                    *Attributes
+  )
+{
+    EFI_STATUS Status;
+
+    Status = EFI_UNSUPPORTED;
+
+    DEBUG ((DEBUG_ERROR, "%a() API not implemented\n", __FUNCTION__));
+
+    ASSERT_EFI_ERROR(Status);
+    return Status;
+}
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index f9268de8347e..197519a64718 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -165,3 +165,4 @@ [Components.AARCH64]
 
 [Components.AARCH64, Components.ARM]
   ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
+  ArmPkg/Library/MmuLib/BaseMmuLib.inf
diff --git a/ArmPkg/Library/MmuLib/BaseMmuLib.inf b/ArmPkg/Library/MmuLib/BaseMmuLib.inf
new file mode 100644
index 000000000000..15095abee9c3
--- /dev/null
+++ b/ArmPkg/Library/MmuLib/BaseMmuLib.inf
@@ -0,0 +1,30 @@
+## @file
+# This library instance implements a very limited MMU Lib instance
+# for the ARM/AARCH64 architectures.  This library shims a common library
+# interface to the ArmPkg defined ArmMmuLib.
+#
+# Copyright (c) Microsoft Corporation.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = MmuLib
+  FILE_GUID                      = 6f2ee9a4-79b3-4b77-9a47-e2bd4b917b75
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = MmuLib
+
+[Sources]
+  MmuLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ArmPkg/ArmPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  ArmMmuLib
-- 
2.31.1.windows.1


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

* [PATCH v3 10/14] MdeModulePkg: Swap to MmuLib instead of Arm-specific lib
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (8 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 09/14] ArmPkg: Add Basic MMU Lib for Arm silicon Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 11/14] StandaloneMmPkg: Switch to the MmuLib abstraction Bret Barkelew
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Liming Gao, Dandan Bi, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3651

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c | 4 ++--
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf        | 4 +---
 MdeModulePkg/MdeModulePkg.dsc                  | 3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c b/MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c
index 6619a650661b..16c20930a662 100644
--- a/MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c
+++ b/MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c
@@ -10,7 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "DxeIpl.h"
 
-#include <Library/ArmMmuLib.h>
+#include <Library/MmuLib.h>
 
 /**
    Transfers control to DxeCore.
@@ -40,7 +40,7 @@ HandOffToDxeCore (
   ASSERT (BaseOfStack != NULL);
 
   if (PcdGetBool (PcdSetNxForStack)) {
-    Status = ArmSetMemoryRegionNoExec ((UINTN)BaseOfStack, STACK_SIZE);
+    Status = MmuSetAttributes ((UINTN)BaseOfStack, STACK_SIZE, EFI_MEMORY_XP);
     ASSERT_EFI_ERROR (Status);
   }
 
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
index 19b8a4c8aefa..3634d836548f 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
@@ -57,8 +57,6 @@ [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
 
-[Packages.ARM, Packages.AARCH64]
-  ArmPkg/ArmPkg.dec
 
 [LibraryClasses]
   PcdLib
@@ -77,7 +75,7 @@ [LibraryClasses]
   PerformanceLib
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  ArmMmuLib
+  MmuLib
 
 [Ppis]
   gEfiDxeIplPpiGuid                      ## PRODUCES
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index e3146c378800..1530ea6796da 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -103,6 +103,7 @@ [LibraryClasses]
   DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
+  MmuLib|MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
 
 [LibraryClasses.EBC.PEIM]
   IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
@@ -174,8 +175,6 @@ [LibraryClasses.common.MM_STANDALONE]
   MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
-  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
-  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
   LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
 
   #
-- 
2.31.1.windows.1


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

* [PATCH v3 11/14] StandaloneMmPkg: Switch to the MmuLib abstraction
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (9 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 10/14] MdeModulePkg: Swap to MmuLib instead of Arm-specific lib Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 12/14] ArmPkg: Move the StandaloneMmCpu driver to ArmPkg Bret Barkelew
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh,
	Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3651

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c | 82 ++++++++++++++++++--
 StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf       |  3 +-
 StandaloneMmPkg/StandaloneMmPkg.dsc                                                                 |  1 +
 3 files changed, 79 insertions(+), 7 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
index ca8b1244a313..986f6ade5f47 100644
--- a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
@@ -10,7 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include <PiDxe.h>
 
-#include <Library/ArmMmuLib.h>
+#include <Library/MmuLib.h>
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/DebugLib.h>
@@ -163,6 +163,78 @@ UpdatePeCoffPermissions (
   return RETURN_SUCCESS;
 }
 
+/**
+  Internal function to parameterize the call int MmuSetAttributes.
+
+  @param [in] BaseAddress
+  @param [in] Length
+
+  @retval   EFI_STATUS    Returned by MmuSetAttributes
+**/
+STATIC
+EFI_STATUS
+ArmPeSetMemoryRegionNoExec (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length
+  )
+{
+  return MmuSetAttributes (BaseAddress, Length, EFI_MEMORY_XP);
+}
+
+/**
+  Internal function to parameterize the call int MmuSetAttributes.
+
+  @param [in] BaseAddress
+  @param [in] Length
+
+  @retval   EFI_STATUS    Returned by MmuSetAttributes
+**/
+STATIC
+EFI_STATUS
+ArmPeClearMemoryRegionNoExec (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length
+  )
+{
+  return MmuClearAttributes (BaseAddress, Length, EFI_MEMORY_XP);
+}
+
+/**
+  Internal function to parameterize the call int MmuSetAttributes.
+
+  @param [in] BaseAddress
+  @param [in] Length
+
+  @retval   EFI_STATUS    Returned by MmuSetAttributes
+**/
+STATIC
+EFI_STATUS
+ArmPeSetMemoryRegionReadOnly (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length
+  )
+{
+  return MmuSetAttributes (BaseAddress, Length, EFI_MEMORY_RO);
+}
+
+/**
+  Internal function to parameterize the call int MmuSetAttributes.
+
+  @param [in] BaseAddress
+  @param [in] Length
+
+  @retval   EFI_STATUS    Returned by MmuSetAttributes
+**/
+STATIC
+EFI_STATUS
+ArmPeClearMemoryRegionReadOnly (
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
+  IN  UINT64                    Length
+  )
+{
+  return MmuClearAttributes (BaseAddress, Length, EFI_MEMORY_RO);
+}
+
 /**
   Performs additional actions after a PE/COFF image has been loaded and relocated.
 
@@ -180,8 +252,8 @@ PeCoffLoaderRelocateImageExtraAction (
 {
   UpdatePeCoffPermissions (
     ImageContext,
-    ArmClearMemoryRegionNoExec,
-    ArmSetMemoryRegionReadOnly
+    ArmPeClearMemoryRegionNoExec,
+    ArmPeSetMemoryRegionReadOnly
     );
 }
 
@@ -205,7 +277,7 @@ PeCoffLoaderUnloadImageExtraAction (
 {
   UpdatePeCoffPermissions (
     ImageContext,
-    ArmSetMemoryRegionNoExec,
-    ArmClearMemoryRegionReadOnly
+    ArmPeSetMemoryRegionNoExec,
+    ArmPeClearMemoryRegionReadOnly
     );
 }
diff --git a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
index 89083df679a1..25306dd3e707 100644
--- a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
@@ -27,10 +27,9 @@ [Sources.common]
   AArch64/StandaloneMmPeCoffExtraActionLib.c
 
 [Packages]
-  ArmPkg/ArmPkg.dec
   MdePkg/MdePkg.dec
   StandaloneMmPkg/StandaloneMmPkg.dec
 
 [LibraryClasses]
-  StandaloneMmMmuLib
+  MmuLib
   PcdLib
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index e9488538cb21..da3488e0d3fe 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -59,6 +59,7 @@ [LibraryClasses]
   StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
   StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
   VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+  MmuLib|MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
 
 [LibraryClasses.AARCH64, LibraryClasses.ARM]
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
-- 
2.31.1.windows.1


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

* [PATCH v3 12/14] ArmPkg: Move the StandaloneMmCpu driver to ArmPkg
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (10 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 11/14] StandaloneMmPkg: Switch to the MmuLib abstraction Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 13/14] StandaloneMmPkg: Add StandaloneMmCoreEntryNull to satisfy CI on all archs Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 14/14] ArmPkg: Create an Arm-specific version of StandaloneMmCoreEntryPoint Bret Barkelew
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Leif Lindholm, Ard Biesheuvel, Sami Mujawar, Jiewen Yao,
	Supreeth Venkatesh, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

This aligns better with Mu's philosophy around dependency structuring
and is one of the steps to enable Basecore to have zero CI dependencies
on other Mu repos.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3652

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/EventHandle.c       | 0
 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.c   | 0
 ArmPkg/ArmPkg.dsc                                                       | 7 +++++++
 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.h   | 0
 {StandaloneMmPkg => ArmPkg}/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf | 0
 StandaloneMmPkg/StandaloneMmPkg.dsc                                     | 1 -
 6 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c b/ArmPkg/Drivers/StandaloneMmCpu/EventHandle.c
similarity index 100%
rename from StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c
rename to ArmPkg/Drivers/StandaloneMmCpu/EventHandle.c
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c b/ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c
similarity index 100%
rename from StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c
rename to ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 197519a64718..04462c355922 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -93,6 +93,8 @@ [LibraryClasses.common]
 
   OemMiscLib|ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf
 
+  ArmSvcLib|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf
+
 [LibraryClasses.common.PEIM]
   HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
@@ -106,6 +108,11 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
   # Add support for GCC stack protector
   NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
 
+[LibraryClasses.common.MM_STANDALONE]
+  HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
+  MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
+  StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
+
 [Components.common]
   ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h b/ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h
similarity index 100%
rename from StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h
rename to ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.h
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf b/ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
similarity index 100%
rename from StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
rename to ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index da3488e0d3fe..a7b42d9c2882 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -120,7 +120,6 @@ [Components.common]
   StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
 
 [Components.AARCH64, Components.ARM]
-  StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
   StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
 
 ###################################################################################################
-- 
2.31.1.windows.1


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

* [PATCH v3 13/14] StandaloneMmPkg: Add StandaloneMmCoreEntryNull to satisfy CI on all archs
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (11 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 12/14] ArmPkg: Move the StandaloneMmCpu driver to ArmPkg Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  2021-11-11  0:24 ` [PATCH v3 14/14] ArmPkg: Create an Arm-specific version of StandaloneMmCoreEntryPoint Bret Barkelew
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh,
	Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

In order to separate this libary into architecture-specific versions,
first create a NULL implementation that can pass CI on any arch.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.c   | 51 ++++++++++++++++++++
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf | 32 ++++++++++++
 StandaloneMmPkg/StandaloneMmPkg.dsc                                                       | 10 +++-
 StandaloneMmPkg/{StandaloneMmPkg.dsc => StandaloneMmPkg.dsc.orig}                         | 16 +++++-
 4 files changed, 105 insertions(+), 4 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.c
new file mode 100644
index 000000000000..2c1fd5a9b6ca
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.c
@@ -0,0 +1,51 @@
+/** @file
+  Entry point to the Standalone Mm Core.
+
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+
+/**
+  The entry point of PE/COFF Image for the STANDALONE MM Core.
+
+  This function is the entry point for the STANDALONE MM Core. This function is required to call
+  ProcessModuleEntryPointList() and ProcessModuleEntryPointList() is never expected to return.
+  The STANDALONE MM Core is responsible for calling ProcessLibraryConstructorList() as soon as the EFI
+  System Table and the image handle for the STANDALONE MM Core itself have been established.
+  If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system.
+
+  @param  HobStart  Pointer to the beginning of the HOB List passed in from the PEI Phase.
+
+**/
+VOID
+EFIAPI
+_ModuleEntryPoint (
+  IN VOID  *HobStart
+  )
+{
+  // Do nothing. This is a NULL implementation.
+}
+
+
+/**
+  Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
+
+  This function is required to call _ModuleEntryPoint() passing in HobStart.
+
+  @param  HobStart  Pointer to the beginning of the HOB List passed in from the PEI Phase.
+
+**/
+VOID
+EFIAPI
+EfiMain (
+  IN VOID  *HobStart
+  )
+{
+  _ModuleEntryPoint (HobStart);
+}
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
new file mode 100644
index 000000000000..4fd80a5c0841
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
@@ -0,0 +1,32 @@
+## @file
+# Module entry point library for DXE core.
+#
+# Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR>
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001A
+  BASE_NAME                      = StandaloneMmCoreEntryPointNull
+  FILE_GUID                      = 5E28E9FA-67DC-4408-A177-05F72CD7E248
+  MODULE_TYPE                    = MM_CORE_STANDALONE
+  VERSION_STRING                 = 1.0
+  PI_SPECIFICATION_VERSION       = 0x00010032
+  LIBRARY_CLASS                  = StandaloneMmCoreEntryPoint|MM_CORE_STANDALONE
+
+#
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC (EBC is for build only)
+#
+
+[Sources]
+  StandaloneMmCoreEntryPointNull.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index a7b42d9c2882..d72019d0cce2 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -56,11 +56,14 @@ [LibraryClasses]
   PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
-  StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+  StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
   StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
   VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
   MmuLib|MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
 
+[LibraryClasses.X64]
+  StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+
 [LibraryClasses.AARCH64, LibraryClasses.ARM]
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
   StandaloneMmMmuLib|ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
@@ -111,13 +114,16 @@ [Components.common]
   #
   StandaloneMmPkg/Core/StandaloneMmCore.inf
   StandaloneMmPkg/Library/FvLib/FvLib.inf
-  StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
   StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
   StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
   StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
   StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
   StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
   StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+  StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
+
+[Components.X64]
+  StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
 
 [Components.AARCH64, Components.ARM]
   StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc.orig
similarity index 92%
copy from StandaloneMmPkg/StandaloneMmPkg.dsc
copy to StandaloneMmPkg/StandaloneMmPkg.dsc.orig
index a7b42d9c2882..875b128a8045 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc.orig
@@ -56,11 +56,17 @@ [LibraryClasses]
   PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
-  StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+<<<<<<< HEAD
+  StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
+=======
+>>>>>>> f71ccd340de8 (ArmPkg: Create an Arm-specific version of StandaloneMmCoreEntryPoint)
   StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
   VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
   MmuLib|MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
 
+[LibraryClasses.X64]
+  StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+
 [LibraryClasses.AARCH64, LibraryClasses.ARM]
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
   StandaloneMmMmuLib|ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
@@ -111,13 +117,19 @@ [Components.common]
   #
   StandaloneMmPkg/Core/StandaloneMmCore.inf
   StandaloneMmPkg/Library/FvLib/FvLib.inf
-  StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
   StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
   StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
   StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
   StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
   StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
   StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+  StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
+
+[Components.X64]
+  StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+
+[Components.X64]
+  StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
 
 [Components.AARCH64, Components.ARM]
   StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMmPeCoffExtraActionLib.inf
-- 
2.31.1.windows.1


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

* [PATCH v3 14/14] ArmPkg: Create an Arm-specific version of StandaloneMmCoreEntryPoint
  2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
                   ` (12 preceding siblings ...)
  2021-11-11  0:24 ` [PATCH v3 13/14] StandaloneMmPkg: Add StandaloneMmCoreEntryNull to satisfy CI on all archs Bret Barkelew
@ 2021-11-11  0:24 ` Bret Barkelew
  13 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2021-11-11  0:24 UTC (permalink / raw)
  To: devel
  Cc: Leif Lindholm, Ard Biesheuvel, Sami Mujawar, Jiewen Yao,
	Supreeth Venkatesh, Sean Brogan

From: Bret Barkelew <brbarkel@microsoft.com>

This aligns better with Mu's philosophy around dependency structuring
and is one of the steps to enable Basecore to have zero CI dependencies
on other Mu repos.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3652

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
---
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c              |  0
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c             |  0
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c |  0
 ArmPkg/ArmPkg.ci.yaml                                                                           |  3 ++-
 ArmPkg/ArmPkg.dsc                                                                               |  3 +++
 {StandaloneMmPkg => ArmPkg}/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf   |  6 ++---
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf               | 25 --------------------
 7 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c b/ArmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c
similarity index 100%
rename from StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c
rename to ArmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c b/ArmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c
similarity index 100%
rename from StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c
rename to ArmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c b/ArmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
similarity index 100%
rename from StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
rename to ArmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
diff --git a/ArmPkg/ArmPkg.ci.yaml b/ArmPkg/ArmPkg.ci.yaml
index a0d6a75fe881..de6926c82e67 100644
--- a/ArmPkg/ArmPkg.ci.yaml
+++ b/ArmPkg/ArmPkg.ci.yaml
@@ -46,7 +46,8 @@
             "EmbeddedPkg/EmbeddedPkg.dec",
             "MdeModulePkg/MdeModulePkg.dec",
             "MdePkg/MdePkg.dec",
-            "ShellPkg/ShellPkg.dec"
+            "ShellPkg/ShellPkg.dec",
+            "StandaloneMmPkg/StandaloneMmPkg.dec"
         ],
         # For host based unit tests
         "AcceptableDependencies-HOST_APPLICATION":[
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 04462c355922..4cd6a5879713 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -166,6 +166,9 @@ [Components.common]
   ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
   ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf
 
+  ArmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
+  ArmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+
 [Components.AARCH64]
   ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
   ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf b/ArmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
similarity index 85%
copy from StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
copy to ArmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
index a0629cbc1a6f..c6b283653882 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+++ b/ArmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
@@ -10,8 +10,8 @@
 
 [Defines]
   INF_VERSION                    = 0x0001001A
-  BASE_NAME                      = StandaloneMmCoreEntryPoint
-  FILE_GUID                      = C97AC593-109A-4C63-905C-675FDE2689E8
+  BASE_NAME                      = ArmStandaloneMmCoreEntryPoint
+  FILE_GUID                      = 0D7C6883-E1A8-4A7A-A35C-E0C200775B43
   MODULE_TYPE                    = MM_CORE_STANDALONE
   VERSION_STRING                 = 1.0
   PI_SPECIFICATION_VERSION       = 0x00010032
@@ -26,8 +26,6 @@ [Sources.AARCH64, Sources.ARM]
   Arm/SetPermissions.c
   Arm/CreateHobList.c
 
-[Sources.X64]
-  X64/StandaloneMmCoreEntryPoint.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
index a0629cbc1a6f..1c6af4d7a4a8 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
@@ -21,11 +21,6 @@ [Defines]
 #  VALID_ARCHITECTURES           = IA32 X64 IPF EBC (EBC is for build only)
 #
 
-[Sources.AARCH64, Sources.ARM]
-  Arm/StandaloneMmCoreEntryPoint.c
-  Arm/SetPermissions.c
-  Arm/CreateHobList.c
-
 [Sources.X64]
   X64/StandaloneMmCoreEntryPoint.c
 
@@ -34,32 +29,12 @@ [Packages]
   MdeModulePkg/MdeModulePkg.dec
   StandaloneMmPkg/StandaloneMmPkg.dec
 
-[Packages.ARM, Packages.AARCH64]
-  ArmPkg/ArmPkg.dec
-
 [LibraryClasses]
   BaseLib
   DebugLib
 
-[LibraryClasses.ARM, LibraryClasses.AARCH64]
-  ArmMmuLib
-  ArmSvcLib
-
 [Guids]
   gMpInformationHobGuid
   gEfiMmPeiMmramMemoryReserveGuid
   gEfiStandaloneMmNonSecureBufferGuid
   gEfiArmTfCpuDriverEpDescriptorGuid
-
-[FeaturePcd.ARM, FeaturePcd.AARCH64]
-  gArmTokenSpaceGuid.PcdFfaEnable
-
-#
-# This configuration fails for CLANGPDB, which does not support PIE in the GCC
-# sense. Such however is required for ARM family StandaloneMmCore
-# self-relocation, and thus the CLANGPDB toolchain is unsupported for ARM and
-# AARCH64 for this module.
-#
-[BuildOptions]
-  GCC:*_*_ARM_CC_FLAGS = -fpie
-  GCC:*_*_AARCH64_CC_FLAGS = -fpie
-- 
2.31.1.windows.1


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

end of thread, other threads:[~2021-11-11  0:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-11  0:24 [PATCH v3 00/14] Un-siloing Arm common code Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 01/14] ArmPkg/ArmMmuBaseLib: Disallow STANDALONE_MM Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 02/14] ArmPkg/ArmMmuStandaloneMmLib: Update to match ArmMmuLib Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 03/14] ArmPkg/StandaloneMmCoreEntryPoint: Swap to ArmMmuLib Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 04/14] ArmPkg: Disavow StandaloneMmMmuLib. It's just ArmMmuLib Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 05/14] ArmPkg and MdePkg: Move the Arm CompilerIntrinsicsLib to MdePkg Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 06/14] ArmPkg and BaseTools: Move the GccLto binaries from ArmPkg to BaseTools Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 07/14] ArmPkg and MdePkg: Move the AsmMacroIoLib from ArmPkg to MdePkg Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 08/14] MdePkg: Create the MMU access lib to abstract memory protection settings Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 09/14] ArmPkg: Add Basic MMU Lib for Arm silicon Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 10/14] MdeModulePkg: Swap to MmuLib instead of Arm-specific lib Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 11/14] StandaloneMmPkg: Switch to the MmuLib abstraction Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 12/14] ArmPkg: Move the StandaloneMmCpu driver to ArmPkg Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 13/14] StandaloneMmPkg: Add StandaloneMmCoreEntryNull to satisfy CI on all archs Bret Barkelew
2021-11-11  0:24 ` [PATCH v3 14/14] ArmPkg: Create an Arm-specific version of StandaloneMmCoreEntryPoint Bret Barkelew

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