[edk2-devel] [PATCH v2 0/4] Simplify SMM Relocated Process

Wu, Jiaxin posted 4 patches 1 year, 3 months ago
Failed in applying to current master (apply log)
.../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |  37 ++++-
.../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf        |   4 +
UefiCpuPkg/Include/Guid/SmmBaseHob.h               |  49 ++++++
.../Library/SmmCpuFeaturesLib/CpuFeaturesLib.h     |   2 +
.../SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c     |  23 ++-
.../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf        |   4 +
.../SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf     |   1 +
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c      |   1 -
.../StandaloneMmCpuFeaturesLib.inf                 |   4 +
UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c                  |  21 ++-
UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  29 +++-
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c         | 185 ++++++++++++++++-----
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |  31 +++-
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf       |   1 +
UefiCpuPkg/UefiCpuPkg.dec                          |   3 +
15 files changed, 332 insertions(+), 63 deletions(-)
create mode 100644 UefiCpuPkg/Include/Guid/SmmBaseHob.h
[edk2-devel] [PATCH v2 0/4] Simplify SMM Relocated Process
Posted by Wu, Jiaxin 1 year, 3 months ago
The default SMBASE for the x86 processor is 0x30000. When
SMI happens, CPU runs the SMI handler at SMBASE+0x8000.
Also, the SMM save state area is within SMBASE+0x10000.

One of the SMM initialization from CPU perspective is to
program the new SMBASE (in TSEG range) for each CPU thread.
When the SMBASE relocated happens in one PEI module ahead
of the PiSmmCpuDxeSmm, the PEI module shall produce the
SMM_BASE_HOB in HOB database which tells the PiSmmCpuDxeSmm
driver which runs at a later phase about the new SMBASE for
each CPU thread. PiSmmCpuDxeSmm driver shall install the
SMI handler at the SMM_BASE_HOB.SmBase[Index]+0x8000 for
CPU thread Index. When the HOB doesn't exist,
PiSmmCpuDxeSmm driver shall program the new SMBASE itself.

Those patches add the SMM Base HOB, which can be produced
by any PEI module to do the SmBase relocation ahead of
PiSmmCpuDxeSmm driver and store the relocated SmBase
address in array for reach Processors. PiSmmCpuDxeSmm
and SmmCpuFeaturesLib will consume the HOB to simplify
SMM relocation process.

With SMM Base Hob, PiSmmCpuDxeSmm does not need the RSM
instruction to reload the SMBASE register with the new allocated
SMBASE each time when it exits SMM. 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 CPUs over-writing
each other's SMM Save State Area will not happen. This way makes
the first SMI init can be executed in parallel and save boot
time on multi-core system.

Jiaxin Wu (4):
  UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data
  UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info
  UefiCpuPkg/SmmCpuFeaturesLib: Skip to configure SMBASE
  OvmfPkg/SmmCpuFeaturesLib: Skip to configure SMBASE

 .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c  |  37 ++++-
 .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf        |   4 +
 UefiCpuPkg/Include/Guid/SmmBaseHob.h               |  49 ++++++
 .../Library/SmmCpuFeaturesLib/CpuFeaturesLib.h     |   2 +
 .../SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c     |  23 ++-
 .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf        |   4 +
 .../SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf     |   1 +
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c      |   1 -
 .../StandaloneMmCpuFeaturesLib.inf                 |   4 +
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c                  |  21 ++-
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  29 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c         | 185 ++++++++++++++++-----
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |  31 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf       |   1 +
 UefiCpuPkg/UefiCpuPkg.dec                          |   3 +
 15 files changed, 332 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 (#98484): https://edk2.groups.io/g/devel/message/98484
Mute This Topic: https://groups.io/mt/96247959/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-