From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by mx.groups.io with SMTP id smtpd.web08.2227.1610049446579681217 for ; Thu, 07 Jan 2021 11:57:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=n4Fsjx/t; spf=pass (domain: oracle.com, ip: 156.151.31.86, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 107Jtibw192430; Thu, 7 Jan 2021 19:57:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=PXZ7fykcjUIWxUap/jEERm/Eo1OEkqZydmDZ/iTiTCU=; b=n4Fsjx/tOzSo2DLs2UfeRN6NsQERWEBqtv6IGzHPT95LEej0byYz3AWQx5YwzOfC8RZ1 kQ9cTIziDYehc18Y0VClzwvepi9TPrbNPURqs7MZe1oI7DcWlZLXkbVf+bXEGzf7egri y0wM9SD4yCh5N0Dl+Cu9QasH993WRof6A0wWZfXn/KHy61ZvU0jTaKboKVECmay67Mez iE66QoCL/NzbyJmn1gqxjcnK2MOTDhjxXdGACVHzMg8zGGC9tQzqjkjnFUXG4ooImxE4 /vZtaBANFvLTgT4MeMjVmIXsZXjcPNzVdeZdM8m+7OWkB5AtlLukmGAi+7ULuH41PELf LA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 35wftxdn9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 07 Jan 2021 19:57:25 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 107Jae20136301; Thu, 7 Jan 2021 19:55:25 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 35w3qu6cqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Jan 2021 19:55:25 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 107JtN3t021794; Thu, 7 Jan 2021 19:55:24 GMT Received: from localhost.localdomain (/70.36.60.91) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 07 Jan 2021 11:55:23 -0800 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora Subject: [PATCH v2 00/10] support CPU hot-unplug Date: Thu, 7 Jan 2021 11:55:05 -0800 Message-Id: <20210107195515.106158-1-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9857 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=820 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101070114 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9857 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=785 malwarescore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101070115 Content-Transfer-Encoding: 8bit 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