From nobody Thu Nov 14 16:48:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+69977+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+69977+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1610049357; cv=none; d=zohomail.com; s=zohoarc; b=IDsMMcTWpGwOWyq4EJEcgrSpX3Lkg6WlQoeG28mUiekUl6uMVZwaMxUNpc3Tjeac5prZS2+ZalfhskxyScz1XzdQMXUVha2y9VbUoIECNpZ2cA0up90W/ZoR6X4SpJ5ekxPF3NMP5p2IczIXxV2RtZpIl+222RMU9SS3QjmadrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610049357; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=EIYMUwHmCqPaGVa7rcUSuHkV7KpGLDENwKmhjtXmfcM=; b=j7CGDNCHWOjLIv7BWqjK2yelhtDJfG9h2FdvFuEfpprWpkdQcID6dri75f0O+ZE9KlC7tP6sZpbtW0gYCcGnRBGSIREc96CXlgS5K02lW1VnJR73QegXk4ZBrTM19boEgRs/eFntmeBA8UOIEQRPFC8dm8u0nXocGJ0obbwwqGk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+69977+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610049357736872.2334748364758; Thu, 7 Jan 2021 11:55:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id U7h9YY1788612xgOT4D0P56x; Thu, 07 Jan 2021 11:55:56 -0800 X-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 X-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 X-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 X-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 X-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 X-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 X-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: [edk2-devel] [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> In-Reply-To: <20210107195515.106158-1-ankur.a.arora@oracle.com> References: <20210107195515.106158-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ankur.a.arora@oracle.com X-Gm-Message-State: kXwdPSUbx6tZulr8K9zNtsycx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610049356; bh=pQoTgKnXFCsOSWpa4uOiZcS2x+xVMs68sDeObLtiEMY=; h=Cc:Date:From:Reply-To:Subject:To; b=Eqw2CerPZ8UuijfqzfzD/DaPqAvS2mxMiGUbckBWZKFmWmYOsyAyjG0x3q9bh6VW+88 8IeQsgkkxIdVELSzTdeKCyr5/JA8szkWFjLPr0xw58z/bjj8ueRt2xWy6Cjj4PCmX9Skp /PvU4bZQy3c/9yKL/U9GAEozGj5d+gmNkOE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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, SmmAllocatePages, SmmFreePages, + NULL, // SmmShutdownAp NULL, // SmmStartupThisAp 0, // CurrentlyExecutingCpu 0, // NumberOfCpus 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 ); =20 +typedef +EFI_STATUS +(EFIAPI *EFI_MM_SHUTDOWN_AP)( + IN UINTN CpuNumber, + IN BOOLEAN IsBSP + ); + + /** Function prototype for protocol install notification. =20 @@ -242,6 +250,13 @@ VOID IN CONST EFI_MM_ENTRY_CONTEXT *MmEntryContext ); =20 +EFI_STATUS +EFIAPI +MmRegisterShutdownInterface ( + IN EFI_MM_SHUTDOWN_AP Procedure + ); + + /// /// Management Mode System Table (MMST) /// @@ -282,6 +297,7 @@ struct _EFI_MM_SYSTEM_TABLE { /// /// MP service /// + EFI_MM_SHUTDOWN_AP MmShutdownAp; EFI_MM_STARTUP_THIS_AP MmStartupThisAp; =20 /// 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 ); =20 +typedef EFI_MM_SHUTDOWN_AP EFI_SMM_SHUTDOWN_AP; typedef EFI_MM_STARTUP_THIS_AP EFI_SMM_STARTUP_THIS_AP; typedef EFI_MM_NOTIFY_FN EFI_SMM_NOTIFY_FN; typedef EFI_MM_REGISTER_PROTOCOL_NOTIFY EFI_SMM_REGISTER_PROTOCOL_N= OTIFY; @@ -137,6 +138,7 @@ struct _EFI_SMM_SYSTEM_TABLE2 { /// /// MP service /// + EFI_SMM_SHUTDOWN_AP SmmShutdownAp; EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp; =20 /// 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 ( =20 return EFI_SUCCESS; } + +EFI_STATUS +EFIAPI +MmRegisterShutdownInterface ( + IN EFI_MM_SHUTDOWN_AP Procedure + ) +{ + gMmst->MmShutdownAp =3D Procedure; + + return EFI_SUCCESS; +} 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 NULL, // Pointer to CpuSaveState= array { {0} }, // SmmReservedSmramRegion + NULL, // SmmShutdownAp { SmmStartupThisAp, // SmmCoreEntryContext.Smm= StartupThisAp 0, // SmmCoreEntryContext.Cur= rentlyExecutingCpu 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; =20 EFI_SMM_RESERVED_SMRAM_REGION SmmReservedSmramRegion[1]; + EFI_SMM_SHUTDOWN_AP SmmShutdownAp; EFI_SMM_ENTRY_CONTEXT SmmCoreEntryContext; EFI_SMM_ENTRY_POINT SmmCoreEntry; =20 --=20 2.9.3 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#69977): https://edk2.groups.io/g/devel/message/69977 Mute This Topic: https://groups.io/mt/79507550/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-