]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg: Revert "UefiCpuPkg: Enable Tdx support in MpInitLib"
authorMin M Xu <min.m.xu@intel.com>
Sat, 7 May 2022 01:36:18 +0000 (09:36 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 11 May 2022 08:40:53 +0000 (08:40 +0000)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918

This reverts commit 88da06ca763eb6514565c1867a801a427c1f3447.
This commit triggers the ASSERT in Non-Td guest.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h [deleted file]
UefiCpuPkg/Library/MpInitLib/MpLib.c
UefiCpuPkg/Library/MpInitLib/MpLibTdx.c [deleted file]
UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c [deleted file]
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf

index 159b4d16ed0e9f3270b2a67065f88adaca529154..e1cd0b35000831560d736a10b8f017597bbcae48 100644 (file)
 [Sources.IA32]\r
   Ia32/AmdSev.c\r
   Ia32/MpFuncs.nasm\r
-  MpLibTdxNull.c\r
 \r
 [Sources.X64]\r
   X64/AmdSev.c\r
   X64/MpFuncs.nasm\r
-  MpLibTdx.c\r
 \r
 [Sources.common]\r
   AmdSev.c\r
@@ -38,7 +36,6 @@
   MpLib.c\r
   MpLib.h\r
   Microcode.c\r
-  MpIntelTdx.h\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
diff --git a/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h b/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h
deleted file mode 100644 (file)
index 8a26f6c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/** @file\r
-  CPU MP Initialize Library header file for Td guest.\r
-\r
-  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>\r
-\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef MP_INTEL_TDX_H_\r
-#define MP_INTEL_TDX_H_\r
-\r
-#include <PiPei.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Uefi/UefiBaseType.h>\r
-#include <Protocol/MpService.h>\r
-\r
-/**\r
-  Gets detailed MP-related information on the requested processor at the\r
-  instant this call is made. This service may only be called from the BSP.\r
-\r
-  @param[in]  ProcessorNumber       The handle number of processor.\r
-  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for\r
-                                    the requested processor is deposited.\r
-  @param[out]  HealthData            Return processor health data.\r
-\r
-  @retval EFI_SUCCESS             Processor information was returned.\r
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.\r
-  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.\r
-  @retval EFI_NOT_FOUND           The processor with the handle specified by\r
-                                  ProcessorNumber does not exist in the platform.\r
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetProcessorInfo (\r
-  IN  UINTN                      ProcessorNumber,\r
-  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,\r
-  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL\r
-  );\r
-\r
-/**\r
-  Retrieves the number of logical processor in the platform and the number of\r
-  those logical processors that are enabled on this boot. This service may only\r
-  be called from the BSP.\r
-\r
-  @param[out] NumberOfProcessors          Pointer to the total number of logical\r
-                                          processors in the system, including the BSP\r
-                                          and disabled APs.\r
-  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical\r
-                                          processors that exist in system, including\r
-                                          the BSP.\r
-\r
-  @retval EFI_SUCCESS             The number of logical processors and enabled\r
-                                  logical processors was retrieved.\r
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.\r
-  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors\r
-                                  is NULL.\r
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetNumberOfProcessors (\r
-  OUT UINTN *NumberOfProcessors, OPTIONAL\r
-  OUT UINTN *NumberOfEnabledProcessors  OPTIONAL\r
-  );\r
-\r
-#endif\r
index 91c7afaeb2ada642d1ce24be22608f1e266a3026..4a73787ee43a649548e05964f6b04f24b059c83f 100644 (file)
@@ -9,11 +9,9 @@
 **/\r
 \r
 #include "MpLib.h"\r
-#include "MpIntelTdx.h"\r
 #include <Library/VmgExitLib.h>\r
 #include <Register/Amd/Fam17Msr.h>\r
 #include <Register/Amd/Ghcb.h>\r
-#include <ConfidentialComputingGuestAttr.h>\r
 \r
 EFI_GUID  mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;\r
 \r
@@ -1805,10 +1803,6 @@ MpInitLibInitialize (
   UINTN                    BackupBufferAddr;\r
   UINTN                    ApIdtBase;\r
 \r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
   OldCpuMpData = GetCpuMpDataFromGuidedHob ();\r
   if (OldCpuMpData == NULL) {\r
     MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);\r
@@ -2079,10 +2073,6 @@ MpInitLibGetProcessorInfo (
   CPU_INFO_IN_HOB  *CpuInfoInHob;\r
   UINTN            OriginalProcessorNumber;\r
 \r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    return TdxMpInitLibGetProcessorInfo (ProcessorNumber, ProcessorInfoBuffer, HealthData);\r
-  }\r
-\r
   CpuMpData    = GetCpuMpData ();\r
   CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;\r
 \r
@@ -2177,10 +2167,6 @@ SwitchBSPWorker (
   BOOLEAN                      OldInterruptState;\r
   BOOLEAN                      OldTimerInterruptState;\r
 \r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
   //\r
   // Save and Disable Local APIC timer interrupt\r
   //\r
@@ -2321,10 +2307,6 @@ EnableDisableApWorker (
   CPU_MP_DATA  *CpuMpData;\r
   UINTN        CallerNumber;\r
 \r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
   CpuMpData = GetCpuMpData ();\r
 \r
   //\r
@@ -2385,11 +2367,6 @@ MpInitLibWhoAmI (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    *ProcessorNumber = 0;\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
   CpuMpData = GetCpuMpData ();\r
 \r
   return GetProcessorNumber (CpuMpData, ProcessorNumber);\r
@@ -2428,16 +2405,12 @@ MpInitLibGetNumberOfProcessors (
   UINTN        EnabledProcessorNumber;\r
   UINTN        Index;\r
 \r
+  CpuMpData = GetCpuMpData ();\r
+\r
   if ((NumberOfProcessors == NULL) && (NumberOfEnabledProcessors == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    return TdxMpInitLibGetNumberOfProcessors (NumberOfProcessors, NumberOfEnabledProcessors);\r
-  }\r
-\r
-  CpuMpData = GetCpuMpData ();\r
-\r
   //\r
   // Check whether caller processor is BSP\r
   //\r
@@ -2517,16 +2490,13 @@ StartupAllCPUsWorker (
   BOOLEAN      HasEnabledAp;\r
   CPU_STATE    ApState;\r
 \r
+  CpuMpData = GetCpuMpData ();\r
+\r
   if (FailedCpuList != NULL) {\r
     *FailedCpuList = NULL;\r
   }\r
 \r
-  Status = MpInitLibGetNumberOfProcessors (&ProcessorCount, NULL);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  if ((ProcessorCount == 1) && ExcludeBsp) {\r
+  if ((CpuMpData->CpuCount == 1) && ExcludeBsp) {\r
     return EFI_NOT_STARTED;\r
   }\r
 \r
@@ -2534,22 +2504,6 @@ StartupAllCPUsWorker (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    //\r
-    // For Td guest ExcludeBsp must be FALSE. Otherwise it will return in above checks.\r
-    //\r
-    ASSERT (!ExcludeBsp);\r
-\r
-    //\r
-    // Start BSP.\r
-    //\r
-    Procedure (ProcedureArgument);\r
-\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  CpuMpData = GetCpuMpData ();\r
-\r
   //\r
   // Check whether caller processor is BSP\r
   //\r
@@ -2689,13 +2643,6 @@ StartupThisAPWorker (
   CPU_AP_DATA  *CpuData;\r
   UINTN        CallerNumber;\r
 \r
-  //\r
-  // In Td guest, startup of AP is not supported in current stage.\r
-  //\r
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
   CpuMpData = GetCpuMpData ();\r
 \r
   if (Finished != NULL) {\r
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLibTdx.c b/UefiCpuPkg/Library/MpInitLib/MpLibTdx.c
deleted file mode 100644 (file)
index fdb58fb..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file\r
-  CPU MP Initialize Library common functions for Td guest.\r
-\r
-  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>\r
-\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "MpLib.h"\r
-#include "MpIntelTdx.h"\r
-\r
-/**\r
-  Gets detailed MP-related information on the requested processor at the\r
-  instant this call is made. This service may only be called from the BSP.\r
-\r
-  In current stage only the BSP is workable. So ProcessorNumber should be 0.\r
-\r
-  @param[in]  ProcessorNumber       The handle number of processor.\r
-  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for\r
-                                    the requested processor is deposited.\r
-  @param[out]  HealthData            Return processor health data.\r
-\r
-  @retval EFI_SUCCESS             Processor information was returned.\r
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.\r
-  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL or ProcessorNumber is not 0.\r
-  @retval EFI_NOT_FOUND           The processor with the handle specified by\r
-                                  ProcessorNumber does not exist in the platform.\r
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetProcessorInfo (\r
-  IN  UINTN                      ProcessorNumber,\r
-  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,\r
-  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL\r
-  )\r
-{\r
-  UINTN  OriginalProcessorNumber;\r
-\r
-  //\r
-  // Lower 24 bits contains the actual processor number.\r
-  //\r
-  OriginalProcessorNumber = ProcessorNumber;\r
-  ProcessorNumber        &= BIT24 - 1;\r
-\r
-  if ((ProcessorInfoBuffer == NULL) || (ProcessorNumber != 0)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  ProcessorInfoBuffer->ProcessorId = 0;\r
-  ProcessorInfoBuffer->StatusFlag  = PROCESSOR_AS_BSP_BIT | PROCESSOR_ENABLED_BIT;\r
-  ZeroMem (&ProcessorInfoBuffer->Location, sizeof (EFI_CPU_PHYSICAL_LOCATION));\r
-\r
-  if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) != 0) {\r
-    ZeroMem (&ProcessorInfoBuffer->ExtendedInformation.Location2, sizeof (EFI_CPU_PHYSICAL_LOCATION2));\r
-  }\r
-\r
-  if (HealthData != NULL) {\r
-    HealthData->Uint32 = 0;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Retrieves the number of logical processor in the platform and the number of\r
-  those logical processors that are enabled on this boot. This service may only\r
-  be called from the BSP.\r
-\r
-  @param[out] NumberOfProcessors          Pointer to the total number of logical\r
-                                          processors in the system, including the BSP\r
-                                          and disabled APs.\r
-  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical\r
-                                          processors that exist in system, including\r
-                                          the BSP.\r
-\r
-  @retval EFI_SUCCESS             The number of logical processors and enabled\r
-                                  logical processors was retrieved.\r
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.\r
-  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors\r
-                                  is NULL.\r
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetNumberOfProcessors (\r
-  OUT UINTN *NumberOfProcessors, OPTIONAL\r
-  OUT UINTN *NumberOfEnabledProcessors OPTIONAL\r
-  )\r
-{\r
-  ASSERT (NumberOfProcessors != NULL || NumberOfEnabledProcessors != NULL);\r
-  //\r
-  // In current stage only the BSP is workable. So NumberOfProcessors\r
-  // & NumberOfEnableddProcessors are both 1.\r
-  //\r
-  if (NumberOfProcessors != NULL) {\r
-    *NumberOfProcessors = 1;\r
-  }\r
-\r
-  if (NumberOfEnabledProcessors != NULL) {\r
-    *NumberOfEnabledProcessors = 1;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c b/UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c
deleted file mode 100644 (file)
index b5aaf6d..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/** @file\r
-  CPU MP Initialize Library common functions (NULL instance) for Td guest.\r
-\r
-  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>\r
-\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "MpLib.h"\r
-#include "MpIntelTdx.h"\r
-\r
-/**\r
-  Gets detailed MP-related information on the requested processor at the\r
-  instant this call is made. This service may only be called from the BSP.\r
-\r
-  @param[in]  ProcessorNumber       The handle number of processor.\r
-  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for\r
-                                    the requested processor is deposited.\r
-  @param[out]  HealthData            Return processor health data.\r
-\r
-  @retval EFI_SUCCESS             Processor information was returned.\r
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.\r
-  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.\r
-  @retval EFI_NOT_FOUND           The processor with the handle specified by\r
-                                  ProcessorNumber does not exist in the platform.\r
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetProcessorInfo (\r
-  IN  UINTN                      ProcessorNumber,\r
-  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,\r
-  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL\r
-  )\r
-{\r
-  ASSERT (FALSE);\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-/**\r
-  Retrieves the number of logical processor in the platform and the number of\r
-  those logical processors that are enabled on this boot. This service may only\r
-  be called from the BSP.\r
-\r
-  @param[out] NumberOfProcessors          Pointer to the total number of logical\r
-                                          processors in the system, including the BSP\r
-                                          and disabled APs.\r
-  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical\r
-                                          processors that exist in system, including\r
-                                          the BSP.\r
-\r
-  @retval EFI_SUCCESS             The number of logical processors and enabled\r
-                                  logical processors was retrieved.\r
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.\r
-  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors\r
-                                  is NULL.\r
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetNumberOfProcessors (\r
-  OUT UINTN *NumberOfProcessors, OPTIONAL\r
-  OUT UINTN                     *NumberOfEnabledProcessors OPTIONAL\r
-  )\r
-{\r
-  ASSERT (FALSE);\r
-  return EFI_UNSUPPORTED;\r
-}\r
index 894be0f8daabfac886be6a8d1330f7c993984476..5facf4db94997beb879e3ff5cfbae37b35b3c425 100644 (file)
 [Sources.IA32]\r
   Ia32/AmdSev.c\r
   Ia32/MpFuncs.nasm\r
-  MpLibTdxNull.c\r
 \r
 [Sources.X64]\r
   X64/AmdSev.c\r
   X64/MpFuncs.nasm\r
-  MpLibTdx.c\r
 \r
 [Sources.common]\r
   AmdSev.c\r
@@ -38,7 +36,6 @@
   MpLib.c\r
   MpLib.h\r
   Microcode.c\r
-  MpIntelTdx.h\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r