From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by mx.groups.io with SMTP id smtpd.web09.2198.1610049354782679023 for ; Thu, 07 Jan 2021 11:55:54 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=eh/0oWst; spf=pass (domain: oracle.com, ip: 141.146.126.79, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 107JtQQ9150405; Thu, 7 Jan 2021 19:55:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=7/3Kg+42jMvL+1CCzfdylSwAoh7ftM1uFp1tKZdWEFA=; b=eh/0oWst8cbULKCRjovwj9ojYieNy5A3X9UtYnuWbQv0WVE83/4X/uYUWAUYQY4Z///I RmNxdE8AJhHpAJajLvy/vUFcfV81HqKwV8Pq0WSFst1dQwtALwcML66xsL0HyufXenzk VPuXOLkRYkfXJ9/FAbUUQB8B0mTlHY08H5/0qwNgIgbEUvbiJ8Aq2dwFSM8A9iWn2DVK Rv6U24TbcRk4X5N7a9DFLbY+KgSnGZZVanMZgFQ7kDRI5m6tTN5/3RCztMhaAcfp0bL5 Nvua12Q1v305lXQ/ECUzMADbOyxtE+Wq3PXQe6Tn2LeRLbZqHeZ0hIXeZpdeDiCqrexQ FQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 35wcuxxee6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 07 Jan 2021 19:55:30 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 107Jss9b026109; Thu, 7 Jan 2021 19:55:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 35v1fbn1rf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Jan 2021 19:55:29 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 107JtRIP021828; Thu, 7 Jan 2021 19:55:27 GMT Received: from localhost.localdomain (/70.36.60.91) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 07 Jan 2021 11:55:27 -0800 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora , Jian J Wang , Michael D Kinney , Liming Gao , Zhiguang Liu , Eric Dong , Ray Ni , Rahul Kumar , Aaron Young Subject: [PATCH v2 05/10] MdePkg: add MmRegisterShutdownInterface() Date: Thu, 7 Jan 2021 11:55:10 -0800 Message-Id: <20210107195515.106158-6-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210107195515.106158-1-ankur.a.arora@oracle.com> References: <20210107195515.106158-1-ankur.a.arora@oracle.com> 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 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101070115 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9857 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 clxscore=1011 spamscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101070115 Content-Transfer-Encoding: quoted-printable Add MmRegisterShutdownInterface(), which is used to register a callback, that gets used to do the final ejection as part of CPU hot-unplug. Cc: Jian J Wang Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Igor Mammedov Cc: Boris Ostrovsky Cc: Aaron Young Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3132 Signed-off-by: Ankur Arora --- Not sure this is the right way to register a callback to be called from SmmCpuFeaturesRendezvousExit(). Happy to hear suggestions for a better way to accomplish this. --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 1 + MdePkg/Include/Pi/PiMmCis.h | 16 ++++++++++++++= ++ MdePkg/Include/Pi/PiSmmCis.h | 2 ++ MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c | 11 +++++++++++ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 1 + 6 files changed, 32 insertions(+) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.c index cfa9922cbdb5..9d883bb06633 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c @@ -39,6 +39,7 @@ EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst =3D { SmmFreePool,=0D SmmAllocatePages,=0D SmmFreePages,=0D + NULL, // SmmShutdownAp=0D NULL, // SmmStartupThisAp=0D 0, // CurrentlyExecutingCpu=0D 0, // NumberOfCpus=0D diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h index fdf0591a03d6..237bd8dcba76 100644 --- a/MdePkg/Include/Pi/PiMmCis.h +++ b/MdePkg/Include/Pi/PiMmCis.h @@ -77,6 +77,14 @@ EFI_STATUS IN OUT VOID *ProcArguments OPTIONAL=0D );=0D =0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *EFI_MM_SHUTDOWN_AP)(=0D + IN UINTN CpuNumber,=0D + IN BOOLEAN IsBSP=0D + );=0D +=0D +=0D /**=0D Function prototype for protocol install notification.=0D =0D @@ -242,6 +250,13 @@ VOID IN CONST EFI_MM_ENTRY_CONTEXT *MmEntryContext=0D );=0D =0D +EFI_STATUS=0D +EFIAPI=0D +MmRegisterShutdownInterface (=0D + IN EFI_MM_SHUTDOWN_AP Procedure=0D + );=0D +=0D +=0D ///=0D /// Management Mode System Table (MMST)=0D ///=0D @@ -282,6 +297,7 @@ struct _EFI_MM_SYSTEM_TABLE { ///=0D /// MP service=0D ///=0D + EFI_MM_SHUTDOWN_AP MmShutdownAp;=0D EFI_MM_STARTUP_THIS_AP MmStartupThisAp;=0D =0D ///=0D diff --git a/MdePkg/Include/Pi/PiSmmCis.h b/MdePkg/Include/Pi/PiSmmCis.h index 06ef4aecd7b5..296dc01f6703 100644 --- a/MdePkg/Include/Pi/PiSmmCis.h +++ b/MdePkg/Include/Pi/PiSmmCis.h @@ -49,6 +49,7 @@ EFI_STATUS IN UINTN TableSize=0D );=0D =0D +typedef EFI_MM_SHUTDOWN_AP EFI_SMM_SHUTDOWN_AP;=0D typedef EFI_MM_STARTUP_THIS_AP EFI_SMM_STARTUP_THIS_AP;=0D typedef EFI_MM_NOTIFY_FN EFI_SMM_NOTIFY_FN;=0D typedef EFI_MM_REGISTER_PROTOCOL_NOTIFY EFI_SMM_REGISTER_PROTOCOL_N= OTIFY;=0D @@ -137,6 +138,7 @@ struct _EFI_SMM_SYSTEM_TABLE2 { ///=0D /// MP service=0D ///=0D + EFI_SMM_SHUTDOWN_AP SmmShutdownAp;=0D EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;=0D =0D ///=0D diff --git a/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c b/MdePk= g/Library/MmServicesTableLib/MmServicesTableLib.c index 27f9d526e396..c7d81a0dc193 100644 --- a/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c +++ b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c @@ -55,3 +55,14 @@ MmServicesTableLibConstructor ( =0D return EFI_SUCCESS;=0D }=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +MmRegisterShutdownInterface (=0D + IN EFI_MM_SHUTDOWN_AP Procedure=0D + )=0D +{=0D + gMmst->MmShutdownAp =3D Procedure;=0D +=0D + return EFI_SUCCESS;=0D +}=0D diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index db68e1316ec5..f2f67e85e5e9 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -22,6 +22,7 @@ SMM_CPU_PRIVATE_DATA mSmmCpuPrivateData =3D { NULL, // Pointer to CpuSaveState= Size array=0D NULL, // Pointer to CpuSaveState= array=0D { {0} }, // SmmReservedSmramRegion= =0D + NULL, // SmmShutdownAp=0D {=0D SmmStartupThisAp, // SmmCoreEntryContext.Smm= StartupThisAp=0D 0, // SmmCoreEntryContext.Cur= rentlyExecutingCpu=0D diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.h index b8aa9e1769d3..7672834a2f70 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -247,6 +247,7 @@ typedef struct { VOID **CpuSaveState;=0D =0D EFI_SMM_RESERVED_SMRAM_REGION SmmReservedSmramRegion[1];=0D + EFI_SMM_SHUTDOWN_AP SmmShutdownAp;=0D EFI_SMM_ENTRY_CONTEXT SmmCoreEntryContext;=0D EFI_SMM_ENTRY_POINT SmmCoreEntry;=0D =0D --=20 2.9.3