public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/7] ArmVirtPkg/ArmVirtQemu: avoid stores with MMU off
@ 2022-07-04 17:52 Ard Biesheuvel
  2022-07-04 17:52 ` [PATCH 1/7] ArmPkg/ArmMmuLib: don't replace table entries with block entries Ard Biesheuvel
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2022-07-04 17:52 UTC (permalink / raw)
  To: devel
  Cc: quic_llindhol, sami.mujawar, Ard Biesheuvel, Marc Zyngier,
	Alexander Graf

We currently do a substantial amount of processing before enabling the
MMU and caches, which is bad for performance, but also risky, as it
requires cache coherency to be managed by hand.

This also means that when running under virtualization, the hypervisor
must do a non-trivial amount of work to ensure that the host's cached
view of memory is consistent with the guest's uncached view.

So let's update the ArmVirtQemu early boot sequence to improve the
situation:
- instead of switching the MMU off and on again to meet
  break-before-make (BBM) requirements when running at EL1, use two sets
  of page tables and switch between then using different ASIDs;
- use a compile time generated ID map that covers the first bank of NOR
  flash, the first MMIO region (for the UART), and the first 128 MiB of
  DRAM, and switch to it straight out of reset.

The resulting build no longer performs any memory accesses via the data
side, and only relies on instruction fetches before the MMU is enabled.

Cc: Marc Zyngier <maz@kernel.org>
Cc: Alexander Graf <graf@amazon.com>

Ard Biesheuvel (7):
  ArmPkg/ArmMmuLib: don't replace table entries with block entries
  ArmPkg/ArmMmuLib: use shadow page tables for break-before-make at EL1
  ArmPkg/ArmMmuLib: permit initial configuration with MMU enabled
  ArmPlatformPkg/PrePeiCore: permit entry with the MMU enabled
  ArmVirtPkg/ArmVirtQemu: implement ArmPlatformLib with static ID map
  ArmVirtPkg/ArmVirtQemu: use first 128 MiB as permanent PEI memory
  ArmVirtPkg/ArmVirtQemu: enable initial ID map at early boot

 ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c                               |   3 +
 ArmPkg/Include/Chipset/AArch64Mmu.h                               |   1 +
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c                  | 162 ++++++++++++--------
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S          |  15 +-
 ArmPlatformPkg/PrePeiCore/PrePeiCore.c                            |  22 +--
 ArmVirtPkg/ArmVirtQemu.dsc                                        |  10 +-
 ArmVirtPkg/ArmVirtQemu.fdf                                        |   2 +-
 ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S | 111 ++++++++++++++
 ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.c        |  36 +++++
 ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf      |  36 +++++
 ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S                     |  57 +++++++
 ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c                         |  89 +++++++++++
 ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf                       |  66 ++++++++
 13 files changed, 530 insertions(+), 80 deletions(-)
 create mode 100644 ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S
 create mode 100644 ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.c
 create mode 100644 ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf
 create mode 100644 ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S
 create mode 100644 ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c
 create mode 100644 ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf

-- 
2.35.1


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

end of thread, other threads:[~2022-07-04 17:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-04 17:52 [PATCH 0/7] ArmVirtPkg/ArmVirtQemu: avoid stores with MMU off Ard Biesheuvel
2022-07-04 17:52 ` [PATCH 1/7] ArmPkg/ArmMmuLib: don't replace table entries with block entries Ard Biesheuvel
2022-07-04 17:52 ` [PATCH 2/7] ArmPkg/ArmMmuLib: use shadow page tables for break-before-make at EL1 Ard Biesheuvel
2022-07-04 17:52 ` [PATCH 3/7] ArmPkg/ArmMmuLib: permit initial configuration with MMU enabled Ard Biesheuvel
2022-07-04 17:52 ` [PATCH 4/7] ArmPlatformPkg/PrePeiCore: permit entry with the " Ard Biesheuvel
2022-07-04 17:52 ` [PATCH 5/7] ArmVirtPkg/ArmVirtQemu: implement ArmPlatformLib with static ID map Ard Biesheuvel
2022-07-04 17:52 ` [PATCH 6/7] ArmVirtPkg/ArmVirtQemu: use first 128 MiB as permanent PEI memory Ard Biesheuvel
2022-07-04 17:52 ` [PATCH 7/7] ArmVirtPkg/ArmVirtQemu: enable initial ID map at early boot Ard Biesheuvel

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