mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 08:04:07 +02:00
UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4337 This patch is to avoid configure SMBASE if SmBase relocation has been done. If gSmmBaseHobGuid found, means SmBase info has been relocated and recorded in the SmBase array. No need to do the relocation in SmmCpuFeaturesInitializeProcessor(). Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zeng Star <star.zeng@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
parent
ec07fd0e35
commit
f6b86eec5a
@ -9,11 +9,13 @@
|
||||
#ifndef CPU_FEATURES_LIB_H_
|
||||
#define CPU_FEATURES_LIB_H_
|
||||
|
||||
#include <Guid/SmmBaseHob.h>
|
||||
#include <Library/SmmCpuFeaturesLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
|
||||
/**
|
||||
Performs library initialization.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Implementation shared across all library instances.
|
||||
|
||||
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@ -38,6 +38,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
UINT32 mSmrrPhysBaseMsr = SMM_FEATURES_LIB_IA32_SMRR_PHYSBASE;
|
||||
UINT32 mSmrrPhysMaskMsr = SMM_FEATURES_LIB_IA32_SMRR_PHYSMASK;
|
||||
|
||||
//
|
||||
// Indicate SmBase for each Processors has been relocated or not. If TRUE,
|
||||
// means no need to do the relocation in SmmCpuFeaturesInitializeProcessor().
|
||||
//
|
||||
BOOLEAN mSmmCpuFeaturesSmmRelocated;
|
||||
|
||||
//
|
||||
// Set default value to assume MTRRs need to be configured on each SMI
|
||||
//
|
||||
@ -144,6 +150,12 @@ CpuFeaturesLibInitialization (
|
||||
//
|
||||
mSmrrEnabled = (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * GetCpuMaxLogicalProcessorNumber ());
|
||||
ASSERT (mSmrrEnabled != NULL);
|
||||
|
||||
//
|
||||
// If gSmmBaseHobGuid found, means SmBase info has been relocated and recorded
|
||||
// in the SmBase array.
|
||||
//
|
||||
mSmmCpuFeaturesSmmRelocated = (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -186,11 +198,16 @@ SmmCpuFeaturesInitializeProcessor (
|
||||
UINTN FamilyId;
|
||||
UINTN ModelId;
|
||||
|
||||
//
|
||||
// No need to configure SMBASE if SmBase relocation has been done.
|
||||
//
|
||||
if (!mSmmCpuFeaturesSmmRelocated) {
|
||||
//
|
||||
// Configure SMBASE.
|
||||
//
|
||||
CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
|
||||
CpuState->x86.SMBASE = (UINT32)CpuHotPlugData->SmBase[CpuIndex];
|
||||
}
|
||||
|
||||
//
|
||||
// Intel(R) 64 and IA-32 Architectures Software Developer's Manual
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# The CPU specific programming for PiSmmCpuDxeSmm module.
|
||||
#
|
||||
# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
@ -33,6 +33,10 @@
|
||||
PcdLib
|
||||
MemoryAllocationLib
|
||||
DebugLib
|
||||
HobLib
|
||||
|
||||
[Guids]
|
||||
gSmmBaseHobGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOMETIMES_CONSUMES
|
||||
|
@ -2,7 +2,7 @@
|
||||
# The CPU specific programming for PiSmmCpuDxeSmm module when STM support
|
||||
# is included.
|
||||
#
|
||||
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
@ -64,6 +64,7 @@
|
||||
gMsegSmramGuid ## SOMETIMES_CONSUMES ## HOB
|
||||
gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||
gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||
gSmmBaseHobGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOMETIMES_CONSUMES
|
||||
|
@ -1,14 +1,13 @@
|
||||
/** @file
|
||||
SMM STM support functions
|
||||
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2023, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <PiMm.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/SmmServicesTableLib.h>
|
||||
#include <Library/TpmMeasurementLib.h>
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Standalone MM CPU specific programming.
|
||||
#
|
||||
# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) Microsoft Corporation.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -34,6 +34,10 @@
|
||||
DebugLib
|
||||
MemoryAllocationLib
|
||||
PcdLib
|
||||
HobLib
|
||||
|
||||
[Guids]
|
||||
gSmmBaseHobGuid ## CONSUMES
|
||||
|
||||
[FixedPcd]
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOMETIMES_CONSUMES
|
||||
|
Loading…
x
Reference in New Issue
Block a user