audk/UefiCpuPkg/Library/MpInitLib
Eric Dong e4ff6349bf UefiCpuPkg/MpInitLib: Fix MemTest86 failure.
V2 changes:
  Update the commit message and comments in the code.

When waking vector buffer allocated by CpuDxe is tested by MemTest86
in MP mode, an error is reported because the same range of memory is
modified by both CpuDxe driver and MemTest86.

The waking vector buffer is not expected to be tested by MemTest86 if
it is allocated out because MemTest86 only tests free memory. But
current CpuDxe driver "borrows" buffer instead of allocate buffer for
waking vector buffer (through allocate & free to get the buffer
pointer, backup the buffer data before using it and restore it after
using). With this implementation, if the buffer borrowed is not used
by any other drivers, MemTest86 tool will treat it as free memory
and test it.

In order to fix the above issue, CpuDxe changes to allocate the
buffer below 1M instead of borrowing it. But directly allocating
memory below 1MB causes LegacyBios driver fails to start. LegacyBios
driver allocates memory range from
"0xA0000 - PcdEbdaReservedMemorySize" to 0xA0000 as Ebda Reserved
Memory. The minimum value for "0xA0000 - PcdEbdaReservedMemorySize"
is 0x88000. If LegacyBios driver allocate this range failed, it
asserts.

LegacyBios also reserves range from 0x60000 to
"0x60000 + PcdOpromReservedMemorySize", it will be used as Oprom
Reserve Memory. The maximum value for "0x60000 +
PcdOpromReservedMemorySize" is 0x88000. LegacyBios driver tries to
allocate these range page(4K size) by page. It just reports warning
message if some pages are already allocated by others.
Base on above investigation, one page in range 0x60000 ~ 0x88000 can
be used as the waking vector buffer.

LegacyBios driver only reports warning when page allocation in range
[0x60000, 0x88000) fails. This library is consumed by CpuDxe driver
to produce CPU Arch protocol. LagacyBios driver depends on CPU Arch
protocol which guarantees below allocation runs earlier than
LegacyBios driver.

Cc: Ray Ni <ray.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2019-04-04 14:00:32 +08:00
..
Ia32 UefiCpuPkg: Clean up source files 2018-06-28 11:19:53 +08:00
X64 UefiCpuPkg: Clean up source files 2018-06-28 11:19:53 +08:00
DxeMpInitLib.inf UefiCpuPkg/MpInitLib: Add missing Guard page setup for APs 2017-12-22 14:16:51 +08:00
DxeMpInitLib.uni UefiCpuPkg/MpInitLib: Add two instances PeiMpInitLib and DxeMpInitLib 2016-08-17 19:58:07 +08:00
DxeMpLib.c UefiCpuPkg/MpInitLib: Fix MemTest86 failure. 2019-04-04 14:00:32 +08:00
Microcode.c UefiCpuPkg/Microcode.c: Add verification before calculate CheckSum32 2019-03-06 13:48:36 +08:00
MpLib.c UefiCpuPkg/MpInitLib: Rollback old change 2a5997f8. 2018-11-05 10:39:13 +08:00
MpLib.h UefiCpuPkg/MpInitLib: Rollback old change 2a5997f8. 2018-11-05 10:39:13 +08:00
PeiMpInitLib.inf UefiCpuPkg/MpInitLib: Fix ECC issues. 2018-09-06 08:04:29 +08:00
PeiMpInitLib.uni UefiCpuPkg/MpInitLib: Add two instances PeiMpInitLib and DxeMpInitLib 2016-08-17 19:58:07 +08:00
PeiMpLib.c UefiCpuPkg/MpInitLib: Remove useless code. 2018-07-20 09:24:42 +08:00