[edk2-devel] [PATCH v2 07/10] UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to SmmCpuFeaturesRendezvousExit()

Ankur Arora posted 10 patches 3 years, 10 months ago
There is a newer version of this series
[edk2-devel] [PATCH v2 07/10] UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to SmmCpuFeaturesRendezvousExit()
Posted by Ankur Arora 3 years, 10 months ago
Add IsBsp as a parameter to SmmCpuFeaturesRendezvousExit(). This'll
be used to disambiguate the BSP so it can eject hot-unplugged CPUs.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Aaron Young <aaron.young@oracle.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
---
 OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c    | 6 +++++-
 UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h           | 4 +++-
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c                    | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
index 7ef7ed98342e..4d78bbfe7634 100644
--- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
+++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
@@ -368,13 +368,17 @@ SmmCpuFeaturesRendezvousEntry (
   @param[in] CpuIndex  The index of the CPU that is exiting SMM.  The value
                        must be between 0 and the NumberOfCpus field in the
                        System Management System Table (SMST).
+  @param[in] IsBSP     Is this CPU the SMM BSP?
 **/
 VOID
 EFIAPI
 SmmCpuFeaturesRendezvousExit (
-  IN UINTN  CpuIndex
+  IN UINTN   CpuIndex,
+  IN BOOLEAN IsBSP
   )
 {
+  if(gSmst->SmmShutdownAp)
+    gSmst->SmmShutdownAp(CpuIndex, IsBSP);
 }
 
 /**
diff --git a/UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h b/UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h
index dbcd57e0ad42..5e8c4000f010 100644
--- a/UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h
+++ b/UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h
@@ -259,11 +259,13 @@ SmmCpuFeaturesRendezvousEntry (
   @param[in] CpuIndex  The index of the CPU that is exiting SMM.  The value must
                        be between 0 and the NumberOfCpus field in the System
                        Management System Table (SMST).
+  @param[in] IsBSP     Is this CPU the SMM BSP?
 **/
 VOID
 EFIAPI
 SmmCpuFeaturesRendezvousExit (
-  IN UINTN  CpuIndex
+  IN UINTN   CpuIndex,
+  IN BOOLEAN IsBSP
   );
 
 /**
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
index 8fed18cf0e17..325518d3de3e 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
@@ -443,11 +443,13 @@ SmmCpuFeaturesRendezvousEntry (
   @param[in] CpuIndex  The index of the CPU that is exiting SMM.  The value must
                        be between 0 and the NumberOfCpus field in the System
                        Management System Table (SMST).
+  @param[in] IsBSP     Is this CPU the SMM BSP?
 **/
 VOID
 EFIAPI
 SmmCpuFeaturesRendezvousExit (
-  IN UINTN  CpuIndex
+  IN UINTN   CpuIndex,
+  IN BOOLEAN IsBSP
   )
 {
 }
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index e7ea44eb86fc..fb6aab17de37 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1728,7 +1728,7 @@ SmiRendezvous (
   }
 
 Exit:
-  SmmCpuFeaturesRendezvousExit (CpuIndex);
+  SmmCpuFeaturesRendezvousExit (CpuIndex, IsBsp);
 
   //
   // Restore Cr2
-- 
2.9.3



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69974): https://edk2.groups.io/g/devel/message/69974
Mute This Topic: https://groups.io/mt/79507543/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-