public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [edk2-devel] [Patch V2 2/6] MdePkg/BaseLib: Use PcdSpeculationBarrierType
Date: Tue, 30 Apr 2019 15:17:43 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5B9CA0300@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <14c3be99-8187-39ab-2293-bc7aaa6b0abe@redhat.com>

Laszlo,

I agree the current usage is only for IA32/X64 source
files so your suggestion make sense.  If there is
a use case for other archs in the future for this PCD,
then the INF would have to be updated.

Mike

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Tuesday, April 30, 2019 4:50 AM
> To: devel@edk2.groups.io; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: Re: [edk2-devel] [Patch V2 2/6]
> MdePkg/BaseLib: Use PcdSpeculationBarrierType
> 
> 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.gao@intel.com>
> > Signed-off-by: Michael D Kinney
> <michael.d.kinney@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.PcdControlFlowEnforcementPrope
> rtyMask   ## SOMETIMES_CONSUMES
> > +  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType
> ## SOMETIMES_CONSUMES
> >
> >  [FeaturePcd]
> >    gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ##
> CONSUMES
> 
> So, based on the example of
> 
> 
> MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCp
> u.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 <lersek@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);
> > +  }
> >  }
> >


  reply	other threads:[~2019-04-30 15:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30  1:30 [Patch V2 0/6] Resolve Quark build and boot issues Michael D Kinney
2019-04-30  1:30 ` [Patch V2 1/6] MdePkg: Add PcdSpeculationBarrierType Michael D Kinney
2019-04-30 11:47   ` [edk2-devel] " Laszlo Ersek
2019-04-30 15:16     ` Michael D Kinney
2019-04-30 15:43       ` Laszlo Ersek
2019-04-30  1:30 ` [Patch V2 2/6] MdePkg/BaseLib: Use PcdSpeculationBarrierType Michael D Kinney
2019-04-30 11:49   ` [edk2-devel] " Laszlo Ersek
2019-04-30 15:17     ` Michael D Kinney [this message]
2019-04-30 22:24   ` Brian J. Johnson
2019-04-30  1:30 ` [Patch V2 3/6] QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID Michael D Kinney
2019-04-30  1:30 ` [Patch V2 4/6] UefiCpuPkg/MpInitLib: Avoid MSR_IA32_APIC_BASE for single core Michael D Kinney
2019-04-30 10:31   ` Laszlo Ersek
2019-04-30  1:30 ` [Patch V2 5/6] QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close Michael D Kinney
2019-04-30  1:30 ` [Patch V2 6/6] QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E92EE9817A31E24EB0585FDF735412F5B9CA0300@ORSMSX113.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox