[edk2-devel] [PATCH 1/1] OvmfPkg/PlatformInitLib: pass through reservations from qemu

Gerd Hoffmann kraxel at redhat.com
Wed Dec 7 05:32:15 UTC 2022


qemu uses the etc/e820 fw_cfg file not only for memory, but
also for reservations.  Handle reservations by adding resource
descriptor hobs for them.

A typical qemu configuration has a small reservation between
lapic and flash:

  # sudo cat /proc/iomem
  [ ... ]
  fee00000-fee00fff : Local APIC
  feffc000-feffffff : Reserved          <= HERE
  ffc00000-ffffffff : Reserved
  [ ... ]

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index b8feae4309de..a7a4e028ad50 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -228,6 +228,22 @@ PlatformScanOrAdd64BitE820Ram (
             ));
         }
       }
+    } else if (E820Entry.Type == EfiAcpiAddressRangeReserved) {
+      if (AddHighHob) {
+        DEBUG ((
+          DEBUG_INFO,
+          "%a: Reserved: Base=0x%Lx Length=0x%Lx\n",
+          __FUNCTION__,
+          E820Entry.BaseAddr,
+          E820Entry.Length
+          ));
+        BuildResourceDescriptorHob (
+          EFI_RESOURCE_MEMORY_RESERVED,
+          0,
+          E820Entry.BaseAddr,
+          E820Entry.Length
+          );
+      }
     }
   }
 
-- 
2.38.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97066): https://edk2.groups.io/g/devel/message/97066
Mute This Topic: https://groups.io/mt/95510762/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