On 04/30/19 03:30, Michael D Kinney wrote: > Use PcdSpeculationBarrierType in the x86 implementation > of SpeculationBarrier() to select between AsmLfence(), > AsmCpuid(), and no operation. > > Cc: Liming Gao <liming....@intel.com> > Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com> > --- > MdePkg/Library/BaseLib/BaseLib.inf | 1 + > MdePkg/Library/BaseLib/X86SpeculationBarrier.c | 8 ++++++-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/MdePkg/Library/BaseLib/BaseLib.inf > b/MdePkg/Library/BaseLib/BaseLib.inf > index 533e83e0b2..3586beb0ab 100644 > --- a/MdePkg/Library/BaseLib/BaseLib.inf > +++ b/MdePkg/Library/BaseLib/BaseLib.inf > @@ -394,6 +394,7 @@ [Pcd] > gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## > SOMETIMES_CONSUMES > gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## > SOMETIMES_CONSUMES > gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask ## > SOMETIMES_CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType ## > SOMETIMES_CONSUMES > > [FeaturePcd] > gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList ## CONSUMES
So, based on the example of MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf and a few other INF files, I think we could use [Pcd.IA32, Pcd.X64] here as well. Just an idea. Reviewed-by: Laszlo Ersek <ler...@redhat.com> Thanks Laszlo > diff --git a/MdePkg/Library/BaseLib/X86SpeculationBarrier.c > b/MdePkg/Library/BaseLib/X86SpeculationBarrier.c > index 8e5f983bb8..b28fd8de9b 100644 > --- a/MdePkg/Library/BaseLib/X86SpeculationBarrier.c > +++ b/MdePkg/Library/BaseLib/X86SpeculationBarrier.c > @@ -1,7 +1,7 @@ > /** @file > SpeculationBarrier() function for IA32 and x64. > > - Copyright (C) 2018, Intel Corporation. All rights reserved.<BR> > + Copyright (C) 2018 - 2019, Intel Corporation. All rights reserved.<BR> > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -22,5 +22,9 @@ SpeculationBarrier ( > VOID > ) > { > - AsmLfence (); > + if (PcdGet8 (PcdSpeculationBarrierType) == 0x01) { > + AsmLfence (); > + } else if (PcdGet8 (PcdSpeculationBarrierType) == 0x02) { > + AsmCpuid (0x01, NULL, NULL, NULL, NULL); > + } > } > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39846): https://edk2.groups.io/g/devel/message/39846 Mute This Topic: https://groups.io/mt/31415901/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-