public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch][edk2-platforms/devel-MinnowBoard3] Fix S3 resume failure
@ 2017-04-12  6:52 Guo, Mang
  2017-04-12  8:14 ` Wei, David
  0 siblings, 1 reply; 2+ messages in thread
From: Guo, Mang @ 2017-04-12  6:52 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Wei, David, Lu, ShifeiX A

When restoring MSR for S3 setting, SmmStartupThisAp will return error if CPU index is BSP. This issue caused S3 resume failed sometimes. This patch is mainly fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Mang <mang.guo@intel.com>
---
 .../PlatformDsc/PcdsFeatureFlag.dsc                |  7 ++++++-
 .../Cpu/PowerManagement/Smm/PowerMgmtS3.c          | 23 ++++++++++++----------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc
index 6762a41..19e27ad 100644
--- a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc
+++ b/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform Feature Pcd Description.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -91,3 +91,8 @@
   # new core to see if we can re-enable this
   gPlatformModuleTokenSpaceGuid.PcdDeprecatedFunctionRemove|FALSE
 
+  ## Indicates if SMM Startup AP in a blocking fashion.
+  #   TRUE  - SMM Startup AP in a blocking fashion.<BR>
+  #   FALSE - SMM Startup AP in a non-blocking fashion.<BR>
+  # @Prompt SMM Startup AP in a blocking fashion.
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmBlockStartupThisAp|FALSE
\ No newline at end of file
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c b/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c
index 4385320..eb36343 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c
@@ -1,7 +1,7 @@
 /** @file
   This is the SMM driver for saving and restoring the powermanagement related MSRs.
 
-  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -140,15 +140,18 @@ RunOnAllLogicalProcessors (
   // Run the procedure on all logical processors.
   //
   (*Procedure) (Buffer);
-  for (Index = 1; Index < gSmst->NumberOfCpus; Index++) {
-    Status = EFI_NOT_READY;
-    while (Status != EFI_SUCCESS) {
-      Status = gSmst->SmmStartupThisAp (Procedure, Index, Buffer);
-      if (Status != EFI_SUCCESS) {
-        //
-        // SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
-        //
-        MicroSecondDelay (PPM_WAIT_PERIOD);
+  for (Index = 0; Index < gSmst->NumberOfCpus; Index++) {
+    if (Index != gSmst->CurrentlyExecutingCpu) {
+      Status = EFI_NOT_READY;
+      while (Status != EFI_SUCCESS) {
+        Status = gSmst->SmmStartupThisAp (Procedure, Index, Buffer);
+        ASSERT(Status != EFI_INVALID_PARAMETER);
+        if (Status != EFI_SUCCESS) {
+          //
+          // SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
+          //
+          MicroSecondDelay (PPM_WAIT_PERIOD);
+        }
       }
     }
   }
-- 
2.10.1.windows.1



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

* Re: [Patch][edk2-platforms/devel-MinnowBoard3] Fix S3 resume failure
  2017-04-12  6:52 [Patch][edk2-platforms/devel-MinnowBoard3] Fix S3 resume failure Guo, Mang
@ 2017-04-12  8:14 ` Wei, David
  0 siblings, 0 replies; 2+ messages in thread
From: Wei, David @ 2017-04-12  8:14 UTC (permalink / raw)
  To: Guo, Mang, edk2-devel@lists.01.org; +Cc: Lu, ShifeiX A

Reviewed-by: zwei4  <david.wei@intel.com> 

Thanks,
David  Wei                                 

-----Original Message-----
From: Guo, Mang 
Sent: Wednesday, April 12, 2017 2:52 PM
To: edk2-devel@lists.01.org
Cc: Wei, David <david.wei@intel.com>; Lu, ShifeiX A <shifeix.a.lu@intel.com>
Subject: [Patch][edk2-platforms/devel-MinnowBoard3] Fix S3 resume failure

When restoring MSR for S3 setting, SmmStartupThisAp will return error if CPU index is BSP. This issue caused S3 resume failed sometimes. This patch is mainly fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Mang <mang.guo@intel.com>
---
 .../PlatformDsc/PcdsFeatureFlag.dsc                |  7 ++++++-
 .../Cpu/PowerManagement/Smm/PowerMgmtS3.c          | 23 ++++++++++++----------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc
index 6762a41..19e27ad 100644
--- a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc
+++ b/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform Feature Pcd Description.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -91,3 +91,8 @@
   # new core to see if we can re-enable this
   gPlatformModuleTokenSpaceGuid.PcdDeprecatedFunctionRemove|FALSE
 
+  ## Indicates if SMM Startup AP in a blocking fashion.
+  #   TRUE  - SMM Startup AP in a blocking fashion.<BR>
+  #   FALSE - SMM Startup AP in a non-blocking fashion.<BR>
+  # @Prompt SMM Startup AP in a blocking fashion.
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmBlockStartupThisAp|FALSE
\ No newline at end of file
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c b/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c
index 4385320..eb36343 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c
@@ -1,7 +1,7 @@
 /** @file
   This is the SMM driver for saving and restoring the powermanagement related MSRs.
 
-  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -140,15 +140,18 @@ RunOnAllLogicalProcessors (
   // Run the procedure on all logical processors.
   //
   (*Procedure) (Buffer);
-  for (Index = 1; Index < gSmst->NumberOfCpus; Index++) {
-    Status = EFI_NOT_READY;
-    while (Status != EFI_SUCCESS) {
-      Status = gSmst->SmmStartupThisAp (Procedure, Index, Buffer);
-      if (Status != EFI_SUCCESS) {
-        //
-        // SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
-        //
-        MicroSecondDelay (PPM_WAIT_PERIOD);
+  for (Index = 0; Index < gSmst->NumberOfCpus; Index++) {
+    if (Index != gSmst->CurrentlyExecutingCpu) {
+      Status = EFI_NOT_READY;
+      while (Status != EFI_SUCCESS) {
+        Status = gSmst->SmmStartupThisAp (Procedure, Index, Buffer);
+        ASSERT(Status != EFI_INVALID_PARAMETER);
+        if (Status != EFI_SUCCESS) {
+          //
+          // SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
+          //
+          MicroSecondDelay (PPM_WAIT_PERIOD);
+        }
       }
     }
   }
-- 
2.10.1.windows.1



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

end of thread, other threads:[~2017-04-12  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-12  6:52 [Patch][edk2-platforms/devel-MinnowBoard3] Fix S3 resume failure Guo, Mang
2017-04-12  8:14 ` Wei, David

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