public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 00/10] support CPU hot-unplug
@ 2021-01-07 19:55 Ankur Arora
  2021-01-07 19:55 ` [PATCH v2 01/10] OvmfPkg/CpuHotplugSmm: move CPU Hotplug into PlugCpus() Ankur Arora
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Ankur Arora @ 2021-01-07 19:55 UTC (permalink / raw)
  To: devel; +Cc: lersek, imammedo, boris.ostrovsky, Ankur Arora

Hi,

This series adds support for CPU hot-unplug with OVMF.

Please see this in conjunction with the QEMU secureboot hot-unplug v2
series posted here (now upstreamed):
  https://lore.kernel.org/qemu-devel/20201207140739.3829993-1-imammedo@redhat.com/

Patch 1 ("OvmfPkg/CpuHotplugSmm: move CPU Hotplug into PlugCpus()") does
some refactoring to setup for addition of the unplug logic in patch 2
("OvmfPkg/CpuHotplugSmm: handle Hot-unplug events").

Patch 3 ("OvmfPkg/CpuHotplugSmm: add Qemu CpuStatus helper") adds a QEMU
helper which would be used to do the final unplug.

Patch 4 ("OvmfPkg/CpuHotplugSmm: handle CPU hot-unplug") does the SMM
state management for doing the unplug.

Patch 5 ("MdePkg: add MmRegisterShutdownInterface()") adds an interface
to register a ShutdownAp callback to be called from
SmmCpuFeaturesRendezvousExit().

Patch 6 ("UefiCpuPkg/PiSmmCpuDxeSmm: initialize IsBsp") initializes
IsBsp so it accurately reflects if a CPU is BSP or not.
Patch 7 ("UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to
SmmCpuFeaturesRendezvousExit()") consumes this.

Patch 8 ("OvmfCpuPkg/CpuHotplug: add a hot-unplug handler called at SMI exit")
adds (and registers) the actual handler which provides a holding area for
the AP while the BSP calls QEMU to do the hot-unplug.

And, finally expose this functionality to QEMU with the fw_cfg interface in
Patch 9 ("OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG").

Patch 10 ("MdePkg: use CpuPause() in CpuDeadLoop()") is unrelated to the
series and just adds a CpuPause() in the CpuDeadLoop((). 

Testing with the QEMU 5.2.50:
 * negotiation with/without CPU hotplug enabled
 * CPU plug/unplug testing in a loop
 * Synthetic tests with simultaneous multi CPU hot-unplug

Also at:
  github.com/terminus/edk2/ hot-unplug-v2

V1: https://patchew.org/EDK2/20201208053432.2690694-1-ankur.a.arora@oracle.com/
Changes from V1:
 * do the ejection via SmmCpuFeaturesRendezvousExit()

Please review.

Thanks
Ankur

Ankur Arora (10):
  OvmfPkg/CpuHotplugSmm: move CPU Hotplug into PlugCpus()
  OvmfPkg/CpuHotplugSmm: handle Hot-unplug events
  OvmfPkg/CpuHotplugSmm: add Qemu CpuStatus helper
  OvmfPkg/CpuHotplugSmm: handle CPU hot-unplug
  MdePkg: add MmRegisterShutdownInterface()
  UefiCpuPkg/PiSmmCpuDxeSmm: initialize IsBsp
  UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to
    SmmCpuFeaturesRendezvousExit()
  OvmfCpuPkg/CpuHotplug: add a hot-unplug handler called at SMI exit
  OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG
  MdePkg: use CpuPause() in CpuDeadLoop()

 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c            |   1 +
 MdePkg/Include/Pi/PiMmCis.h                        |  16 +
 MdePkg/Include/Pi/PiSmmCis.h                       |   2 +
 MdePkg/Library/BaseLib/CpuDeadLoop.c               |   3 +-
 .../MmServicesTableLib/MmServicesTableLib.c        |  11 +
 OvmfPkg/CpuHotplugSmm/CpuHotplug.c                 | 416 ++++++++++++++++-----
 OvmfPkg/CpuHotplugSmm/QemuCpuhp.c                  |  58 ++-
 OvmfPkg/CpuHotplugSmm/QemuCpuhp.h                  |   6 +
 OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h  |   2 +
 .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |   6 +-
 OvmfPkg/SmmControl2Dxe/SmiFeatures.c               |  21 +-
 UefiCpuPkg/Include/Library/SmmCpuFeaturesLib.h     |   4 +-
 .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |   4 +-
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  20 +-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c         |   1 +
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |   1 +
 16 files changed, 463 insertions(+), 109 deletions(-)

-- 
2.9.3


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

end of thread, other threads:[~2021-01-07 23:44 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-07 19:55 [PATCH v2 00/10] support CPU hot-unplug Ankur Arora
2021-01-07 19:55 ` [PATCH v2 01/10] OvmfPkg/CpuHotplugSmm: move CPU Hotplug into PlugCpus() Ankur Arora
2021-01-07 19:55 ` [PATCH v2 02/10] OvmfPkg/CpuHotplugSmm: handle Hot-unplug events Ankur Arora
2021-01-07 19:55 ` [PATCH v2 03/10] OvmfPkg/CpuHotplugSmm: add Qemu CpuStatus helper Ankur Arora
2021-01-07 19:55 ` [PATCH v2 04/10] OvmfPkg/CpuHotplugSmm: handle CPU hot-unplug Ankur Arora
2021-01-07 19:55 ` [PATCH v2 05/10] MdePkg: add MmRegisterShutdownInterface() Ankur Arora
2021-01-07 20:48   ` [edk2-devel] " Laszlo Ersek
2021-01-07 21:00     ` Laszlo Ersek
2021-01-07 21:19     ` Ankur Arora
2021-01-07 21:50       ` Laszlo Ersek
2021-01-07 21:45     ` Laszlo Ersek
2021-01-07 23:42       ` Ankur Arora
2021-01-07 19:55 ` [PATCH v2 06/10] UefiCpuPkg/PiSmmCpuDxeSmm: initialize IsBsp Ankur Arora
2021-01-07 19:55 ` [PATCH v2 07/10] UefiCpuPkg/SmmCpuFeaturesLib: add IsBsp as a param to SmmCpuFeaturesRendezvousExit() Ankur Arora
2021-01-07 19:55 ` [PATCH v2 08/10] OvmfCpuPkg/CpuHotplug: add a hot-unplug handler called at SMI exit Ankur Arora
2021-01-07 19:55 ` [PATCH v2 09/10] OvmfPkg/SmmControl2Dxe: negotiate ICH9_LPC_SMI_F_CPU_HOT_UNPLUG Ankur Arora
2021-01-07 19:55 ` [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop() Ankur Arora
2021-01-07 22:30   ` [edk2-devel] " Michael D Kinney
2021-01-07 23:43     ` Ankur Arora

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