Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe (Bugzilla Bug 1354) #7652

Closed
tianocore-issues opened this issue Nov 22, 2018 · 4 comments
Labels
package:intelframeworkmodulepkg priority:medium Moderate impact. Should be prioritized over lower priority issues. type:bug Something isn't working

Comments

@tianocore-issues
Copy link

This issue was created automatically with bugzilla2github

Bugzilla Bug 1354

Date: 2018-11-22T05:39:33+00:00
From: @niruiyu
To: @niruiyu
CC: hao.a.wu, yonghong.zhu

Last updated: 2019-07-03T01:52:12+00:00

@tianocore-issues
Copy link
Author

Comment 5689

Date: 2018-11-22 05:39:33 +0000
From: @niruiyu

  • Industry Specification: ---
  • Releases to Fix: EDK II Master
  • Target OS: ---
  • Bugzilla Assignee(s): @niruiyu

This driver is no longer be used for S3 resume because the recommended way to save S3 context is to use LockBox instead of UEFI variable due to security concern.

The new way of S3 boot support is as below:

====Normal boot path
1. MRC cuts out 1 page from SMRAM, marked it as ALLOCATED in GUIDed HOB
2. MRC creates a gEfiAcpiVariableGuid HOB, saves the ALLOCATED 1 page location.
3. Silicon module SmmAccessPei/Dxe consumes the GUIDed HOB, reports the SMRAM range for SmmIpl to use

4. UefiCpuPkg/PiSmmCpuDxeSmm driver puts SMM_S3_RESUME_STATE  in the 1 SMRAM page for S3 usage.

SMM_S3_RESUME_STATE  
  UINT64                Signature;
  EFI_PHYSICAL_ADDRESS  SmmS3ResumeEntryPoint; --> PiSmmCpuDxeSmm::SmmRestoreCpu()
  EFI_PHYSICAL_ADDRESS  SmmS3StackBase; --> 32KB SMRAM for stack
  UINT64                SmmS3StackSize;
  UINT64                SmmS3Cr0;
  UINT64                SmmS3Cr3;
  UINT64                SmmS3Cr4;
-------------------------------------------------------------- 
// Above and Smst are initialized by PiSmmCpuDxeSmm::InitSmmS3ResumeState()
// Below except Smst are initialized by S3Resume2Pei::S3RestoreConfig2()
  UINT16                ReturnCs;
  EFI_PHYSICAL_ADDRESS  ReturnEntryPoint; --> S3Resume2Pei::S3ResumeExecuteBootScript()
  EFI_PHYSICAL_ADDRESS  ReturnContext1; --> AcpiS3Context
  EFI_PHYSICAL_ADDRESS  ReturnContext2; --> EfiBootScriptExecutorVariable
  EFI_PHYSICAL_ADDRESS  ReturnStackPointer;
  EFI_PHYSICAL_ADDRESS  Smst; --> SMST


5. MdeModulePkg/Universal/Acpi/S3SaveStateDxe allocates reserved memory to hold ACPI_S3_CONTEXT.
Memory address saves to gEfiAcpiVariableGuid lockbox; Memory content saves to gEfiAcpiS3ContextGuid lockbox.
ACPI_S3_CONTEXT
  EFI_PHYSICAL_ADDRESS  AcpiFacsTable;  --> Point to ACPI table FACS
  EFI_PHYSICAL_ADDRESS  IdtrProfile; --> reserved 0-filled memory as IDT storage
  EFI_PHYSICAL_ADDRESS  S3NvsPageTableAddress; --> reserved 0-filled memory as page table storage
  EFI_PHYSICAL_ADDRESS  BootScriptStackBase; --> reserved 0-filled memory as stack storage
  UINT64                BootScriptStackSize;
  EFI_PHYSICAL_ADDRESS  S3DebugBufferAddress; --> reserved 1-filled memory as INT3 handler storage. may contains INT3 handler. Q: provided by whom?

6. MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe allocates reserved memory to hold BOOT_SCRIPT_EXECUTOR_VARIABLE.
Memory address saves to gEfiBootScriptExecutorVariableGuid lockbox; Memory content saves to gEfiBootScriptExecutorContextGuid lockbox.
BOOT_SCRIPT_EXECUTOR_VARIABLE
  EFI_PHYSICAL_ADDRESS  BootScriptExecutorEntrypoint; --> BootScriptExecutorDxe::S3BootScriptExecutorEntryFunction()

====S3 Boot path
7. [32]UefiCpuPkg/Universal/Acpi/S3Resume2Pei::S3RestoreConfig2()
a. Restores ACPI_S3_CONTEXT and BOOT_SCRIPT_EXECUTOR_VARIABLE from lockbox
b. Create page table in ACPI_S3_CONTEXT::S3NvsPageTableAddress
8. [64]EnablePaging64/SwitchStack to SMM_S3_RESUME_STATE::SmmS3ResumeEntryPoint = PiSmmCpuDxeSmm::SmmRestoreCpu() (Returning address in SMM_S3_RESUME_STATE::ReturnEntryPoint = S3Resume2Pei::S3ResumeExecuteBootScript())
a. Pre-initialize CPU features
b. SMM rebase
c. Initialize CPU features
9. [32]DisablePaging64/SwitchStack to S3Resume2Pei::S3ResumeExecuteBootScript()
a. Send SMI to all CPUs for initialization (??)
b. Close & Lock SMRAM
c. Install S3SmmInitDone PPI
d. Signal S3SmmInitDone to SMM
10. [64]EnablePaging64/SwitchStack to BOOT_SCRIPT_EXECUTOR_VARIABLE::BootScriptExecutorEntrypoint = BootScriptExecutorDxe::S3BootScriptExecutorEntryFunction() (Returnning address in PEI_S3_RESUME_STATE::ReturnEntryPoint = S3Resume2Pei::S3ResumeBootOs())
a. Set up IDT through InitializeCpuExceptionHandlers()
b. Execute Boot Script
11. [32]DisablePaging64/SwitchStack to S3Resume2Pei::S3ResumeBootOs()
a. Launch waking vector

@tianocore-issues
Copy link
Author

Comment 6419

Date: 2019-02-20 00:02:17 +0000
From: Yonghong Zhu <<yonghong.zhu>>

Offline Bug scrub: Assign to module owner

@tianocore-issues
Copy link
Author

Comment 7399

Date: 2019-05-07 19:53:38 +0000
From: Yonghong Zhu <<yonghong.zhu>>

Per edk2-stable201908 planning to update the deadline info.

@tianocore-issues
Copy link
Author

Comment 8357

Date: 2019-07-03 01:52:12 +0000
From: Hao Wu <<hao.a.wu>>

Resolved via commit:

aa7fc1c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:intelframeworkmodulepkg priority:medium Moderate impact. Should be prioritized over lower priority issues. type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant