[edk2-devel] [PATCH v9 0/6] Simplify SMM Relocation Process

Ni, Ray ray.ni at intel.com
Mon Feb 20 01:14:33 UTC 2023


I expect Gerd at least acknowledges all patches for UefiCpuPkg. Following three haven't got:
 * [PATCH v9 3/6] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data
 * [PATCH v9 4/6] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info
 * [PATCH v9 5/6] UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration

Thanks,
Ray

> -----Original Message-----
> From: Wu, Jiaxin <jiaxin.wu at intel.com>
> Sent: Monday, February 20, 2023 9:07 AM
> To: devel at edk2.groups.io; Wu, Jiaxin <jiaxin.wu at intel.com>
> Cc: Dong, Eric <eric.dong at intel.com>; Ni, Ray <ray.ni at intel.com>; Zeng, Star
> <star.zeng at intel.com>; Laszlo Ersek <lersek at redhat.com>; Gerd Hoffmann
> <kraxel at redhat.com>; Kumar, Rahul R <rahul.r.kumar at intel.com>
> Subject: RE: [edk2-devel] [PATCH v9 0/6] Simplify SMM Relocation Process
> 
> Any more comments to patch series? If no objection, Ray, please help merge
> the patches.
> 
> Thanks,
> Jiaxin
> 
> 
> 
> > -----Original Message-----
> > From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Wu,
> Jiaxin
> > Sent: Thursday, February 16, 2023 2:16 PM
> > To: devel at edk2.groups.io
> > Cc: Dong, Eric <eric.dong at intel.com>; Ni, Ray <ray.ni at intel.com>; Zeng,
> Star
> > <star.zeng at intel.com>; Laszlo Ersek <lersek at redhat.com>; Gerd
> Hoffmann
> > <kraxel at redhat.com>; Kumar, Rahul R <rahul.r.kumar at intel.com>
> > Subject: [edk2-devel] [PATCH v9 0/6] Simplify SMM Relocation Process
> >
> > Existing SMBASE Relocation is in the PiSmmCpuDxeSmm driver, which
> > will relocate the SMBASE of each processor by setting the SMBASE
> > field in the saved state map (at offset 7EF8h) to a new value.
> > The RSM instruction reloads the internal SMBASE register with the
> > value in SMBASE field when each time it exits SMM. All subsequent
> > SMI requests will use the new SMBASE to find the starting address
> > for the SMI handler (at SMBASE + 8000h).
> >
> > Due to the default SMBASE for all x86 processors is 0x30000, the
> > APs' 1st SMI for rebase has to be executed one by one to avoid
> > the processors over-writing each other's SMM Save State Area (see
> > existing SmmRelocateBases() function), which means the next AP has
> > to wait for the previous AP to finish its 1st SMI, then it can call
> > into its 1st SMI for rebase via Smi Ipi command, thus leading the
> > existing SMBASE Relocation has to be running in series. Besides, it
> > needs very complex code to handle the AP exit semaphore
> > (mRebased[Index]), which will hook return address of SMM Save State
> > so that semaphore code can be executed immediately after AP exits
> > SMM for SMBASE relocation (see existing SemaphoreHook() function).
> >
> > This series is to add the new SMM Base HOB for any PEI module to do
> > the SmBase relocation ahead of PiSmmCpuDxeSmm driver and store the
> > relocated SmBase address in array for each Processors. When the
> > SMBASE relocation happens in a PEI module, the PEI module shall
> > produce the SMM_BASE_HOB in HOB database which tells the
> > PiSmmCpuDxeSmm driver (runs at a later phase) about the new SMBASE
> > for each CPU thread. PiSmmCpuDxeSmm driver installs the SMI handler
> > at the SMM_BASE_HOB.SmBase[Index]+0x8000 for processor Index. When
> > the HOB doesn't exist, PiSmmCpuDxeSmm driver shall relocate and
> > program the new SMBASE itself (keep existing SMBASE Relocation way).
> >
> > With SMM Base Hob support, PiSmmCpuDxeSmm does not need the RSM
> > instruction to do the SMBASE Relocation. SMBASE Register for each
> > processors have already been programmed and all SMBASE address have
> > recorded in SMM Base Hob. So the same default SMBASE Address
> > (0x30000) will not be used, thus the processors over-writing each
> > other's SMM Save State Area will not happen in PiSmmCpuDxeSmm driver.
> > This way makes the first SMI init can be executed in parallel and save
> > boot time on multi-core system. Besides, Semaphore Hook code logic
> > is also not required, which will greatly simplify the SMBASE
> > Relocation flow.
> >
> > Note:
> > This is the new way that firmware can program the SMBASE
> > independently of the RSM instruction. The PEI code performing
> > this logic will not be open sourced, similarly to other things
> > that are kept binary-only in the FSP. Due to the register
> > difference in different vender, and it has not been documented
> > in the Intel SDM yet, we need a new binary-only interface for
> > SMM Base HOB.
> >
> > Cc: Eric Dong <eric.dong at intel.com>
> > Cc: Ray Ni <ray.ni at intel.com>
> > Cc: Zeng Star <star.zeng at intel.com>
> > Cc: Laszlo Ersek <lersek at redhat.com>
> > Cc: Gerd Hoffmann <kraxel at redhat.com>
> > Cc: Rahul Kumar <rahul1.kumar at intel.com>
> > Signed-off-by: Jiaxin Wu <jiaxin.wu at intel.com>
> >
> > Jiaxin Wu (6):
> >   UefiCpuPkg/PiSmmCpuDxeSmm: Fix invalid InitializeMpSyncData call
> >   UefiCpuPkg/PiSmmCpuDxeSmm: Replace mIsBsp by mBspApicId check
> >   UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data
> >   UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase
> info
> >   UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration
> >   OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or
> not
> >
> >  .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |  10 +-
> >  .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf        |   6 +-
> >  UefiCpuPkg/Include/Guid/SmmBaseHob.h               |  75 ++++++++
> >  .../Library/SmmCpuFeaturesLib/CpuFeaturesLib.h     |   2 +
> >  .../SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c     |  25 ++-
> >  .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf        |   6 +-
> >  .../SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf     |   3 +-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c      |   3 +-
> >  .../StandaloneMmCpuFeaturesLib.inf                 |   6 +-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c                  |  31 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  25 ++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c         | 193
> > ++++++++++++++++-----
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |  26 ++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf       |   3 +-
> >  UefiCpuPkg/UefiCpuPkg.dec                          |   5 +-
> >  15 files changed, 356 insertions(+), 63 deletions(-)
> >  create mode 100644 UefiCpuPkg/Include/Guid/SmmBaseHob.h
> >
> > --
> > 2.16.2.windows.1
> >
> >
> >
> > 
> >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100350): https://edk2.groups.io/g/devel/message/100350
Mute This Topic: https://groups.io/mt/97001110/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list