From nobody Mon Feb 9 11:07:21 2026 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+89563+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+89563+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1651887412; cv=none; d=zohomail.com; s=zohoarc; b=GZTaHz5JC3JHDK25OukRdJyjlVsqTArx5vQARJkWJG3Pk4QvxnO7ZOgYs00i6uc8voEeNPwC/M1Ff4fjxsVz8Vpuazzshlj3BzvAFmtIy2YUWKd0rCF2kVKSQdJJACjxnD9gQdpu5UA2j5AMYDtIaAtyYxqE6Eo3D57M3T3DyKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651887412; 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=v7sFQA5J14TJjmNjRmVkBGzHbuY0lD6oJPxnPAmqEZE=; b=HZqTiI6mIfVdda26N9cUgyfJFCN3arbeTH3YbrIm5ZtlhAFmGDcmu4/iLoXt3Pk3s2OIGGh82V9WZPvkl3rSpXfPjRlCBNjxJNNkbSTVh39d8eaJle+3Xx30niOshs2ZFo/jVbp+3/A4ptmENZbdqfbpl0yjRaEbMPzgwb6mvRQ= 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+89563+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 1651887412332966.178892979447; Fri, 6 May 2022 18:36:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id FYqzYY1788612xOdzS4U0RID; Fri, 06 May 2022 18:36:51 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.5722.1651887402613426917 for ; Fri, 06 May 2022 18:36:45 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="267463897" X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="267463897" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 18:36:44 -0700 X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="538142993" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.172.52]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 18:36:42 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Eric Dong , Ray Ni , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [edk2-devel] [PATCH V2 1/6] UefiCpuPkg: Revert "UefiCpuPkg: Enable Tdx support in MpInitLib" Date: Sat, 7 May 2022 09:36:18 +0800 Message-Id: In-Reply-To: References: 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,min.m.xu@intel.com X-Gm-Message-State: ilRNIrt0o3KCoLRPixmdBvWmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1651887411; bh=CZBvyT9XPOyza3ApsKS0O0hyhUQBG/rWXYkGjk1S4RU=; h=Cc:Date:From:Reply-To:Subject:To; b=D5z8RXIX0NleGRL51M/Ktjh4Wjf6uXhVzT6jKJl20TFEplOrndHyYJtctM0u6y60TVX oIE49YhZiNj1Cig0/xNXhSXzQ8FM7UIOskIGCQz3Naqowz6+J1P0q2Tnsq6hwibhlhp7r RhttI2ppDlv8fT2s5kkSxpAGX2tKGsmKHHI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1651887414291100013 Content-Type: text/plain; charset="utf-8" From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3918 This reverts commit 88da06ca763eb6514565c1867a801a427c1f3447. This commit triggers the ASSERT in Non-Td guest. Cc: Eric Dong Cc: Ray Ni Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Signed-off-by: Min Xu Reviewed-by: Ray Ni --- UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 3 - UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h | 69 ------------ UefiCpuPkg/Library/MpInitLib/MpLib.c | 63 +---------- UefiCpuPkg/Library/MpInitLib/MpLibTdx.c | 106 ------------------ UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c | 69 ------------ UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 3 - 6 files changed, 5 insertions(+), 308 deletions(-) delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpLibTdx.c delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/DxeMpInitLib.inf index 159b4d16ed0e..e1cd0b350008 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -24,12 +24,10 @@ [Sources.IA32] Ia32/AmdSev.c Ia32/MpFuncs.nasm - MpLibTdxNull.c =20 [Sources.X64] X64/AmdSev.c X64/MpFuncs.nasm - MpLibTdx.c =20 [Sources.common] AmdSev.c @@ -38,7 +36,6 @@ MpLib.c MpLib.h Microcode.c - MpIntelTdx.h =20 [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h b/UefiCpuPkg/Library= /MpInitLib/MpIntelTdx.h deleted file mode 100644 index 8a26f6c19fc4..000000000000 --- a/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h +++ /dev/null @@ -1,69 +0,0 @@ -/** @file - CPU MP Initialize Library header file for Td guest. - - Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef MP_INTEL_TDX_H_ -#define MP_INTEL_TDX_H_ - -#include -#include -#include -#include -#include - -/** - Gets detailed MP-related information on the requested processor at the - instant this call is made. This service may only be called from the BSP. - - @param[in] ProcessorNumber The handle number of processor. - @param[out] ProcessorInfoBuffer A pointer to the buffer where informat= ion for - the requested processor is deposited. - @param[out] HealthData Return processor health data. - - @retval EFI_SUCCESS Processor information was returned. - @retval EFI_DEVICE_ERROR The calling processor is an AP. - @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL. - @retval EFI_NOT_FOUND The processor with the handle specified = by - ProcessorNumber does not exist in the pl= atform. - @retval EFI_NOT_READY MP Initialize Library is not initialized. - -**/ -EFI_STATUS -TdxMpInitLibGetProcessorInfo ( - IN UINTN ProcessorNumber, - OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer, - OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL - ); - -/** - Retrieves the number of logical processor in the platform and the number= of - those logical processors that are enabled on this boot. This service may= only - be called from the BSP. - - @param[out] NumberOfProcessors Pointer to the total number of l= ogical - processors in the system, includ= ing the BSP - and disabled APs. - @param[out] NumberOfEnabledProcessors Pointer to the number of enabled= logical - processors that exist in system,= including - the BSP. - - @retval EFI_SUCCESS The number of logical processors and ena= bled - logical processors was retrieved. - @retval EFI_DEVICE_ERROR The calling processor is an AP. - @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL and NumberOfE= nabledProcessors - is NULL. - @retval EFI_NOT_READY MP Initialize Library is not initialized. - -**/ -EFI_STATUS -TdxMpInitLibGetNumberOfProcessors ( - OUT UINTN *NumberOfProcessors, OPTIONAL - OUT UINTN *NumberOfEnabledProcessors OPTIONAL - ); - -#endif diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 91c7afaeb2ad..4a73787ee43a 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -9,11 +9,9 @@ **/ =20 #include "MpLib.h" -#include "MpIntelTdx.h" #include #include #include -#include =20 EFI_GUID mCpuInitMpLibHobGuid =3D CPU_INIT_MP_LIB_HOB_GUID; =20 @@ -1805,10 +1803,6 @@ MpInitLibInitialize ( UINTN BackupBufferAddr; UINTN ApIdtBase; =20 - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - return EFI_SUCCESS; - } - OldCpuMpData =3D GetCpuMpDataFromGuidedHob (); if (OldCpuMpData =3D=3D NULL) { MaxLogicalProcessorNumber =3D PcdGet32 (PcdCpuMaxLogicalProcessorNumbe= r); @@ -2079,10 +2073,6 @@ MpInitLibGetProcessorInfo ( CPU_INFO_IN_HOB *CpuInfoInHob; UINTN OriginalProcessorNumber; =20 - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - return TdxMpInitLibGetProcessorInfo (ProcessorNumber, ProcessorInfoBuf= fer, HealthData); - } - CpuMpData =3D GetCpuMpData (); CpuInfoInHob =3D (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob; =20 @@ -2177,10 +2167,6 @@ SwitchBSPWorker ( BOOLEAN OldInterruptState; BOOLEAN OldTimerInterruptState; =20 - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - return EFI_UNSUPPORTED; - } - // // Save and Disable Local APIC timer interrupt // @@ -2321,10 +2307,6 @@ EnableDisableApWorker ( CPU_MP_DATA *CpuMpData; UINTN CallerNumber; =20 - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - return EFI_UNSUPPORTED; - } - CpuMpData =3D GetCpuMpData (); =20 // @@ -2385,11 +2367,6 @@ MpInitLibWhoAmI ( return EFI_INVALID_PARAMETER; } =20 - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - *ProcessorNumber =3D 0; - return EFI_SUCCESS; - } - CpuMpData =3D GetCpuMpData (); =20 return GetProcessorNumber (CpuMpData, ProcessorNumber); @@ -2428,16 +2405,12 @@ MpInitLibGetNumberOfProcessors ( UINTN EnabledProcessorNumber; UINTN Index; =20 + CpuMpData =3D GetCpuMpData (); + if ((NumberOfProcessors =3D=3D NULL) && (NumberOfEnabledProcessors =3D= =3D NULL)) { return EFI_INVALID_PARAMETER; } =20 - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - return TdxMpInitLibGetNumberOfProcessors (NumberOfProcessors, NumberOf= EnabledProcessors); - } - - CpuMpData =3D GetCpuMpData (); - // // Check whether caller processor is BSP // @@ -2517,16 +2490,13 @@ StartupAllCPUsWorker ( BOOLEAN HasEnabledAp; CPU_STATE ApState; =20 + CpuMpData =3D GetCpuMpData (); + if (FailedCpuList !=3D NULL) { *FailedCpuList =3D NULL; } =20 - Status =3D MpInitLibGetNumberOfProcessors (&ProcessorCount, NULL); - if (EFI_ERROR (Status)) { - return Status; - } - - if ((ProcessorCount =3D=3D 1) && ExcludeBsp) { + if ((CpuMpData->CpuCount =3D=3D 1) && ExcludeBsp) { return EFI_NOT_STARTED; } =20 @@ -2534,22 +2504,6 @@ StartupAllCPUsWorker ( return EFI_INVALID_PARAMETER; } =20 - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - // - // For Td guest ExcludeBsp must be FALSE. Otherwise it will return in = above checks. - // - ASSERT (!ExcludeBsp); - - // - // Start BSP. - // - Procedure (ProcedureArgument); - - return EFI_SUCCESS; - } - - CpuMpData =3D GetCpuMpData (); - // // Check whether caller processor is BSP // @@ -2689,13 +2643,6 @@ StartupThisAPWorker ( CPU_AP_DATA *CpuData; UINTN CallerNumber; =20 - // - // In Td guest, startup of AP is not supported in current stage. - // - if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { - return EFI_UNSUPPORTED; - } - CpuMpData =3D GetCpuMpData (); =20 if (Finished !=3D NULL) { diff --git a/UefiCpuPkg/Library/MpInitLib/MpLibTdx.c b/UefiCpuPkg/Library/M= pInitLib/MpLibTdx.c deleted file mode 100644 index fdb58fba9323..000000000000 --- a/UefiCpuPkg/Library/MpInitLib/MpLibTdx.c +++ /dev/null @@ -1,106 +0,0 @@ -/** @file - CPU MP Initialize Library common functions for Td guest. - - Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "MpLib.h" -#include "MpIntelTdx.h" - -/** - Gets detailed MP-related information on the requested processor at the - instant this call is made. This service may only be called from the BSP. - - In current stage only the BSP is workable. So ProcessorNumber should be = 0. - - @param[in] ProcessorNumber The handle number of processor. - @param[out] ProcessorInfoBuffer A pointer to the buffer where informat= ion for - the requested processor is deposited. - @param[out] HealthData Return processor health data. - - @retval EFI_SUCCESS Processor information was returned. - @retval EFI_DEVICE_ERROR The calling processor is an AP. - @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL or Processor= Number is not 0. - @retval EFI_NOT_FOUND The processor with the handle specified = by - ProcessorNumber does not exist in the pl= atform. - @retval EFI_NOT_READY MP Initialize Library is not initialized. - -**/ -EFI_STATUS -TdxMpInitLibGetProcessorInfo ( - IN UINTN ProcessorNumber, - OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer, - OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL - ) -{ - UINTN OriginalProcessorNumber; - - // - // Lower 24 bits contains the actual processor number. - // - OriginalProcessorNumber =3D ProcessorNumber; - ProcessorNumber &=3D BIT24 - 1; - - if ((ProcessorInfoBuffer =3D=3D NULL) || (ProcessorNumber !=3D 0)) { - return EFI_INVALID_PARAMETER; - } - - ProcessorInfoBuffer->ProcessorId =3D 0; - ProcessorInfoBuffer->StatusFlag =3D PROCESSOR_AS_BSP_BIT | PROCESSOR_EN= ABLED_BIT; - ZeroMem (&ProcessorInfoBuffer->Location, sizeof (EFI_CPU_PHYSICAL_LOCATI= ON)); - - if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) !=3D 0) { - ZeroMem (&ProcessorInfoBuffer->ExtendedInformation.Location2, sizeof (= EFI_CPU_PHYSICAL_LOCATION2)); - } - - if (HealthData !=3D NULL) { - HealthData->Uint32 =3D 0; - } - - return EFI_SUCCESS; -} - -/** - Retrieves the number of logical processor in the platform and the number= of - those logical processors that are enabled on this boot. This service may= only - be called from the BSP. - - @param[out] NumberOfProcessors Pointer to the total number of l= ogical - processors in the system, includ= ing the BSP - and disabled APs. - @param[out] NumberOfEnabledProcessors Pointer to the number of enabled= logical - processors that exist in system,= including - the BSP. - - @retval EFI_SUCCESS The number of logical processors and ena= bled - logical processors was retrieved. - @retval EFI_DEVICE_ERROR The calling processor is an AP. - @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL and NumberOfE= nabledProcessors - is NULL. - @retval EFI_NOT_READY MP Initialize Library is not initialized. - -**/ -EFI_STATUS -TdxMpInitLibGetNumberOfProcessors ( - OUT UINTN *NumberOfProcessors, OPTIONAL - OUT UINTN *NumberOfEnabledProcessors OPTIONAL - ) -{ - ASSERT (NumberOfProcessors !=3D NULL || NumberOfEnabledProcessors !=3D N= ULL); - // - // In current stage only the BSP is workable. So NumberOfProcessors - // & NumberOfEnableddProcessors are both 1. - // - if (NumberOfProcessors !=3D NULL) { - *NumberOfProcessors =3D 1; - } - - if (NumberOfEnabledProcessors !=3D NULL) { - *NumberOfEnabledProcessors =3D 1; - } - - return EFI_SUCCESS; -} diff --git a/UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c b/UefiCpuPkg/Libra= ry/MpInitLib/MpLibTdxNull.c deleted file mode 100644 index b5aaf6df283f..000000000000 --- a/UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c +++ /dev/null @@ -1,69 +0,0 @@ -/** @file - CPU MP Initialize Library common functions (NULL instance) for Td guest. - - Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "MpLib.h" -#include "MpIntelTdx.h" - -/** - Gets detailed MP-related information on the requested processor at the - instant this call is made. This service may only be called from the BSP. - - @param[in] ProcessorNumber The handle number of processor. - @param[out] ProcessorInfoBuffer A pointer to the buffer where informat= ion for - the requested processor is deposited. - @param[out] HealthData Return processor health data. - - @retval EFI_SUCCESS Processor information was returned. - @retval EFI_DEVICE_ERROR The calling processor is an AP. - @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL. - @retval EFI_NOT_FOUND The processor with the handle specified = by - ProcessorNumber does not exist in the pl= atform. - @retval EFI_NOT_READY MP Initialize Library is not initialized. - -**/ -EFI_STATUS -TdxMpInitLibGetProcessorInfo ( - IN UINTN ProcessorNumber, - OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer, - OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} - -/** - Retrieves the number of logical processor in the platform and the number= of - those logical processors that are enabled on this boot. This service may= only - be called from the BSP. - - @param[out] NumberOfProcessors Pointer to the total number of l= ogical - processors in the system, includ= ing the BSP - and disabled APs. - @param[out] NumberOfEnabledProcessors Pointer to the number of enabled= logical - processors that exist in system,= including - the BSP. - - @retval EFI_SUCCESS The number of logical processors and ena= bled - logical processors was retrieved. - @retval EFI_DEVICE_ERROR The calling processor is an AP. - @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL and NumberOfE= nabledProcessors - is NULL. - @retval EFI_NOT_READY MP Initialize Library is not initialized. - -**/ -EFI_STATUS -TdxMpInitLibGetNumberOfProcessors ( - OUT UINTN *NumberOfProcessors, OPTIONAL - OUT UINTN *NumberOfEnabledProcessors OPTIONAL - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/PeiMpInitLib.inf index 894be0f8daab..5facf4db9499 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -24,12 +24,10 @@ [Sources.IA32] Ia32/AmdSev.c Ia32/MpFuncs.nasm - MpLibTdxNull.c =20 [Sources.X64] X64/AmdSev.c X64/MpFuncs.nasm - MpLibTdx.c =20 [Sources.common] AmdSev.c @@ -38,7 +36,6 @@ MpLib.c MpLib.h Microcode.c - MpIntelTdx.h =20 [Packages] MdePkg/MdePkg.dec --=20 2.29.2.windows.2 -=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 (#89563): https://edk2.groups.io/g/devel/message/89563 Mute This Topic: https://groups.io/mt/90946715/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-