Please refer to the last patch in the series to appreciate the complexity here. I'd like to ask interested people in the community to read through the commit messages (*) and point out if I'm missing something.
(*) There isn't much code in the series, it's mostly duct tape. The difficulty is figuring out what depends on what and how. I'm not even trying to create an S3 Boot Script yet, just getting up the infrastructure. Currently I have two problems, a small one and a big one. The small one is that S3Resume2Pei depends on a PPI (EFI_PEI_SMM_COMMUNICATION_PPI) that doesn't exist in the edk2 tree. The implementation would be interesting, considering that during DXE the entire SMM core, 2-3 libraries, and a dedicated driver are necessary to implement it. This is a small hurdle because S3Resume2Pei can restore saved data differently too, by poking directly into the SMM LockBox structures. I've gone that way, but the hackery in that part of the series (around DiscloseSmstSmm) is horrible. Anyway. The big problem is that nothing ever installs EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL. As a consequence, the boot script is never saved (not even an empty one), *and* BootScriptExecutorDxe never copies itself to reserved memory (in order to survive the suspension). Symptoms are: - the "SMM IPL! DXE SMM Ready To Lock Protocol not installed before Ready To Boot signal" warning when I boot a boot option, - when I try to resume, the third RestoreLockBox() call in S3RestoreConfig2() fails, and the next assertion fails: VarSize = sizeof (EFI_PHYSICAL_ADDRESS); Status = RestoreLockBox ( &gEfiBootScriptExecutorVariableGuid, &TempEfiBootScriptExecutorVariable, &VarSize ); ASSERT_EFI_ERROR (Status); Of course I can install/emit EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL myself. I just don't know *when* to install it. As I wrote in the commit messages below, BdsLibBootViaBootOption() calls into EFI_ACPI_S3_SAVE_PROTOCOL [AcpiS3SaveDxe], and it needs SMRAM access. So, I can't install DXE_SMM_READY_TO_LOCK earlier than that. OTOH, I don't have control over any code that runs *after* it. Maybe I could install DXE_SMM_READY_TO_LOCK from a ready-to-boot event handler, but the SMM core & drivers already seem to install a bunch of stuff on that event, and I'm not sure the ordering between the handlers would be correct. Thoughts? Thanks. Laszlo Ersek (15): OvmfPkg: PlatformPei: reserve RAM as SMRAM backing store OvmfPkg: S3 Suspend: introduce EmuSmmDxe for emulating SMRAM OvmfPkg: S3 Suspend: pull in DXE driver for EFI_SMM_COMMUNICATION_PROTOCOL MdeModulePkg: SmmLockBox: remove wrong DepEx OvmfPkg: S3 Suspend: pull in SmmLockBox driver OvmfPkg: S3 Suspend: use SMM instances for LockBoxLib library class OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe OvmfPkg: S3 Suspend: save ACPI context OvmfPkg: S3 Suspend: enable creation/saving of an S3 Boot Script OvmfPkg: PlatformPei: reserve storage for disclosing SMST OvmfPkg: S3 Suspend: introduce DiscloseSmstSmm driver OvmfPkg: S3 Resume: introduce EmuSmmPei for emulating SMRAM in PEI OvmfPkg: S3 Resume: pull in BootScriptExecutorDxe OvmfPkg: S3 Resume: pull in PEIM orchestrating S3 Resume OvmfPkg: S3 Resume: detect S3 Resume in CMOS and set boot mode accordingly .../Universal/LockBox/SmmLockBox/SmmLockBox.inf | 3 +- OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf | 76 +++ OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf | 51 ++ OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf | 55 ++ OvmfPkg/EmuSmmPei/EmuSmmPei.inf | 60 +++ OvmfPkg/PlatformPei/PlatformPei.inf | 3 + OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.h | 59 +++ OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c | 556 +++++++++++++++++++++ OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.c | 38 ++ OvmfPkg/EmuSmmDxe/EmuSmmDxe.c | 276 ++++++++++ OvmfPkg/EmuSmmPei/EmuSmmPei.c | 285 +++++++++++ OvmfPkg/PlatformPei/Platform.c | 35 +- OvmfPkg/OvmfPkg.dec | 16 + OvmfPkg/OvmfPkgX64.dsc | 47 +- OvmfPkg/OvmfPkgX64.fdf | 26 + 15 files changed, 1581 insertions(+), 5 deletions(-) create mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf create mode 100644 OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.inf create mode 100644 OvmfPkg/EmuSmmDxe/EmuSmmDxe.inf create mode 100644 OvmfPkg/EmuSmmPei/EmuSmmPei.inf create mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.h create mode 100644 OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c create mode 100644 OvmfPkg/DiscloseSmstSmm/DiscloseSmstSmm.c create mode 100644 OvmfPkg/EmuSmmDxe/EmuSmmDxe.c create mode 100644 OvmfPkg/EmuSmmPei/EmuSmmPei.c -- 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=84349351&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel