public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yuanhao Xie" <yuanhao.xie@intel.com>
To: "Ni, Ray" <ray.ni@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Subject: Re: [Patch V3 3/5] UefiCpuPkg: Create MpHandOff.
Date: Wed, 28 Jun 2023 08:57:22 +0000	[thread overview]
Message-ID: <CO1PR11MB5026ECFB0EDEB69AE13B58E7F024A@CO1PR11MB5026.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MN6PR11MB8244BB94E59F3FFD1CF8B4428C26A@MN6PR11MB8244.namprd11.prod.outlook.com>

Hi Ray,

Please check V4 patch series.

Thanks for the feedbacks.
Yuanhao


> 
> The SaveCpuMpData() function was updated to construct the MP_HAND_OFF 
> Hob. Additionally, the function introduced the MP_HAND_OFF_SIGNAL, 
> which solely served the purpose of awakening the APs and transitioning 
> their context from PEI to DXE. The WaitLoopExecutionMode field 
> indicated whether the bit mode of PEI matched that of DXE. Both of 
> them were filled only if the ApLoopMode was not ApInHltLoop. In the 
> case of ApLoopMode, it remained necessary

1. "ApLoopMode" -> "ApInHltMode"?
2. can you update commit message to highlight that this patch still sends INIT-SIPI-SIPI even AP is wait in run-loop or mwait loop?
A: I updated commit message in patch V4.
> +
> +/**
> +  Get pointer to CPU MP Data structure from GUIDed HOB.
> +
> +  @param[in] CpuMpData  The pointer to CPU MP Data structure.
> +**/
> +VOID
> +AmdSevUpdateCpuMpData (
> +  IN CPU_MP_DATA  *CpuMpData
> +  )
> +{
> +  CPU_MP_DATA  *OldCpuMpData;
> +
> +  OldCpuMpData = GetCpuMpDataFromGuidedHob ();
> +
> +  OldCpuMpData->NewCpuMpData = CpuMpData; }

3. Can you please move this function implementation into MpInitLib/AmdSev.c?
A: This function is added in AmdSev.c


> +//
> +// To trigger the start-up signal, BSP writes the specified // 
> +StartupSignalValue to the StartupSignalAddress of each processor.
> +// This address is monitored by the APs, and as soon as they receive 
> +// the value that matches the MP_HAND_OFF_SIGNAL, they will wake up 
> +// and switch the context from PEI to DXE phase.
> +//
> +#define MP_HAND_OFF_SIGNAL  SIGNATURE_32 ('M', 'P', 'H', 'O')
4. It's ok to define the signal signature here.

> +#define MP_HANDOFF_GUID \
> +  { \
> +    0x11e2bd88, 0xed38, 0x4abd, {0xa3, 0x99, 0x21, 0xf2, 0x5f, 0xd0, 
> +0x7a, 0x60 }
> \
> +  }

5. can you please move this GUID definition to MpInitLib/MpHandOff.h?
A: MP_HANDOFF_GUID  and 2 structure definitions in below are put in MpInitLib/MpHandOff in patch V4.


> +//
> +// The information required to transfer from the PEI phase to the // 
> +DXE phase is contained within the MP_HAND_OFF and
> PROCESSOR_HAND_OFF.
> +// If the SizeOfPointer (WaitLoopExecutionMode) of both phases are 
> +equal, // and the APs is not in halt mode, // then the APs can be 
> +awakened by triggering the start-up // signal, rather than using 
> +INIT-SIPI-SIPI.
> +// To trigger the start-up signal, BSP writes the specified // 
> +StartupSignalValue to the StartupSignalAddress of each processor.
> +// This address is monitored by the APs.
> +//
> +typedef struct {
> +  UINT32    ApicId;
> +  UINT32    Health;
> +  UINT64    StartupSignalAddress;
> +  UINT64    StartupProcedureAddress;
> +} PROCESSOR_HAND_OFF;
> +
> +typedef struct {
> +  //
> +  // The ProcessorIndex indicates the range of processors. If it is 
> +set to 0, it
> signifies
> +  // processors from 0 to CpuCount - 1. Multiple instances in the HOB 
> + list
> describe
> +  // processors from ProcessorIndex to ProcessorIndex + CpuCount - 1.
> +  //
> +  UINT32                ProcessorIndex;
> +  UINT32                CpuCount;
> +  UINT32                WaitLoopExecutionMode;
> +  UINT32                StartupSignalValue;
> +  PROCESSOR_HAND_OFF    Info[];
> +} MP_HAND_OFF;

6. can you please move the above 2 structure definitions to MpInitLib/MpHandOff.h?

> +
>  //
>  // Data structure for microcode patch information  // @@ -347,6 
> +391,7 @@ typedef
>    );
> 
>  extern EFI_GUID  mCpuInitMpLibHobGuid;
> +extern EFI_GUID  mMpHandOffGuid;
> 
>  /**
>    Assembly code to place AP into safe loop mode.
> @@ -452,6 +497,17 @@ SaveCpuMpData (
>    IN CPU_MP_DATA  *CpuMpData
>    );
> 
> +/**
> +  This function Get BspNumber.
> +
> +  @param[in] MpHandOff        Pointer to MpHandOff
> +  @return                     BspNumber
> +**/
> +UINT32
> +GetBspNumber (
> +  IN CONST MP_HAND_OFF  *MpHandOff
> +  );

7. It seems above "GetBspNumber" prototype declaration can be removed. Can you confirm?
A: I agree. GetBspNumber is removed in patch V4.


> +
>  /**
>    Get available system memory below 1MB by specified size.
> 
> @@ -652,6 +708,16 @@ EnableDisableApWorker (
>    IN  UINT32   *HealthFlag OPTIONAL
>    );
> 
> +/**
> +  Get pointer to MP_HAND_OFF GUIDed HOB.
> +
> +  @return  The pointer to MP_HAND_OFF structure.
> +**/
> +MP_HAND_OFF *
> +GetMpHandOffHob (
> +  VOID
> +  );
> +

8. It seems above "GetMpHandOffHob" prototype declaration can be removed if you implement it in front of
    MpInitLibInitialize() in MpLib.c. can you confirm?
A: I agree. GetMpHandOffHob is removed in patch V4.

  reply	other threads:[~2023-06-28  9:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  5:57 [Patch V3 0/5] Eliminate the second INIT-SIPI-SIPI sequence Yuanhao Xie
2023-06-26  5:57 ` [Patch V3 1/5] UefiCpuPkg: Refactor the logic for placing APs in HltLoop Yuanhao Xie
2023-06-26  9:10   ` Ni, Ray
2023-06-26  5:57 ` [Patch V3 2/5] UefiCpuPkg: Refactor the logic for placing APs in Mwait/Runloop Yuanhao Xie
2023-06-26  9:10   ` Ni, Ray
2023-06-26  5:57 ` [Patch V3 3/5] UefiCpuPkg: Create MpHandOff Yuanhao Xie
2023-06-26  9:28   ` Ni, Ray
2023-06-28  8:57     ` Yuanhao Xie [this message]
2023-06-26  5:57 ` [Patch V3 4/5] UefiCpuPkg: ApWakeupFunction directly use CpuMpData Yuanhao Xie
2023-06-26  9:36   ` Ni, Ray
2023-06-26  5:57 ` [Patch V3 5/5] UefiCpuPkg: Eliminate the second INIT-SIPI-SIPI sequence Yuanhao Xie
2023-06-27  5:51   ` Ni, Ray
2023-06-28  8:52     ` Yuanhao Xie

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=CO1PR11MB5026ECFB0EDEB69AE13B58E7F024A@CO1PR11MB5026.namprd11.prod.outlook.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