public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] OvmfPkg/PlatformInitLib: pass through reservations from qemu
@ 2022-12-07  5:32 Gerd Hoffmann
  2022-12-23 11:55 ` [edk2-devel] " Ard Biesheuvel
  2023-01-12 17:09 ` Lendacky, Thomas
  0 siblings, 2 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2022-12-07  5:32 UTC (permalink / raw)
  To: devel
  Cc: Oliver Steffen, Gerd Hoffmann, Ard Biesheuvel, Jordan Justen,
	Jiewen Yao, Pawel Polawski

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@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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-17 21:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07  5:32 [PATCH 1/1] OvmfPkg/PlatformInitLib: pass through reservations from qemu Gerd Hoffmann
2022-12-23 11:55 ` [edk2-devel] " Ard Biesheuvel
2023-01-12 17:09 ` Lendacky, Thomas
2023-01-16 17:09   ` Ard Biesheuvel
2023-01-16 20:10     ` Lendacky, Thomas
2023-01-17 16:49       ` Ard Biesheuvel
2023-01-17 21:43         ` Lendacky, Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox