public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Star Zeng <star.zeng@intel.com>, edk2-devel@lists.01.org
Cc: Jiewen Yao <jiewen.yao@intel.com>, Eric Dong <eric.dong@intel.com>
Subject: Re: [PATCH 3/3] UefiCpuPkg S3ResumePei: Signal S3SmmInitDone
Date: Fri, 2 Mar 2018 15:56:33 +0100	[thread overview]
Message-ID: <4aa078cd-5827-96cc-1f99-8fc39b0e36bb@redhat.com> (raw)
In-Reply-To: <1519967749-5112-4-git-send-email-star.zeng@intel.com>

On 03/02/18 06:15, Star Zeng wrote:
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  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 <Guid/BootScriptExecutorVariable.h>
>  #include <Guid/ExtendedFirmwarePerformance.h>
>  #include <Guid/EndOfS3Resume.h>
> +#include <Guid/S3SmmInitDone.h>
>  #include <Ppi/ReadOnlyVariable2.h>
>  #include <Ppi/S3Resume2.h>
>  #include <Ppi/SmmAccess.h>
> @@ -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 <lersek@redhat.com>

Thanks
Laszlo


      parent reply	other threads:[~2018-03-02 14:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-02  5:15 [PATCH 0/3] Add S3SmmInitDone point Star Zeng
2018-03-02  5:15 ` [PATCH 1/3] MdeModulePkg: Add S3SmmInitDone definition Star Zeng
2018-03-02  5:59   ` Yao, Jiewen
2018-03-02  5:15 ` [PATCH 2/3] MdeModulePkg PiSmmCore: Register SMI handler to install S3SmmInitDone Star Zeng
2018-03-02  6:00   ` Yao, Jiewen
2018-03-02  5:15 ` [PATCH 3/3] UefiCpuPkg S3ResumePei: Signal S3SmmInitDone Star Zeng
2018-03-02  6:01   ` Yao, Jiewen
2018-03-02 14:56   ` Laszlo Ersek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4aa078cd-5827-96cc-1f99-8fc39b0e36bb@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox