mbox series

[edk2,0/6] Abstract allocation of PEI accessible memory

Message ID 20180522140850.30369-1-ard.biesheuvel@linaro.org
Headers show
Series Abstract allocation of PEI accessible memory | expand

Message

Ard Biesheuvel May 22, 2018, 2:08 p.m. UTC
At the moment, FirmwarePerformanceTableDataDxe or DxeCorePerformanceLib
are unusable on systems such as AMD Seattle, because they unconditionally
attempt to allocate memory below 4 GB, and ASSERT() if this fails. On AMD
Seattle, no 32-bit addressable DRAM exists, and so the driver will always
assert, and crash a running DEBUG build.

The reason for this is that some platforms (i.e., X64 builds consisting of
a 32-bit PEI stage and 64-bit remaining stages) require these allocations
to be below 4 GB, and for some reason, open coding this practice throughout
the code without regard for other architectures has been regarded as an
acceptable approach.

Instead, I would like to propose the approach implemented in this series:
- create an abstracted EfiAllocatePeiAccessiblePages() routine in UefiLib
  that simply allocates pages from any region on all architectures except
  X64, and allocate below 4 GB for X64
- update the various call sites with calls to this new function.

The above is implemented in patches #3 - #6. Patches #1 and #2 are fixes
for issues that I observed in ArmVirtPkg and OvmfPkg while working on
these patches.

Code can be found here:
https://github.com/ardbiesheuvel/edk2/tree/allocate-pei

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com> 

Ard Biesheuvel (6):
  OvmfPkg/PlatformBootManagerLib: add missing report status code call
  ArmVirtPkg/PlatformBootManagerLib: add missing report status code call
  MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine
  IntelFrameworkPkg/FrameworkUefiLib: add EfiAllocatePeiAccessiblePages
    routine
  MdeModulePkg/DxeCorePerformanceLib: use EfiAllocatePeiAccessiblePages
  MdeModulePkg/FirmwarePerformanceDataTableDxe: use
    EfiAllocatePeiAccessiblePages

 .../PlatformBootManagerLib.inf                |  1 +
 .../PlatformBootManagerLib/QemuKernel.c       |  4 ++
 .../Library/FrameworkUefiLib/UefiLib.c        | 48 ++++++++++++++++++
 .../DxeCorePerformanceLib.c                   | 45 ++---------------
 .../FirmwarePerformanceDxe.c                  | 50 +++----------------
 MdePkg/Include/Library/UefiLib.h              | 23 +++++++++
 MdePkg/Library/UefiLib/UefiLib.c              | 48 ++++++++++++++++++
 .../PlatformBootManagerLib.inf                |  1 +
 .../PlatformBootManagerLib/QemuKernel.c       |  4 ++
 9 files changed, 141 insertions(+), 83 deletions(-)

-- 
2.17.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel