Files
system76-edk2/OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf
Jiaxin Wu 3dfd64305b OvmfPkg/SmmRelocationLib: Add library instance for OVMF
There are below 2 differences between AMD & OVMF according
existing implementation:
1.The mode of the CPU check is different between the AMD & OVMF.
OVMF:
CpuSaveState->x86.SMMRevId & 0Xffff

AMD:
 LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA

2.Existing SmBase configuration is different between the
AMD & OVMF.
OVMF:
 if ((CpuSaveState->x86.SMMRevId & 0xFFFF) == 0) {
   CpuSaveState->x86.SMBASE = mSmBaseForAllCpus[CpuIndex];
 } else {
   CpuSaveState->x64.SMBASE = mSmBaseForAllCpus[CpuIndex];
 }

AMD:
 AmdCpuState->x64.SMBASE = mSmBaseForAllCpus[CpuIndex];

This patch provides the SmmRelocationLib library instance
for OVMF to handle the logic difference, and it won't change
the existing implementation code logic.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2024-05-08 01:53:58 +00:00

61 lines
1.5 KiB
INI

## @file
# SMM Relocation Lib for each processor.
#
# This Lib produces the SMM_BASE_HOB in HOB database which tells
# the PiSmmCpuDxeSmm driver (runs at a later phase) about the new
# SMBASE for each processor. PiSmmCpuDxeSmm driver installs the
# SMI handler at the SMM_BASE_HOB.SmBase[Index]+0x8000 for processor
# Index.
#
# Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = SmmRelocationLib
FILE_GUID = 51834F51-CCE0-4743-B553-935D0C8A53FF
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
LIBRARY_CLASS = SmmRelocationLib
[Sources]
InternalSmmRelocationLib.h
SmramSaveStateConfig.c
SmmRelocationLib.c
[Sources.Ia32]
Ia32/Semaphore.c
Ia32/SmmInit.nasm
[Sources.X64]
X64/Semaphore.c
X64/SmmInit.nasm
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
UefiCpuPkg/UefiCpuPkg.dec
[LibraryClasses]
BaseLib
BaseMemoryLib
CpuExceptionHandlerLib
DebugLib
HobLib
LocalApicLib
MemoryAllocationLib
PcdLib
PeiServicesLib
[Guids]
gSmmBaseHobGuid ## HOB ALWAYS_PRODUCED
gEfiSmmSmramMemoryGuid ## CONSUMES
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber
[FeaturePcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport ## CONSUMES