From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BBF13211CFFF0 for ; Tue, 5 Mar 2019 07:56:01 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 07:56:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,444,1544515200"; d="scan'208";a="148790788" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 05 Mar 2019 07:55:59 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 5 Mar 2019 07:55:51 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 5 Mar 2019 07:55:50 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.163]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.158]) with mapi id 14.03.0415.000; Tue, 5 Mar 2019 23:55:48 +0800 From: "Yao, Jiewen" To: Ard Biesheuvel , "edk2-devel@lists.01.org" Thread-Topic: [PATCH 10/10] ArmPkg/MmCommunicationDxe: signal architected PI events into MM context Thread-Index: AQHU01gHsWIGO5SrkEKCv9e2NMWx8qX9EHRw Date: Tue, 5 Mar 2019 15:55:47 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F54D1FD@shsmsx102.ccr.corp.intel.com> References: <20190305133248.4828-1-ard.biesheuvel@linaro.org> <20190305133248.4828-11-ard.biesheuvel@linaro.org> In-Reply-To: <20190305133248.4828-11-ard.biesheuvel@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTQ3Yjc2ZGEtMjc4Yy00YzA0LWI0OGUtN2U2NjBiYzFjNTIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSXZnMTNLd2w3OE42bFRUYjh5YlBYV1NpSU9jYnlHZjdzSFF5WlVBdTAxQjlJdU8wck1jSThrWDY1N09NSnUrWSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 10/10] ArmPkg/MmCommunicationDxe: signal architected PI events into MM context X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2019 15:56:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi In original SMM infrastructure, there are lots of interaction that SMM has = to know the DXE status. In StandaloneMm, I don't expect we have many interaction. Is there any spec= ific example? I am totally OK to add those. And I just want to know more usage. Reviewed-by: Jiewen.yao@intel.com Thank you Yao Jiewen > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: Tuesday, March 5, 2019 5:33 AM > To: edk2-devel@lists.01.org > Cc: Ard Biesheuvel ; Achin Gupta > ; Supreeth Venkatesh > ; Yao, Jiewen ; > Leif Lindholm ; Jagadeesh Ujja > > Subject: [PATCH 10/10] ArmPkg/MmCommunicationDxe: signal architected > PI events into MM context >=20 > PI defines a few architected events that have significance in the MM > context as well as in the non-secure DXE context. So register notify > handlers for these events, and relay them into the standalone MM world. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf | 5 +++ > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 47 > +++++++++++++++++++- > 2 files changed, 50 insertions(+), 2 deletions(-) >=20 > diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > index 88beafa39c05..8bf269270f9d 100644 > --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > @@ -48,6 +48,11 @@ [LibraryClasses] > [Protocols] > gEfiMmCommunicationProtocolGuid ## PRODUCES >=20 > +[Guids] > + gEfiEndOfDxeEventGroupGuid > + gEfiEventExitBootServicesGuid > + gEfiEventReadyToBootGuid > + > [Pcd.common] > gArmTokenSpaceGuid.PcdMmBufferBase > gArmTokenSpaceGuid.PcdMmBufferSize > diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > index feb9fa9f4ead..3203cf801a19 100644 > --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > @@ -265,6 +265,43 @@ GetMmCompatibility () > return Status; > } >=20 > +STATIC EFI_GUID* CONST mGuidedEventGuid[] =3D { > + &gEfiEndOfDxeEventGroupGuid, > + &gEfiEventExitBootServicesGuid, > + &gEfiEventReadyToBootGuid, > +}; > + > +STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)]; > + > +/** > + Event notification that is fired when GUIDed Event Group is signaled. > + > + @param Event The Event that is being processed, > not used. > + @param Context Event Context, not used. > + > +**/ > +STATIC > +VOID > +EFIAPI > +MmGuidedEventNotify ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_MM_COMMUNICATE_HEADER Header; > + UINTN Size; > + > + // > + // Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure > + // > + CopyGuid (&Header.HeaderGuid, Context); > + Header.MessageLength =3D 1; > + Header.Data[0] =3D 0; > + > + Size =3D sizeof (Header); > + MmCommunicationCommunicate (&mMmCommunication, &Header, > &Size); > +} > + > /** > The Entry Point for MM Communication >=20 > @@ -287,6 +324,7 @@ MmCommunicationInitialize ( > ) > { > EFI_STATUS Status; > + UINTN Index; >=20 > // Check if we can make the MM call > Status =3D GetMmCompatibility (); > @@ -351,8 +389,13 @@ MmCommunicationInitialize ( > NULL, > &mSetVirtualAddressMapEvent > ); > - if (Status =3D=3D EFI_SUCCESS) { > - return Status; > + ASSERT_EFI_ERROR (Status); > + > + for (Index =3D 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) { > + Status =3D gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, > + MmGuidedEventNotify, mGuidedEventGuid[Index], > + mGuidedEventGuid[Index], > &mGuidedEvent[Index]); > + ASSERT_EFI_ERROR (Status); > } >=20 > gBS->UninstallProtocolInterface ( > -- > 2.20.1