From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 8DBF222546B82 for ; Fri, 2 Mar 2018 06:50:26 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31D1B40267D0; Fri, 2 Mar 2018 14:56:35 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-104.rdu2.redhat.com [10.10.120.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E0D89C07D; Fri, 2 Mar 2018 14:56:34 +0000 (UTC) To: Star Zeng , edk2-devel@lists.01.org Cc: Jiewen Yao , Eric Dong References: <1519967749-5112-1-git-send-email-star.zeng@intel.com> <1519967749-5112-4-git-send-email-star.zeng@intel.com> From: Laszlo Ersek Message-ID: <4aa078cd-5827-96cc-1f99-8fc39b0e36bb@redhat.com> Date: Fri, 2 Mar 2018 15:56:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519967749-5112-4-git-send-email-star.zeng@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 02 Mar 2018 14:56:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 02 Mar 2018 14:56:35 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH 3/3] UefiCpuPkg S3ResumePei: Signal S3SmmInitDone X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2018 14:50:27 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 03/02/18 06:15, Star Zeng wrote: > Cc: Jiewen Yao > Cc: Eric Dong > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 42 +++++++++++++++------- > .../Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf | 3 ++ > 2 files changed, 33 insertions(+), 12 deletions(-) > > diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c > index 4d776891a72d..2cb7b429e59c 100644 > --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c > +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -259,6 +260,12 @@ EFI_PEI_PPI_DESCRIPTOR mPpiListEndOfPeiTable = { > 0 > }; > > +EFI_PEI_PPI_DESCRIPTOR mPpiListS3SmmInitDoneTable = { > + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), > + &gEdkiiS3SmmInitDoneGuid, > + 0 > +}; > + > // > // Global Descriptor Table (GDT) > // > @@ -322,13 +329,14 @@ IsLongModeWakingVector ( > } > > /** > - Send EndOfS3Resume event to SmmCore through communication buffer way. > + Signal to SMM through communication buffer way. > + > + @param[in] HandlerType SMI handler type to be signaled. > > - @retval EFI_SUCCESS Return send the event success. > **/ > -EFI_STATUS > -SignalEndOfS3Resume ( > - VOID > +VOID > +SignalToSmmByCommunication ( > + IN EFI_GUID *HandlerType > ) > { > EFI_STATUS Status; > @@ -338,7 +346,7 @@ SignalEndOfS3Resume ( > SMM_COMMUNICATE_HEADER_64 Header64; > VOID *CommBuffer; > > - DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Enter\n")); > + DEBUG ((DEBUG_INFO, "Signal %g to SMM - Enter\n", HandlerType)); > > // > // This buffer consumed in DXE phase, so base on DXE mode to prepare communicate buffer. > @@ -355,7 +363,7 @@ SignalEndOfS3Resume ( > Header32.MessageLength = 0; > CommSize = OFFSET_OF (SMM_COMMUNICATE_HEADER_32, Data); > } > - CopyGuid (CommBuffer, &gEdkiiEndOfS3ResumeGuid); > + CopyGuid (CommBuffer, HandlerType); > > Status = PeiServicesLocatePpi ( > &gEfiPeiSmmCommunicationPpiGuid, > @@ -365,7 +373,7 @@ SignalEndOfS3Resume ( > ); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "Locate Smm Communicate Ppi failed (%r)!\n", Status)); > - return Status; > + return; > } > > Status = SmmCommunicationPpi->Communicate ( > @@ -377,8 +385,8 @@ SignalEndOfS3Resume ( > DEBUG ((DEBUG_ERROR, "SmmCommunicationPpi->Communicate return failure (%r)!\n", Status)); > } > > - DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status)); > - return Status; > + DEBUG ((DEBUG_INFO, "Signal %g to SMM - Exit (%r)\n", HandlerType, Status)); > + return; > } > > /** > @@ -464,11 +472,11 @@ S3ResumeBootOs ( > PERF_END_EX (NULL, "EndOfPeiPpi", NULL, 0, PERF_INMODULE_END_ID); > > // > - // Signal EndOfS3Resume event. > + // Signal EndOfS3Resume to SMM. > // > PERF_START_EX (NULL, "EndOfS3Resume", NULL, 0, PERF_INMODULE_START_ID); > > - SignalEndOfS3Resume (); > + SignalToSmmByCommunication (&gEdkiiEndOfS3ResumeGuid); > > PERF_END_EX (NULL, "EndOfS3Resume", NULL, 0, PERF_INMODULE_END_ID); > > @@ -787,6 +795,16 @@ S3ResumeExecuteBootScript ( > Status = SmmAccess->Lock ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index); > } > } > + > + // > + // Install S3SmmInitDone PPI. > + // > + Status = PeiServicesInstallPpi (&mPpiListS3SmmInitDoneTable); > + ASSERT_EFI_ERROR (Status); > + // > + // Signal S3SmmInitDone to SMM. > + // > + SignalToSmmByCommunication (&gEdkiiS3SmmInitDoneGuid); > } > > if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { > diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf > index 9522ede726f4..47fecd7d6d80 100644 > --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf > +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf > @@ -78,6 +78,9 @@ [Guids] > gEfiAcpiVariableGuid > gEfiAcpiS3ContextGuid ## SOMETIMES_CONSUMES ## UNDEFINED # LockBox > gEdkiiEndOfS3ResumeGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication > + ## SOMETIMES_PRODUCES ## UNDEFINED # Install PPI > + ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication > + gEdkiiS3SmmInitDoneGuid > > [Ppis] > gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES > OK, this patch seems to preserve the current behavior that the SMM communication PPI is optional. Acked-by: Laszlo Ersek Thanks Laszlo