[edk2-devel] [PATCH v3 25/35] OvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux

Anthony PERARD anthony.perard at citrix.com
Thu Jul 4 14:42:23 UTC 2019


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 at citrix.com>
Acked-by: Laszlo Ersek <lersek at redhat.com>
---

Notes:
    v3:
    - fix commit message

 OvmfPkg/XenPlatformPei/Xen.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
index 62a2c3ed93..9866b7c212 100644
--- a/OvmfPkg/XenPlatformPei/Xen.c
+++ b/OvmfPkg/XenPlatformPei/Xen.c
@@ -291,6 +291,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);

+

   for (Index = 0; Index < E820EntriesCount; Index++) {

     UINT64 Base;

     UINT64 End;

@@ -304,6 +310,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);

-- 
Anthony PERARD


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43309): https://edk2.groups.io/g/devel/message/43309
Mute This Topic: https://groups.io/mt/32308733/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list