]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux
authorAnthony PERARD <anthony.perard@citrix.com>
Tue, 13 Aug 2019 11:31:08 +0000 (12:31 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 21 Aug 2019 16:03:49 +0000 (18:03 +0200)
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 <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-25-anthony.perard@citrix.com>

OvmfPkg/XenPlatformPei/Xen.c

index c4506def9a2b120670bcc6f825a545bdfd2607ce..c41fecdc486e7f816e59ca475f462726406997e0 100644 (file)
@@ -294,6 +294,12 @@ XenPublishRamRegions (
   Status = XenGetE820Map (&E820Map, &E820EntriesCount);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  AddMemoryBaseSizeHob (0, 0xA0000);\r
+  //\r
+  // Video memory + Legacy BIOS region, to allow Linux to boot.\r
+  //\r
+  AddReservedMemoryBaseSizeHob (0xA0000, BASE_1MB - 0xA0000, TRUE);\r
+\r
   LapicBase = PcdGet32 (PcdCpuLocalApicBaseAddress);\r
   LapicEnd = LapicBase + SIZE_1MB;\r
   AddIoMemoryRangeHob (LapicBase, LapicEnd);\r
@@ -312,6 +318,16 @@ XenPublishRamRegions (
     Base = ALIGN_VALUE (Entry->BaseAddr, (UINT64)EFI_PAGE_SIZE);\r
     End = (Entry->BaseAddr + Entry->Length) & ~(UINT64)EFI_PAGE_MASK;\r
 \r
+    //\r
+    // Ignore the first 1MB, this is handled before the loop.\r
+    //\r
+    if (Base < BASE_1MB) {\r
+      Base = BASE_1MB;\r
+    }\r
+    if (Base >= End) {\r
+      continue;\r
+    }\r
+\r
     switch (Entry->Type) {\r
     case EfiAcpiAddressRangeMemory:\r
       AddMemoryRangeHob (Base, End);\r