public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb@kernel.org>, Ray Ni <ray.ni@intel.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Taylor Beebe <t@taylorbeebe.com>,
	Oliver Smith-Denny <osd@smith-denny.com>,
	Dandan Bi <dandan.bi@intel.com>, Dun Tan <dun.tan@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>
Subject: [PATCH v2 0/7] Add PPI to manage PEI phase memory attributes
Date: Fri,  2 Jun 2023 17:17:32 +0200	[thread overview]
Message-ID: <20230602151739.3600820-1-ardb@kernel.org> (raw)

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

This is a followup to the RFC that I sent to the edk2-devel list on the
25th of May.

In an attempt to make some incremental progress, this v2 only covers the
NX remapping of the DXE stack in DxeIpl, using the newly introduced
memory attributes PPI.

Other use cases are deferred until we can converge on an approach that
works across architectures and platforms. In particular, this means the
following use cases:
- mapping the DXE core code and data regions RO and XP, respectively;
- mapping shadowed PEIMs read-only (including the PEI core itself);
- managing memory permissions after temporary RAM migration;
- reorganizing the X64 PEI flow with respect to page table allocation;
- managing the dispatch order of the PEIM producing the PPI in relation
  to its consumers.

The current series specifies the PPI in patch #1, and wires it up into
DxeIpl to remap the DXE stack non-executable in a generic manner
(patches #2 and #3)

Patches #4 and #5 implement the PPI for ARM and AArch64.

Patch #6 switches ARM and AArch64 over to the generic DxeIpl.

Patch #7 cleans up the ARM implementation of the UEFI memory attributes
protocol, based on the improvements made in patch #4. 

Changes since RFC (in addition to the above):
- update PPI protype to use attributes+mask instead of setmask+clearmask
- drop OVMF patch for RISC-V that has been applied in the meantime

Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Taylor Beebe <t@taylorbeebe.com>
Cc: Oliver Smith-Denny <osd@smith-denny.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>

Ard Biesheuvel (7):
  MdeModulePkg: Define memory attribute PPI
  MdeModulePkg/DxeIpl: Merge EBC, RISCV64 and LOONGARCH code
  MdeModulePkg/DxeIpl: Use memory attribute PPI to remap the stack NX
  ArmPkg/ArmMmuLib: Extend API to manage memory permissions better
  ArmPkg/CpuPei: Implement the memory attributes PPI
  MdeModulePkg/DxeIpl ARM AARCH64: Switch to generic handoff code
  ArmPkg/CpuDxe: Simplify memory attributes protocol implementation

 ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c                             |  2 +-
 ArmPkg/Drivers/CpuDxe/MemoryAttribute.c                          | 50 +----------
 ArmPkg/Drivers/CpuPei/CpuPei.c                                   | 76 +++++++++++++++++
 ArmPkg/Drivers/CpuPei/CpuPei.inf                                 |  4 +
 ArmPkg/Include/Library/ArmMmuLib.h                               | 36 +++++++-
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c                 | 52 +++++++++++-
 ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibUpdate.c                   | 88 +++++++++++++++++---
 ArmPkg/Library/OpteeLib/Optee.c                                  |  2 +-
 MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c                   | 71 ----------------
 MdeModulePkg/Core/DxeIplPeim/{Ebc/DxeLoadFunc.c => DxeHandoff.c} | 31 ++++++-
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf                          | 24 ++----
 MdeModulePkg/Core/DxeIplPeim/LoongArch64/DxeLoadFunc.c           | 63 --------------
 MdeModulePkg/Core/DxeIplPeim/RiscV64/DxeLoadFunc.c               | 75 -----------------
 MdeModulePkg/Include/Ppi/MemoryAttribute.h                       | 83 ++++++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                                    |  3 +
 15 files changed, 366 insertions(+), 294 deletions(-)
 delete mode 100644 MdeModulePkg/Core/DxeIplPeim/Arm/DxeLoadFunc.c
 rename MdeModulePkg/Core/DxeIplPeim/{Ebc/DxeLoadFunc.c => DxeHandoff.c} (62%)
 delete mode 100644 MdeModulePkg/Core/DxeIplPeim/LoongArch64/DxeLoadFunc.c
 delete mode 100644 MdeModulePkg/Core/DxeIplPeim/RiscV64/DxeLoadFunc.c
 create mode 100644 MdeModulePkg/Include/Ppi/MemoryAttribute.h

-- 
2.39.2


             reply	other threads:[~2023-06-02 15:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 15:17 Ard Biesheuvel [this message]
2023-06-02 15:17 ` [PATCH v2 1/7] MdeModulePkg: Define memory attribute PPI Ard Biesheuvel
2023-06-02 15:17 ` [PATCH v2 2/7] MdeModulePkg/DxeIpl: Merge EBC, RISCV64 and LOONGARCH code Ard Biesheuvel
2023-06-06 18:48   ` [edk2-devel] " Michael Kubacki
2023-06-06 22:17     ` Ard Biesheuvel
2023-06-06 23:07       ` Michael Kubacki
2023-06-02 15:17 ` [PATCH v2 3/7] MdeModulePkg/DxeIpl: Use memory attribute PPI to remap the stack NX Ard Biesheuvel
2023-06-02 15:17 ` [PATCH v2 4/7] ArmPkg/ArmMmuLib: Extend API to manage memory permissions better Ard Biesheuvel
2023-06-02 15:17 ` [PATCH v2 5/7] ArmPkg/CpuPei: Implement the memory attributes PPI Ard Biesheuvel
2023-06-02 15:17 ` [PATCH v2 6/7] MdeModulePkg/DxeIpl ARM AARCH64: Switch to generic handoff code Ard Biesheuvel
2023-06-02 15:17 ` [PATCH v2 7/7] ArmPkg/CpuDxe: Simplify memory attributes protocol implementation Ard Biesheuvel
2023-06-06 16:42 ` [edk2-devel] [PATCH v2 0/7] Add PPI to manage PEI phase memory attributes Oliver Smith-Denny
2023-06-06 23:12 ` Michael Kubacki
2023-06-25  2:58   ` 回复: [edk2-devel] " gaoliming
2023-06-26  9:16     ` Ard Biesheuvel

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=20230602151739.3600820-1-ardb@kernel.org \
    --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