On Mon, 2014-11-17 at 05:00 +0000, Fan, Jeff wrote: 
> Chen,
> 
> Could you move the following code to the end of InitializeMpSupport ().  It's 
> not necessary when MP Is not supported.
> 
> +  Status = gBS->CreateEvent (
> +                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
> +                  TPL_CALLBACK,
> +                  ExitBootServicesCallback,
> +                  NULL,
> +                  &mExitBootServicesEvent
> +                  );
> +  ASSERT_EFI_ERROR (Status);

Yes, I will send V2 soon.

Thanks,
Chen

> 
> Thanks!
> Jeff
> -----Original Message-----
> From: Chen Fan [mailto:[email protected]] 
> Sent: Monday, November 17, 2014 10:19 AM
> To: [email protected]
> Cc: Gabriel Somlo; Fan, Jeff; Justen, Jordan L
> Subject: [PATCH] CpuDxe: change APs to wait for SIPI state
> 
>  when gBS->ExitBootServices() is called, the APs should avoid  to access the 
> unsafed buff datas which were allocated by boot services.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chen Fan <[email protected]>
> Tested-by: Gabriel Somlo <[email protected]>
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 
> c9df4e1..7303e85 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -24,6 +24,8 @@ BOOLEAN                   mIsFlushingGCD;
>  UINT64                    mValidMtrrAddressMask = 
> MTRR_LIB_CACHE_VALID_ADDRESS;
>  UINT64                    mValidMtrrBitsMask    = MTRR_LIB_MSR_VALID_MASK;
>  
> +EFI_EVENT                 mExitBootServicesEvent = (EFI_EVENT)NULL;
> +
>  FIXED_MTRR    mFixedMtrrTable[] = {
>    {
>      MTRR_LIB_IA32_MTRR_FIX64K_00000,
> @@ -826,6 +828,28 @@ IdleLoopEventCallback (
>    CpuSleep ();
>  }
>  
> +/**
> +  Callback function for ExitBootServices.
> +
> +  @param  Event                 Event whose notification function is being 
> invoked.
> +  @param  Context               The pointer to the notification function's 
> context,
> +                                which is implementation-dependent.
> +
> +**/
> +VOID
> +EFIAPI
> +ExitBootServicesCallback (
> +  IN EFI_EVENT                Event,
> +  IN VOID                     *Context
> +  )
> +{
> +  //
> +  // Avoid APs access invalid buff datas which allocated by Boot 
> +Services,
> +  // so we send INIT IPI to APs to let them wait for SIPI state.
> +  //
> +  SendInitIpiAllExcludingSelf ();
> +}
> +
>  
>  /**
>    Initialize the state information for the CPU Architectural Protocol.
> @@ -900,6 +924,15 @@ InitializeCpu (
>  
>    InitializeMpSupport ();
>  
> +  Status = gBS->CreateEvent (
> +                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
> +                  TPL_CALLBACK,
> +                  ExitBootServicesCallback,
> +                  NULL,
> +                  &mExitBootServicesEvent
> +                  );
> +  ASSERT_EFI_ERROR (Status);
> +
>    return Status;
>  }
>  
> --
> 1.9.3
> 

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to