In addition to the NVRAM emulation made dependent on S3 support in the
previous patch, if the host admin turns off S3 for the guest, there is
also no need to reserve the following ranges from the OS, as AcpiNVS type
memory (see "OvmfPkg/PlatformPei/MemoryMap.txt"):
- [0x0070000, 0x007FFFF]: early (pre-migration) SEC/PEI heap and stack
- [0x0080000, 0x0085FFF]: initial page tables from the X64 reset vector
- [0x1000000, 0x120FFFF]: temporary / scratch buffer used during firmware
decompression
Furthermore, we can allow the OS to release the decompressed firmware in
the [0x0800000, 0x0FFFFFF] range, because we can't overwrite it.
When S3 is disabled, this patch
- saves further 64 + 24 + 2112 = 2200 KB of guest RAM,
- restores PeiFvInitialization()'s behavior to what it used to be before
the S3 series.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
---
OvmfPkg/PlatformPei/Fv.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Fv.c
index e55189d..d056a5d 100644
--- a/OvmfPkg/PlatformPei/Fv.c
+++ b/OvmfPkg/PlatformPei/Fv.c
@@ -18,6 +18,7 @@
#include <Library/PeiServicesLib.h>
#include <Library/PcdLib.h>
#include <Library/EmuNvramLib.h>
+#include <Library/QemuFwCfgLib.h>
/**
@@ -45,6 +46,19 @@ PeiFvInitialization (
BuildFvHob (PcdGet32 (PcdOvmfMemFvBase), PcdGet32 (PcdOvmfMemFvSize));
+ if (QemuFwCfgS3Disabled ()) {
+ //
+ // Cover only the decompressed main firmware with a memory allocation, and
+ // allow the OS to reuse the area.
+ //
+ BuildMemoryAllocationHob (
+ PcdGet32 (PcdOvmfMemFvBase),
+ PcdGet32 (PcdOvmfMemFvSize),
+ EfiBootServicesData
+ );
+ return EFI_SUCCESS;
+ }
+
//
// Cover the initial RAM area used as stack and temporary PEI heap. The base
// constant comes from OvmfPkg/Sec/{Ia32,X64}/SecEntry.{asm,S}, the size
--
1.8.3.1
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel