From 3a69f7cbe7289fae061ce3d0facda254bf3c82e5 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Wed, 2 May 2012 02:23:18 +0000 Subject: [PATCH] UefiCpuPkg S3Resume2: Move the call to RestoreS3PageTables() earlier before SMM S3 resume. SMM S3 resume may change memory cache type for flash memory range and thus RestoreS3PageTables() in which loops are executed to create page table would have negative performance impact on S3 resume. Move the call to RestoreS3PageTables() earlier before SMM S3 resume can avoid this issue. Signed-off-by: Sun Rui Reviewed-by: Yao Jiewen git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13231 6f19259b-4bc3-4df7-8a09-765794883524 --- UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c index 50b2f7bc0a..f176f9b52b 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c @@ -696,10 +696,6 @@ S3ResumeExecuteBootScript ( } if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { - // - // Need reconstruct page table here, since we do not trust ACPINvs. - // - RestoreS3PageTables ((UINTN)AcpiS3Context->S3NvsPageTableAddress); AsmWriteCr3 ((UINTN)AcpiS3Context->S3NvsPageTableAddress); } @@ -906,6 +902,13 @@ S3RestoreConfig2 ( CpuDeadLoop (); } + if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { + // + // Need reconstruct page table here, since we do not trust ACPINvs. + // + RestoreS3PageTables ((UINTN)AcpiS3Context->S3NvsPageTableAddress); + } + // // Attempt to use content from SMRAM first //