From nobody Sun Feb 8 21:47:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39806+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39806+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1556587816; cv=none; d=zoho.com; s=zohoarc; b=MqBOmf48gDcQ1RioJ3ibP1uczuK6UcBV1RrBYotlGuiCF3MuRlp0dgRG7yXDKDNeSQP+J+E4g17v1j5haBhXxJGnCy2x3XB897Q/WxZKfDAD0kdgTuZ/fRpSzxvqCPC7SED27Gma71ljaxmSVsdzlziBVB4YsAKes3wvRF+zbpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556587816; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=IEyeQDGx8+wQbSuSXnWURicc2AV/KI1DadSNCw7ocVc=; b=ltktKM3QpBSkb/pYNmCCtJRT6yJyUZuYyPlhDyPvV1D+yk9vXyCz9GsMc2/7pGnzbFYfy6k5d61Z4Q+ZaQ28ttAvKiiv1Y/QWRPa0Ip8fZQKG+vKjEximaf+ATJ4DQqeq+fZ/mfg6bUsOL/eFTNok/2FUVk+3hTAUlnsEkMuunw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39806+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556587816585331.1854415503492; Mon, 29 Apr 2019 18:30:16 -0700 (PDT) Return-Path: X-Received: from mga04.intel.com (mga04.intel.com []) by groups.io with SMTP; Mon, 29 Apr 2019 18:30:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Apr 2019 18:30:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,411,1549958400"; d="scan'208";a="139954332" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.111.157]) by orsmga006.jf.intel.com with ESMTP; 29 Apr 2019 18:30:15 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Liming Gao Subject: [edk2-devel] [Patch V2 2/6] MdePkg/BaseLib: Use PcdSpeculationBarrierType Date: Mon, 29 Apr 2019 18:30:08 -0700 Message-Id: <20190430013012.24008-3-michael.d.kinney@intel.com> In-Reply-To: <20190430013012.24008-1-michael.d.kinney@intel.com> References: <20190430013012.24008-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556587816; bh=AublY4DfG5/AUdr4MvQAKTIQ9YPTBAyMkywDtm45GvY=; h=Cc:Date:From:Reply-To:Subject:To; b=JY5sbWwIN/BZ2Cv/QQKrOd6Pwjhq+ro2RsqgifpGDT5NAVGtL+3bz00RmRqThW4SSFC 0THyM375kWF5GtFCpbzDLaGiNoEclUslNRZDywuk9/btb4LUxu9JAkyz/jov78pdoqfXj 5v3RCXlcF0FtDqCscTDpQSXwM37LXba4Zs4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Use PcdSpeculationBarrierType in the x86 implementation of SpeculationBarrier() to select between AsmLfence(), AsmCpuid(), and no operation. Cc: Liming Gao Signed-off-by: Michael D Kinney Reviewed-by: Brian J. Johnson Reviewed-by: Laszlo Ersek --- 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/Ba= seLib.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_CO= NSUMES gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## SOMETIMES_CO= NSUMES gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask ## SOME= TIMES_CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType ## SOMETIMES_CO= NSUMES =20 [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList ## CONSUMES diff --git a/MdePkg/Library/BaseLib/X86SpeculationBarrier.c b/MdePkg/Librar= y/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. =20 - Copyright (C) 2018, Intel Corporation. All rights reserved.
+ Copyright (C) 2018 - 2019, Intel Corporation. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -22,5 +22,9 @@ SpeculationBarrier ( VOID ) { - AsmLfence (); + if (PcdGet8 (PcdSpeculationBarrierType) =3D=3D 0x01) { + AsmLfence (); + } else if (PcdGet8 (PcdSpeculationBarrierType) =3D=3D 0x02) { + AsmCpuid (0x01, NULL, NULL, NULL, NULL); + } } --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39806): https://edk2.groups.io/g/devel/message/39806 Mute This Topic: https://groups.io/mt/31415901/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-