Call the CPU hot-eject handler if one is installed. The condition for installation is (PcdCpuMaxLogicalProcessorNumber > 1), and there's a hot-unplug request.
The handler executes in context of SmmCpuFeaturesRendezvousExit(), which is called at the tail end of SmiRendezvous() after the BSP has given the signal to exit via the "AllCpusInSync" loop. Cc: Laszlo Ersek <ler...@redhat.com> Cc: Jordan Justen <jordan.l.jus...@intel.com> Cc: Ard Biesheuvel <ard.biesheu...@arm.com> Cc: Igor Mammedov <imamm...@redhat.com> Cc: Boris Ostrovsky <boris.ostrov...@oracle.com> Cc: Aaron Young <aaron.yo...@oracle.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132 Signed-off-by: Ankur Arora <ankur.a.ar...@oracle.com> --- Notes: Address the following review comments from v6, patch-6: (19a) Move the call to the ejection handler to a separate patch. (19b) Describe the calling context of SmmCpuFeaturesRendezvousExit(). (20) Add comment describing the state when the Handler is not armed. OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c index adbfc90ad46e..99988285b6a2 100644 --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c @@ -467,6 +467,21 @@ SmmCpuFeaturesRendezvousExit ( IN UINTN CpuIndex ) { + // + // We only call the Handler if CPU hot-eject is enabled + // (PcdCpuMaxLogicalProcessorNumber > 1), and hot-eject is needed + // in this SMI exit (otherwise mCpuHotEjectData->Handler is not armed.) + // + + if (mCpuHotEjectData != NULL) { + CPU_HOT_EJECT_HANDLER Handler; + + Handler = mCpuHotEjectData->Handler; + + if (Handler != NULL) { + Handler (CpuIndex); + } + } } /** -- 2.9.3 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71918): https://edk2.groups.io/g/devel/message/71918 Mute This Topic: https://groups.io/mt/80819862/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-