From nobody Mon Dec 15 23:27:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106718+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106718+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1688707754; cv=none; d=zohomail.com; s=zohoarc; b=iRpZrwpC8PY6Sm2SdcYJCIQAgjxHFuaJTdTyLyA0+NcGG+c9zzAzAMlWfIz6s7J8EnEo+qhIjm5rDLGDw4Gi5O7x9rlGF3xbgV19y8qiqQaN+ivZcp1HqzxDWKD3vrumii8G8bkpFBM9yUVxXaY8YHuytqpG0YGhdDib58UZ99g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688707754; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=TcWED8wgCTB7gZGh1v7GnNytBWARJmUt01BffwG6/qA=; b=BpRPewbZUXcvHPSRdyng1SbUWVQfDGYtTwSWFm5O1isQ/m4sMXV5QFPcFDFXQfmO7oRmRJBVXJjtMDXSRvLeeSqwqR4TU0MsMcZTQ1vp1JfHHBLMuz70ZVVFiQnkaZq1PvTg44wmuxhKCDIR9xnUmWYhKMXJbEfyEJ6F//BnO/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106718+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1688707754873926.1854605792051; Thu, 6 Jul 2023 22:29:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id PttLYY1788612x5gEoVyTnLL; Thu, 06 Jul 2023 22:29:14 -0700 X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.6404.1688707749454802251 for ; Thu, 06 Jul 2023 22:29:14 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10763"; a="353650684" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="353650684" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2023 22:29:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10763"; a="833232040" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="833232040" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by fmsmga002.fm.intel.com with ESMTP; 06 Jul 2023 22:29:12 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH 4/4] UefiCpuPkg/CpuFeatures: Deprecate CPU_FEATURE_X2APIC Date: Fri, 7 Jul 2023 13:29:01 +0800 Message-Id: <20230707052901.869-5-ray.ni@intel.com> In-Reply-To: <20230707052901.869-1-ray.ni@intel.com> References: <20230707052901.869-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,ray.ni@intel.com X-Gm-Message-State: 0G9Oxa0CuOnmnbjlpt6jmGfrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1688707754; bh=1paFga3vjFc9RbZArbjJISnoLoM1+h8nxsegGNBxuTg=; h=Cc:Date:From:Reply-To:Subject:To; b=uZOIDEN7VRaxn94aWVA7QGAjivMP3qSLd9/FrNMjsUifaT7Wh2aSC7gt8czQe4chYTH GPlESP490rM84mB7lfK5Hjm7UOW1Qf2A6bCumB7qaGbau6WtW3tRzVgS9PGYfvD0kZR5F qoaq2E39yL5OgeD68EIItaaGLSFxDxbLb4I= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1688707756758100019 Content-Type: text/plain; charset="utf-8" Since MpLib supports to sync BSP's initial APIC mode to APs, platform can set BSP to X2 APIC mode before MpLib runs and expect MpLib syncs the X2 APIC mode to all APs. With such capability in MpLib, CpuCommonFeaturesLib's X2 APIC enable logic is dropped for simplificity. Such code removal also removes the confusion regarding how platform controls the X2 APIC enabling. Signed-off-by: Ray Ni Cc: Eric Dong Cc: Rahul Kumar Cc: Gerd Hoffmann --- .../Include/Library/RegisterCpuFeaturesLib.h | 2 +- .../CpuCommonFeaturesLib/CpuCommonFeatures.h | 69 +-------- .../CpuCommonFeaturesLib.c | 14 +- .../CpuCommonFeaturesLib.inf | 1 - .../Library/CpuCommonFeaturesLib/X2Apic.c | 138 ------------------ 5 files changed, 3 insertions(+), 221 deletions(-) delete mode 100644 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c diff --git a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h b/UefiCpuP= kg/Include/Library/RegisterCpuFeaturesLib.h index 36459afc5e..ac5419141e 100644 --- a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h +++ b/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h @@ -44,7 +44,7 @@ #define CPU_FEATURE_C_STATE 21 #define CPU_FEATURE_TM 22 #define CPU_FEATURE_TM2 23 -#define CPU_FEATURE_X2APIC 24 +#define CPU_FEATURE_X2APIC 24 ///< deprecated, do= not use it to enable X2 APIC. #define CPU_FEATURE_RESERVED_25 25 #define CPU_FEATURE_RESERVED_26 26 #define CPU_FEATURE_RESERVED_27 27 diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h b/= UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h index 5434a45f6a..22ecab82e8 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h @@ -1,7 +1,7 @@ /** @file CPU Common features library header file. =20 - Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2013, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -781,73 +781,6 @@ C1eInitialize ( IN BOOLEAN State ); =20 -/** - Prepares for the data used by CPU feature detection and initialization. - - @param[in] NumberOfProcessors The number of CPUs in the platform. - - @return Pointer to a buffer of CPU related configuration data. - - @note This service could be called by BSP only. -**/ -VOID * -EFIAPI -X2ApicGetConfigData ( - IN UINTN NumberOfProcessors - ); - -/** - Detects if X2Apci feature supported on current processor. - - Detect if X2Apci has been already enabled. - - @param[in] ProcessorNumber The index of the CPU executing this functio= n. - @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFOR= MATION - structure for the CPU executing this functi= on. - @param[in] ConfigData A pointer to the configuration buffer retur= ned - by CPU_FEATURE_GET_CONFIG_DATA. NULL if - CPU_FEATURE_GET_CONFIG_DATA was not provide= d in - RegisterCpuFeature(). - - @retval TRUE X2Apci feature is supported. - @retval FALSE X2Apci feature is not supported. - - @note This service could be called by BSP/APs. -**/ -BOOLEAN -EFIAPI -X2ApicSupport ( - IN UINTN ProcessorNumber, - IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, - IN VOID *ConfigData OPTIONAL - ); - -/** - Initializes X2Apci feature to specific state. - - @param[in] ProcessorNumber The index of the CPU executing this functio= n. - @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFOR= MATION - structure for the CPU executing this functi= on. - @param[in] ConfigData A pointer to the configuration buffer retur= ned - by CPU_FEATURE_GET_CONFIG_DATA. NULL if - CPU_FEATURE_GET_CONFIG_DATA was not provide= d in - RegisterCpuFeature(). - @param[in] State If TRUE, then the X2Apci feature must be en= abled. - If FALSE, then the X2Apci feature must be d= isabled. - - @retval RETURN_SUCCESS X2Apci feature is initialized. - - @note This service could be called by BSP only. -**/ -RETURN_STATUS -EFIAPI -X2ApicInitialize ( - IN UINTN ProcessorNumber, - IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, - IN VOID *ConfigData OPTIONAL, - IN BOOLEAN State - ); - /** Prepares for the data used by CPU feature detection and initialization. =20 diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c= b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c index 7f0e1004b9..cc8807c19d 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c @@ -2,7 +2,7 @@ This library registers CPU features defined in Intel(R) 64 and IA-32 Architectures Software Developer's Manual. =20 - Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -192,18 +192,6 @@ CpuCommonFeaturesLibConstructor ( ASSERT_EFI_ERROR (Status); } =20 - if (IsCpuFeatureSupported (CPU_FEATURE_X2APIC)) { - Status =3D RegisterCpuFeature ( - "X2Apic", - X2ApicGetConfigData, - X2ApicSupport, - X2ApicInitialize, - CPU_FEATURE_X2APIC, - CPU_FEATURE_END - ); - ASSERT_EFI_ERROR (Status); - } - if (IsCpuFeatureSupported (CPU_FEATURE_PPIN)) { Status =3D RegisterCpuFeature ( "PPIN", diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.i= nf b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf index 1b823155b1..1a95e745b5 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf @@ -40,7 +40,6 @@ MachineCheck.c MonitorMwait.c PendingBreak.c - X2Apic.c Ppin.c ProcTrace.c =20 diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c b/UefiCpuPkg/= Library/CpuCommonFeaturesLib/X2Apic.c deleted file mode 100644 index 220f307e5a..0000000000 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c +++ /dev/null @@ -1,138 +0,0 @@ -/** @file - X2Apic feature. - - Copyright (c) 2017, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "CpuCommonFeatures.h" - -/** - Prepares for the data used by CPU feature detection and initialization. - - @param[in] NumberOfProcessors The number of CPUs in the platform. - - @return Pointer to a buffer of CPU related configuration data. - - @note This service could be called by BSP only. -**/ -VOID * -EFIAPI -X2ApicGetConfigData ( - IN UINTN NumberOfProcessors - ) -{ - BOOLEAN *ConfigData; - - ConfigData =3D AllocateZeroPool (sizeof (BOOLEAN) * NumberOfProcessors); - ASSERT (ConfigData !=3D NULL); - return ConfigData; -} - -/** - Detects if X2Apci feature supported on current processor. - - Detect if X2Apci has been already enabled. - - @param[in] ProcessorNumber The index of the CPU executing this functio= n. - @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFOR= MATION - structure for the CPU executing this functi= on. - @param[in] ConfigData A pointer to the configuration buffer retur= ned - by CPU_FEATURE_GET_CONFIG_DATA. NULL if - CPU_FEATURE_GET_CONFIG_DATA was not provide= d in - RegisterCpuFeature(). - - @retval TRUE X2Apci feature is supported. - @retval FALSE X2Apci feature is not supported. - - @note This service could be called by BSP/APs. -**/ -BOOLEAN -EFIAPI -X2ApicSupport ( - IN UINTN ProcessorNumber, - IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, - IN VOID *ConfigData OPTIONAL - ) -{ - BOOLEAN *X2ApicEnabled; - - ASSERT (ConfigData !=3D NULL); - X2ApicEnabled =3D (BOOLEAN *)ConfigData; - // - // *ConfigData indicates if X2APIC enabled on current processor - // - X2ApicEnabled[ProcessorNumber] =3D (GetApicMode () =3D=3D LOCAL_APIC_MOD= E_X2APIC) ? TRUE : FALSE; - - return (CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC =3D=3D 1); -} - -/** - Initializes X2Apci feature to specific state. - - @param[in] ProcessorNumber The index of the CPU executing this functio= n. - @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFOR= MATION - structure for the CPU executing this functi= on. - @param[in] ConfigData A pointer to the configuration buffer retur= ned - by CPU_FEATURE_GET_CONFIG_DATA. NULL if - CPU_FEATURE_GET_CONFIG_DATA was not provide= d in - RegisterCpuFeature(). - @param[in] State If TRUE, then the X2Apci feature must be en= abled. - If FALSE, then the X2Apci feature must be d= isabled. - - @retval RETURN_SUCCESS X2Apci feature is initialized. - - @note This service could be called by BSP only. -**/ -RETURN_STATUS -EFIAPI -X2ApicInitialize ( - IN UINTN ProcessorNumber, - IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, - IN VOID *ConfigData OPTIONAL, - IN BOOLEAN State - ) -{ - BOOLEAN *X2ApicEnabled; - - // - // The scope of the MSR_IA32_APIC_BASE is core for below processor type,= only program - // MSR_IA32_APIC_BASE for thread 0 in each core. - // - if (IS_SILVERMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayMod= el)) { - if (CpuInfo->ProcessorInfo.Location.Thread !=3D 0) { - return RETURN_SUCCESS; - } - } - - ASSERT (ConfigData !=3D NULL); - X2ApicEnabled =3D (BOOLEAN *)ConfigData; - if (X2ApicEnabled[ProcessorNumber]) { - PRE_SMM_CPU_REGISTER_TABLE_WRITE_FIELD ( - ProcessorNumber, - Msr, - MSR_IA32_APIC_BASE, - MSR_IA32_APIC_BASE_REGISTER, - Bits.EXTD, - 1 - ); - } else { - // - // Enable X2APIC mode only if X2APIC is not enabled, - // Needn't to disabe X2APIC mode again if X2APIC is not enabled - // - if (State) { - CPU_REGISTER_TABLE_WRITE_FIELD ( - ProcessorNumber, - Msr, - MSR_IA32_APIC_BASE, - MSR_IA32_APIC_BASE_REGISTER, - Bits.EXTD, - 1 - ); - } - } - - return RETURN_SUCCESS; -} --=20 2.39.1.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 (#106718): https://edk2.groups.io/g/devel/message/106718 Mute This Topic: https://groups.io/mt/100000878/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-