public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Abstract allocation of PEI accessible memory
@ 2018-05-24  9:09 Ard Biesheuvel
  2018-05-24  9:09 ` [PATCH v2 1/5] OvmfPkg/PlatformBootManagerLib: add missing report status code call Ard Biesheuvel
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Ard Biesheuvel @ 2018-05-24  9:09 UTC (permalink / raw)
  To: edk2-devel
  Cc: Ard Biesheuvel, Laszlo Ersek, Leif Lindholm, Michael D Kinney,
	Liming Gao, Star Zeng, Eric Dong, Dandan Bi

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-v2

Changes since v1:
- add Laszlo's ack to #1 - #2
- move EfiAllocatePeiPages() to DxeServicesLib and drop Efi prefix
- update implementation to take EfiFreeMemoryTop into account when built
  for X64

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 (5):
  OvmfPkg/PlatformBootManagerLib: add missing report status code call
  ArmVirtPkg/PlatformBootManagerLib: add missing report status code call
  MdePkg/DxeServicesLib: introduce AllocatePeiAccessiblePages routine
  MdeModulePkg/DxeCorePerformanceLib: use AllocatePeiAccessiblePages
  MdeModulePkg/FirmwarePerformanceDataTableDxe: use
    AllocatePeiAccessiblePages

 .../PlatformBootManagerLib.inf                |  1 +
 .../PlatformBootManagerLib/QemuKernel.c       |  4 ++
 .../DxeCorePerformanceLib.c                   | 45 ++-------------
 .../FirmwarePerformanceDxe.c                  | 51 +++--------------
 .../FirmwarePerformanceDxe.inf                |  1 +
 MdePkg/Include/Library/DxeServicesLib.h       | 23 +++++++-
 .../Library/DxeServicesLib/DxeServicesLib.c   | 55 +++++++++++++++++++
 .../Library/DxeServicesLib/DxeServicesLib.inf |  3 +
 .../PlatformBootManagerLib.inf                |  1 +
 .../PlatformBootManagerLib/QemuKernel.c       |  4 ++
 10 files changed, 104 insertions(+), 84 deletions(-)

-- 
2.17.0



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

end of thread, other threads:[~2018-05-25  3:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-24  9:09 [PATCH v2 0/5] Abstract allocation of PEI accessible memory Ard Biesheuvel
2018-05-24  9:09 ` [PATCH v2 1/5] OvmfPkg/PlatformBootManagerLib: add missing report status code call Ard Biesheuvel
2018-05-24  9:09 ` [PATCH v2 2/5] ArmVirtPkg/PlatformBootManagerLib: " Ard Biesheuvel
2018-05-24  9:09 ` [PATCH v2 3/5] MdePkg/DxeServicesLib: introduce AllocatePeiAccessiblePages routine Ard Biesheuvel
2018-05-24 12:36   ` Laszlo Ersek
2018-05-24  9:09 ` [PATCH v2 4/5] MdeModulePkg/DxeCorePerformanceLib: use AllocatePeiAccessiblePages Ard Biesheuvel
2018-05-24 12:49   ` Laszlo Ersek
2018-05-24 12:54     ` Ard Biesheuvel
2018-05-24 13:09       ` Laszlo Ersek
2018-05-25  2:00       ` Bi, Dandan
2018-05-25  2:44         ` Zeng, Star
2018-05-25  3:07           ` Bi, Dandan
2018-05-24  9:09 ` [PATCH v2 5/5] MdeModulePkg/FirmwarePerformanceDataTableDxe: " Ard Biesheuvel
2018-05-24 12:53   ` Laszlo Ersek
2018-05-24 16:57 ` [PATCH v2 0/5] Abstract allocation of PEI accessible memory Kinney, Michael D

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