public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"bret@corthon.com" <bret@corthon.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
	"Sean Brogan" <sean.brogan@microsoft.com>
Subject: Re: [edk2-devel] [PATCH v1 10/16] StandaloneMmPkg: Switch to the MmuLib abstraction
Date: Tue, 2 Nov 2021 00:25:51 +0000	[thread overview]
Message-ID: <PH0PR11MB4885C6E76A9270ECBF875A578C8B9@PH0PR11MB4885.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211101195648.6420-11-brbarkel@microsoft.com>

Acked-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bret
> Barkelew
> Sent: Tuesday, November 2, 2021 3:57 AM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Sami Mujawar
> <sami.mujawar@arm.com>; Yao, Jiewen <jiewen.yao@intel.com>; Supreeth
> Venkatesh <supreeth.venkatesh@arm.com>; Sean Brogan
> <sean.brogan@microsoft.com>
> Subject: [edk2-devel] [PATCH v1 10/16] StandaloneMmPkg: Switch to the
> MmuLib abstraction
> 
> 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/Stand
> aloneMmPeCoffExtraActionLib.c | 50 ++++++++++++++++++--
> 
> StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneMm
> PeCoffExtraActionLib.inf       |  3 +-
>  StandaloneMmPkg/StandaloneMmPkg.dsc                                                                 |
> 1 +
>  3 files changed, 47 insertions(+), 7 deletions(-)
> 
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/Sta
> ndaloneMmPeCoffExtraActionLib.c
> b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/Sta
> ndaloneMmPeCoffExtraActionLib.c
> index ca8b1244a313..ca3b9de26a6f 100644
> ---
> a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/Sta
> ndaloneMmPeCoffExtraActionLib.c
> +++
> b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/Sta
> ndaloneMmPeCoffExtraActionLib.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,46 @@ UpdatePeCoffPermissions (
>    return RETURN_SUCCESS;
> 
>  }
> 
> 
> 
> +STATIC
> 
> +EFI_STATUS
> 
> +ArmPeSetMemoryRegionNoExec (
> 
> +  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
> 
> +  IN  UINT64                    Length
> 
> +  )
> 
> +{
> 
> +  return MmuSetAttributes (BaseAddress, Length, EFI_MEMORY_XP);
> 
> +}
> 
> +
> 
> +STATIC
> 
> +EFI_STATUS
> 
> +ArmPeClearMemoryRegionNoExec (
> 
> +  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
> 
> +  IN  UINT64                    Length
> 
> +  )
> 
> +{
> 
> +  return MmuClearAttributes (BaseAddress, Length, EFI_MEMORY_XP);
> 
> +}
> 
> +
> 
> +STATIC
> 
> +EFI_STATUS
> 
> +ArmPeSetMemoryRegionReadOnly (
> 
> +  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,
> 
> +  IN  UINT64                    Length
> 
> +  )
> 
> +{
> 
> +  return MmuSetAttributes (BaseAddress, Length, EFI_MEMORY_RO);
> 
> +}
> 
> +
> 
> +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 +220,8 @@ PeCoffLoaderRelocateImageExtraAction (
>  {
> 
>    UpdatePeCoffPermissions (
> 
>      ImageContext,
> 
> -    ArmClearMemoryRegionNoExec,
> 
> -    ArmSetMemoryRegionReadOnly
> 
> +    ArmPeClearMemoryRegionNoExec,
> 
> +    ArmPeSetMemoryRegionReadOnly
> 
>      );
> 
>  }
> 
> 
> 
> @@ -205,7 +245,7 @@ PeCoffLoaderUnloadImageExtraAction (
>  {
> 
>    UpdatePeCoffPermissions (
> 
>      ImageContext,
> 
> -    ArmSetMemoryRegionNoExec,
> 
> -    ArmClearMemoryRegionReadOnly
> 
> +    ArmPeSetMemoryRegionNoExec,
> 
> +    ArmPeClearMemoryRegionReadOnly
> 
>      );
> 
>  }
> 
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneM
> mPeCoffExtraActionLib.inf
> b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneM
> mPeCoffExtraActionLib.inf
> index 89083df679a1..25306dd3e707 100644
> ---
> a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneM
> mPeCoffExtraActionLib.inf
> +++
> b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/StandaloneM
> mPeCoffExtraActionLib.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 2c0c9396d633..d3e8d250d972 100644
> --- a/StandaloneMmPkg/StandaloneMmPkg.dsc
> +++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
> @@ -59,6 +59,7 @@ [LibraryClasses]
> 
> StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreE
> ntryPoint/StandaloneMmCoreEntryPoint.inf
> 
> 
> StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoin
> t/StandaloneMmDriverEntryPoint.inf
> 
> 
> VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/V
> ariableMmDependency.inf
> 
> +  MmuLib|MdePkg/Library/BaseMmuLibNull/BaseMmuLibNull.inf
> 
> 
> 
>  [LibraryClasses.AARCH64, LibraryClasses.ARM]
> 
>    ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> 
> --
> 2.31.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#83040): https://edk2.groups.io/g/devel/message/83040
> Mute This Topic: https://groups.io/mt/86750657/1772286
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [jiewen.yao@intel.com]
> -=-=-=-=-=-=
> 


  reply	other threads:[~2021-11-02  0:25 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 19:56 [PATCH v1 00/16] Un-siloing Arm common code Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 01/16] ArmPkg/ArmMmuBaseLib: Disallow STANDALONE_MM Bret Barkelew
2021-11-02  8:43   ` Leif Lindholm
2021-11-02  8:50     ` [edk2-devel] " ryan.harkin
2021-11-02  9:03       ` Leif Lindholm
2021-11-02  9:26   ` Leif Lindholm
2021-11-01 19:56 ` [PATCH v1 02/16] ArmPkg/ArmMmuStandaloneMmLib: Update to match ArmMmuLib Bret Barkelew
2021-11-02  9:34   ` Leif Lindholm
2021-11-02  9:39     ` Leif Lindholm
2021-11-01 19:56 ` [PATCH v1 03/16] ArmPkg/StandaloneMmCoreEntryPoint: Swap to ArmMmuLib Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 04/16] ArmPkg: Disavow StandaloneMmMmuLib. It's just ArmMmuLib Bret Barkelew
2021-11-02  9:39   ` Leif Lindholm
2021-11-01 19:56 ` [PATCH v1 05/16] ArmPkg and MdePkg: Move the Arm CompilerIntrinsicsLib to MdePkg Bret Barkelew
2021-11-02  9:50   ` Leif Lindholm
2021-11-02 19:44     ` [EXTERNAL] Re: [edk2-devel] " Bret Barkelew
2021-11-04  6:23     ` 回复: " gaoliming
2021-11-04  6:24       ` Andrew Fish
2021-11-04 17:23         ` Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 06/16] ArmPkg and BaseTools: Move the GccLto binaries from ArmPkg to BaseTools Bret Barkelew
2021-11-02  9:55   ` Leif Lindholm
2021-11-02 19:45     ` [EXTERNAL] Re: [edk2-devel] " Bret Barkelew
2021-11-02 23:34       ` [EXTERNAL] " Andrew Fish
2021-11-03 11:03         ` Leif Lindholm
2021-11-03 15:35         ` Bob Feng
2021-11-03 16:08           ` Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 07/16] ArmPkg and MdePkg: Move the AsmMacroIoLib from ArmPkg to MdePkg Bret Barkelew
2021-11-02  1:52   ` 回复: " gaoliming
2021-11-02  9:24   ` Leif Lindholm
2021-11-02 19:48     ` Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 08/16] MdePkg: Create the MMU access lib to abstract memory protection settings Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 09/16] MdeModulePkg: Swap to MmuLib instead of Arm-specific lib Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 10/16] StandaloneMmPkg: Switch to the MmuLib abstraction Bret Barkelew
2021-11-02  0:25   ` Yao, Jiewen [this message]
2021-11-01 19:56 ` [PATCH v1 11/16] ArmPkg: Add Basic MMU Lib for Arm silicon Bret Barkelew
2021-11-02  9:57   ` Leif Lindholm
2021-11-02 19:51     ` Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 12/16] ArmPkg: Move the StandaloneMmCpu driver to ArmPkg Bret Barkelew
2021-11-02 10:00   ` Leif Lindholm
2021-11-02 19:53     ` Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 13/16] ArmPkg: Move the StandaloneMmCoreEntryPoint lib " Bret Barkelew
2021-11-02 10:00   ` Leif Lindholm
2021-11-01 19:56 ` [PATCH v1 14/16] ArmPkg/Library: Convert StandaloneMmCoreEntryPoint to Arm-only Bret Barkelew
2021-11-02 10:05   ` Leif Lindholm
2021-11-01 19:56 ` [PATCH v1 15/16] ArmPkg/ArmPkg.dsc: Resolve build errors resulting from package moves Bret Barkelew
2021-11-01 19:56 ` [PATCH v1 16/16] ArmPlatformPkg/ArmPlatformPkg.dsc: " Bret Barkelew
2021-11-02  0:26 ` [edk2-devel] [PATCH v1 00/16] Un-siloing Arm common code Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR11MB4885C6E76A9270ECBF875A578C8B9@PH0PR11MB4885.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox