public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
To: "kraxel@redhat.com" <kraxel@redhat.com>, "Ni, Ray" <ray.ni@intel.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info
Date: Mon, 13 Feb 2023 04:15:28 +0000	[thread overview]
Message-ID: <MN0PR11MB615871DB68CB06CD9BC7A7EAFEDD9@MN0PR11MB6158.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230210130208.lbswcn3jnxs5inhb@sirius.home.kraxel.org>

Hi Gerd,

The change impact the old way of handling SMM init is only: refine the SmmInitHandler() to handle the code for the different execution branches (actually, it's also related to the patch purpose as I explained why removing the mIsBsp).  It's fine to do this separating work. I will do that in the next version patch.

But for below items, they all belong to the new smbase relocation flow:

>* Assume the biggest possibility of tile size is 8k.

--- for title size, I evaluated this according your comments before, I updated/moved it into the if condition check to avoid the old smm init impact. Because the old smm init should have no such assumption. So, it has to combine with new way handling.    

  GuidHob = GetFirstGuidHob (&gSmmBaseHobGuid);
  if (GuidHob != NULL) {
    //
    // Check whether the Required TileSize is enough.
    //
    if (TileSize > SIZE_8KB) {
      DEBUG ((DEBUG_ERROR, "The Range of Smbase in SMRAM is not enough -- Required TileSize = 0x%08x, Actual TileSize = 0x%08x\n", TileSize, SIZE_8KB));
      CpuDeadLoop ();
      return RETURN_BUFFER_TOO_SMALL;
    }
	....
  }

>* Combine 2 SMIs (gcSmmInitTemplate & gcSmiHandlerTemplate) into one
>(gcSmiHandlerTemplate), the new SMI handler needs to run to 2 paths:
>one to SmmCpuFeaturesInitializeProcessor(), the other to SMM Core
>Entry Point.

This is about the SMI handling logic with new way. Once SMI happen, there is only one copy of code in smbase+8000 to handling both smm relocation & normal smi. Instead of original 2 copies of code in smbase+8000. We don't change original smi template code. 


>* Issue SMI IPI (All Excluding Self SMM IPI + BSP SMM IPI) for first
>SMI init before normal SMI sources happen.
>* Call SmmCpuFeaturesInitializeProcessor() in parallel.

Above 2 are the same for the new way to issue the smi init process within if condition happen. All Excluding Self SMM IPI will achieve the parallel execution (SmmCpuFeaturesInitializeProcessor).


  //
  // For relocated SMBASE, some MSRs & CSRs are still required to be configured in SMM Mode for SMM Initialization.
  // Those MSRs & CSRs must be configured before normal SMI sources happen.
  // So, here is to issue SMI IPI (All Excluding  Self SMM IPI + BSP SMM IPI) to execute first SMI init.
  //
  if (mSmmRelocated) {
    ExecuteFirstSmiInit ();

    //
    // Call hook for BSP to perform extra actions in normal mode after all
    // SMM base addresses have been relocated on all CPUs
    //
    SmmCpuFeaturesSmmRelocationComplete ();
  }

Thanks,
Jiaxin 



> -----Original Message-----
> From: kraxel@redhat.com <kraxel@redhat.com>
> Sent: Friday, February 10, 2023 9:02 PM
> To: Ni, Ray <ray.ni@intel.com>
> Cc: devel@edk2.groups.io; Wu, Jiaxin <jiaxin.wu@intel.com>; Dong, Eric
> <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Laszlo Ersek
> <lersek@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
> Subject: Re: [edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm:
> Consume SMM Base Hob for SmBase info
> 
> On Fri, Feb 10, 2023 at 12:37:23PM +0000, Ni, Ray wrote:
> > Gerd,
> > All the 4 are needed to make sure SMM still works.
> 
> The new way (HOB present) of handling SMM init will surely require the
> whole patch series being applied.
> 
> For the old way (HOB not present) of handling SMM init should be
> possible to split up into smaller pieces, which each step being
> individually testable.  Specifically the SMI handler reorganization
> should be possible to split out, and I think the tiling changes too.
> 
> These are preparing changes reorganizing the code, once they are in
> place the final patch adding the new code paths to handle the new SMM
> init should be relatively small.
> 
> take care,
>   Gerd


  reply	other threads:[~2023-02-13  4:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10  6:05 [PATCH v4 0/5] Simplify SMM Relocation Process Wu, Jiaxin
2023-02-10  6:05 ` [PATCH v4 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Fix invalid InitializeMpSyncData call Wu, Jiaxin
2023-02-10  7:10   ` [edk2-devel] " Ni, Ray
2023-02-10  6:05 ` [PATCH v4 2/5] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data Wu, Jiaxin
2023-02-10  7:14   ` Ni, Ray
2023-02-10  7:30     ` Wu, Jiaxin
2023-02-10  8:47     ` [edk2-devel] " Marvin Häuser
2023-02-10 11:23   ` Gerd Hoffmann
2023-02-10 11:56     ` Ni, Ray
2023-02-10 12:32       ` Gerd Hoffmann
2023-02-10 13:12         ` Ni, Ray
2023-02-13  2:37           ` Wu, Jiaxin
2023-02-10  6:05 ` [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info Wu, Jiaxin
2023-02-10 10:00   ` [edk2-devel] " Marvin Häuser
2023-02-13  2:18     ` Wu, Jiaxin
2023-02-10 11:26   ` Gerd Hoffmann
2023-02-10 12:37     ` [edk2-devel] " Ni, Ray
2023-02-10 13:02       ` Gerd Hoffmann
2023-02-13  4:15         ` Wu, Jiaxin [this message]
2023-02-13  9:42           ` Ni, Ray
2023-02-10 12:34   ` Ni, Ray
2023-02-10  6:05 ` [PATCH v4 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration Wu, Jiaxin
2023-02-10 12:39   ` Ni, Ray
2023-02-10  6:05 ` [PATCH v4 5/5] OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or not Wu, Jiaxin
2023-02-10 11:28   ` Gerd Hoffmann
2023-02-10 12:56 ` [edk2-devel] [PATCH v4 0/5] Simplify SMM Relocation Process Ni, Ray
2023-02-13  2:19   ` Wu, Jiaxin

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=MN0PR11MB615871DB68CB06CD9BC7A7EAFEDD9@MN0PR11MB6158.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