Skip to content

Commit

Permalink
OvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux
Browse files Browse the repository at this point in the history
Linux panic if the VGA region isn't reserved.

When Linux is booted on EFI system, it expects the memory at 0xa0000 to
_not_ be conventional memory. Otherwise a variable isn't initialised
properly and Linux panic when a virtual console/terminal is asked to be
created.

See for more detail:
https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg02139.html

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <[email protected]>
Acked-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
anthonyper-ctx authored and lersek committed Aug 21, 2019
1 parent 24465c3 commit 77d35f5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions OvmfPkg/XenPlatformPei/Xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ XenPublishRamRegions (
Status = XenGetE820Map (&E820Map, &E820EntriesCount);
ASSERT_EFI_ERROR (Status);

AddMemoryBaseSizeHob (0, 0xA0000);
//
// Video memory + Legacy BIOS region, to allow Linux to boot.
//
AddReservedMemoryBaseSizeHob (0xA0000, BASE_1MB - 0xA0000, TRUE);

LapicBase = PcdGet32 (PcdCpuLocalApicBaseAddress);
LapicEnd = LapicBase + SIZE_1MB;
AddIoMemoryRangeHob (LapicBase, LapicEnd);
Expand All @@ -312,6 +318,16 @@ XenPublishRamRegions (
Base = ALIGN_VALUE (Entry->BaseAddr, (UINT64)EFI_PAGE_SIZE);
End = (Entry->BaseAddr + Entry->Length) & ~(UINT64)EFI_PAGE_MASK;

//
// Ignore the first 1MB, this is handled before the loop.
//
if (Base < BASE_1MB) {
Base = BASE_1MB;
}
if (Base >= End) {
continue;
}

switch (Entry->Type) {
case EfiAcpiAddressRangeMemory:
AddMemoryRangeHob (Base, End);
Expand Down

0 comments on commit 77d35f5

Please sign in to comment.