Re: [edk2-devel] [PATCH v2] PcAtChipsetPkg: Change the flow of PcRtcInit()

2022-05-06 Thread Ni, Ray
> -  if ((Time->Hour & 0x80) != 0) {
> -IsPM = TRUE;
> -  } else {
> -IsPM = FALSE;
> +  // Check 24-hour format situation
> +  if (RegisterB.Bits.Mil == 1) {
> +if (RegisterB.Bits.Dm == 0) {
> +  if (Time->Hour > 0x23) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +} else {
> +  if (Time->Hour > 0x17) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +}
> +  }
> +
> +  // IsPM only makes sense for 12-hour format.
> +  if (RegisterB.Bits.Mil == 0) {
> +if ((Time->Hour & 0x80) != 0) {
> +  IsPM = TRUE;
> +} else {
> +  IsPM = FALSE;
> +}
>}
> 

Is it possible to remove above check?
RtcTimeFieldsValid() already does the check.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89573): https://edk2.groups.io/g/devel/message/89573
Mute This Topic: https://groups.io/mt/90947516/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V2 0/6] Support 2 CpuMpPei/CpuDxe in One image

2022-05-06 Thread Ni, Ray
Reviewed-by: Ray Ni 

> -Original Message-
> From: Xu, Min M 
> Sent: Saturday, May 7, 2022 9:36 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M ; Dong, Eric ; Ni, Ray 
> ; Brijesh Singh
> ; Aktas, Erdem ; James 
> Bottomley ; Yao, Jiewen
> ; Tom Lendacky ; Gerd Hoffmann 
> 
> Subject: [PATCH V2 0/6] Support 2 CpuMpPei/CpuDxe in One image
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918
> 
> Above BZ reports an issue that commit 88da06ca triggers ASSERT in some
> scenario. This patch-set is to fix this issue.
> 
> As commit 88da06ca describes TDVF BSP and APs are simplied and it can
> simply use MpInitLibUp instead of MpInitLib. To achieve this goal, we
> include 2 CpuMpPei/CpuDxe drivers in OvmfPkgX64 and IntelTdxX64. This
> is done by setting different FILE_GUID to these drivers (of the same
> name). In the other hand, we import a set of MpInitLibDepLib. These
> libs simply depend on the PPI/Protocols. While these PPI/Protocols are
> installed according to the guest type.
> 
> This patch-set is a replacement of
> https://edk2.groups.io/g/devel/message/89381. Please see the dicussion in
>  - https://edk2.groups.io/g/devel/message/89382
>  - https://edk2.groups.io/g/devel/message/89455
>  - https://edk2.groups.io/g/devel/message/89522
>  - https://edk2.groups.io/g/devel/message/89535
> 
> The code is at: https://github.com/mxu9/edk2/tree/Rework-MpInitLib.v2
> 
> v2 changes:
>  - Remove the un-used FILE_GUID definitions.
>  - Delete un-used EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST in DispatchTable.
>  - Add more comments.
> 
> 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 
> 
> Min M Xu (4):
>   UefiCpuPkg: Revert "UefiCpuPkg: Enable Tdx support in MpInitLib"
>   OvmfPkg/Sec: Install MpInitLibDepLib PPIs in SecMain.c
>   OvmfPkg/TdxDxe: Install MpInitLibDepLib protocols
>   OvmfPkg: Enable 2 different CpuMpPei and CpuDxe drivers
> 
> Min Xu (2):
>   OvmfPkg: Add MpInitLibDepLib related PPI/Protocol definitions
>   OvmfPkg: Add MpInitLibDepLib
> 
>  OvmfPkg/Include/Ppi/MpInitLibDep.h|  28 +
>  .../Include/Protocol/MpInitLibDepProtocols.h  |  28 +
>  OvmfPkg/IntelTdx/IntelTdxX64.dsc  |  30 -
>  OvmfPkg/IntelTdx/IntelTdxX64.fdf  |   3 +
>  .../MpInitLibDepLib/DxeMpInitLibMpDepLib.inf  |  27 +
>  .../MpInitLibDepLib/DxeMpInitLibUpDepLib.inf  |  27 +
>  .../Library/MpInitLibDepLib/MpInitLibDepLib.c |  23 
>  .../MpInitLibDepLib/PeiMpInitLibMpDepLib.inf  |  27 +
>  .../MpInitLibDepLib/PeiMpInitLibUpDepLib.inf  |  27 +
>  OvmfPkg/OvmfPkg.dec   |   5 +
>  OvmfPkg/OvmfPkgX64.dsc|  55 -
>  OvmfPkg/OvmfPkgX64.fdf|   4 +
>  OvmfPkg/Sec/SecMain.c |  34 +-
>  OvmfPkg/Sec/SecMain.inf   |   2 +
>  OvmfPkg/TdxDxe/TdxDxe.c   |  22 +++-
>  OvmfPkg/TdxDxe/TdxDxe.inf |   2 +
>  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 -
>  22 files changed, 343 insertions(+), 314 deletions(-)
>  create mode 100644 OvmfPkg/Include/Ppi/MpInitLibDep.h
>  create mode 100644 OvmfPkg/Include/Protocol/MpInitLibDepProtocols.h
>  create mode 100644 OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
>  create mode 100644 OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
>  create mode 100644 OvmfPkg/Library/MpInitLibDepLib/MpInitLibDepLib.c
>  create mode 100644 OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibMpDepLib.inf
>  create mode 100644 OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibUpDepLib.inf
>  delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h
>  delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpLibTdx.c
>  delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c
> 
> --
> 2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89572): https://edk2.groups.io/g/devel/message/89572
Mute This Topic: https://groups.io/mt/90946714/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V2 1/6] UefiCpuPkg: Revert "UefiCpuPkg: Enable Tdx support in MpInitLib"

2022-05-06 Thread Ni, Ray
Reviewed-by: Ray Ni 

> -Original Message-
> From: Xu, Min M 
> Sent: Saturday, May 7, 2022 9:36 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M ; Dong, Eric ; Ni, Ray 
> ; Brijesh Singh
> ; Aktas, Erdem ; James 
> Bottomley ; Yao, Jiewen
> ; Tom Lendacky ; Gerd Hoffmann 
> 
> Subject: [PATCH V2 1/6] UefiCpuPkg: Revert "UefiCpuPkg: Enable Tdx support in 
> MpInitLib"
> 
> From: Min M Xu 
> 
> 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 
> 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 
> ---
>  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/Library/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
> 
>  [Sources.X64]
>X64/AmdSev.c
>X64/MpFuncs.nasm
> -  MpLibTdx.c
> 
>  [Sources.common]
>AmdSev.c
> @@ -38,7 +36,6 @@
>MpLib.c
>MpLib.h
>Microcode.c
> -  MpIntelTdx.h
> 
>  [Packages]
>MdePkg/MdePkg.dec
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h 
> b/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h
> deleted file mode 100644
> index 8a26f6c19fc4..
> --- 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 
> information for
> -the requested processor is deposited.
> -  @param[out]  HealthDataReturn processor health data.
> -
> -  @retval EFI_SUCCESS Processor information was returned.
> -  @retval EFI_DEVICE_ERRORThe 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 
> platform.
> -  @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 
> logical
> -  processors in the system, 
> including 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 
> enabled
> -  logical processors was retrieved.
> -  @retval EFI_DEVICE_ERRORThe calling processor is an AP.
> -  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and 
> NumberOfEnabledProcessors
> -  is NULL.
> -  @retval EFI_NOT_READY   MP Initialize Library is not initialized.
> -
> -**/
> -EFI_STATUS
> -TdxMpInitLibGetNumberOfProcessors (
> -  OUT UINTN *NumberOfProcessors, O

[edk2-devel] [Patch V2] UefiPayloadPkg: Fix the UPL build failure

2022-05-06 Thread duntan
Add double quotes to LlvmObjcopyPath.
Blank space in LlvmObjcopyPath will cause build failure.
This build failure is introduced by 2306555bf908 (
"UefiPayloadPkg: Fix IA32 entry build failure").

Signed-off-by: Dun Tan 
Cc: Ray Ni 
Cc: Guo Dong 
Cc: Benjamin You 
Cc: Sean Rhodes 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 8af381336d..50335d4316 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -111,9 +111,9 @@ def BuildUniversalPayload(Args, MacroList):
 #
 # Copy the DXEFV as a section in elf format Universal Payload entry.
 #
-remove_section = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}"
-add_section= f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--add-section .upld_info={UpldInfoFile} --add-section 
.upld.uefi_fv={FvOutputDir} {EntryOutputDir}"
-set_section= f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--set-section-alignment .upld.upld_info=16 --set-section-alignment 
.upld.uefi_fv=16 {EntryOutputDir}"
+remove_section = f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}'
+add_section= f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--add-section .upld_info={UpldInfoFile} --add-section 
.upld.uefi_fv={FvOutputDir} {EntryOutputDir}'
+set_section= f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--set-section-alignment .upld.upld_info=16 --set-section-alignment 
.upld.uefi_fv=16 {EntryOutputDir}'
 RunCommand(remove_section)
 RunCommand(add_section)
 RunCommand(set_section)
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89570): https://edk2.groups.io/g/devel/message/89570
Mute This Topic: https://groups.io/mt/90948162/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2] PcAtChipsetPkg: Change the flow of PcRtcInit()

2022-05-06 Thread Zhuoran Chao
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3913

The original flow of PcRtcInit() is like:
1. Guarantee atomic accesses to the RTC time registers and
   read out the value.
2. Program RTC register B. (adopt 12h mode or 24h mode. Current
   bios code sets RTC to 24h mode by default).
3. Then function ConvertRtcTimeToEfiTime converts the RTC time
   value to their 24h mode by checking the hour format bit
   (1:24h mode,0:12h mode).
And here lies the problem: Step3 will fail to adjust the value
if Step2 already sets RTC to 24h mode. The hour value in 12h mode
will not be converted to its 24h mode.
The solution is to program RTC register B a little later when all
the original RTC registers' value is retrieved, adjusted
and validated.

ConvertRtcTimeToEfiTime is modified to be more robust.

Cc: Ray Ni 

Signed-off-by: Zhuoran Chao 
---
 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 38 +--
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 0fbfa4bcee..dbce7c217c 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -269,13 +269,6 @@ PcRtcInit (
   Time.Month  = RtcRead (RTC_ADDRESS_MONTH);
   Time.Year   = RtcRead (RTC_ADDRESS_YEAR);
 
-  //
-  // Set RTC configuration after get original time
-  // The value of bit AIE should be reserved.
-  //
-  RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | 
(RegisterB.Data & BIT5);
-  RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
-
   //
   // Release RTC Lock.
   //
@@ -330,6 +323,13 @@ PcRtcInit (
 Time.Daylight   = 0;
   }
 
+  //
+  // Set RTC configuration after get original time
+  // The value of bit AIE should be reserved.
+  //
+  RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | 
(RegisterB.Data & BIT5);
+  RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
+
   //
   // Reset time value according to new RTC configuration
   //
@@ -995,10 +995,26 @@ ConvertRtcTimeToEfiTime (
   BOOLEAN  IsPM;
   UINT8Century;
 
-  if ((Time->Hour & 0x80) != 0) {
-IsPM = TRUE;
-  } else {
-IsPM = FALSE;
+  // Check 24-hour format situation
+  if (RegisterB.Bits.Mil == 1) {
+if (RegisterB.Bits.Dm == 0) {
+  if (Time->Hour > 0x23) {
+return EFI_INVALID_PARAMETER;
+  }
+} else {
+  if (Time->Hour > 0x17) {
+return EFI_INVALID_PARAMETER;
+  }
+}
+  }
+
+  // IsPM only makes sense for 12-hour format.
+  if (RegisterB.Bits.Mil == 0) {
+if ((Time->Hour & 0x80) != 0) {
+  IsPM = TRUE;
+} else {
+  IsPM = FALSE;
+}
   }
 
   Time->Hour = (UINT8)(Time->Hour & 0x7f);
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89569): https://edk2.groups.io/g/devel/message/89569
Mute This Topic: https://groups.io/mt/90947516/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 6/6] OvmfPkg: Enable 2 different CpuMpPei and CpuDxe drivers

2022-05-06 Thread Min Xu
From: Min M Xu 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918

In OvmfPkgX64 we enable 2 different CpuMpPei and CpuDxe drivers. The
difference between the drivers is the MpInitLib or MpInitLibUp. This is
acomplished by adding a MpInitLibDepLib.

In IntelTdxX64 we enable 2 versions of CpuDxe drivers. It is because PEI
is skipped in IntelTdxX64.

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 
---
 OvmfPkg/IntelTdx/IntelTdxX64.dsc | 30 -
 OvmfPkg/IntelTdx/IntelTdxX64.fdf |  3 ++
 OvmfPkg/OvmfPkgX64.dsc   | 55 ++--
 OvmfPkg/OvmfPkgX64.fdf   |  4 +++
 4 files changed, 89 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 73a6c30096a8..80c331ea233a 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -57,6 +57,11 @@
 !endif
 !endif
 
+  #
+  # Define the FILE_GUID of CpuDxe for unique-processor version.
+  #
+  DEFINE UP_CPU_DXE_GUID  = 6490f1c5-ebcc-4665-8892-0075b9bb49b7
+
 [BuildOptions]
   GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
   INTEL:RELEASE_*_*_CC_FLAGS   = /D MDEPKG_NDEBUG
@@ -550,7 +555,30 @@
 
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-  UefiCpuPkg/CpuDxe/CpuDxe.inf
+
+  UefiCpuPkg/CpuDxe/CpuDxe.inf {
+
+  #
+  # Directly use DxeMpInitLib. It depends on DxeMpInitLibMpDepLib which
+  # checks the Protocol of gEfiMpInitLibMpDepProtocolGuid.
+  #
+  MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+  NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
+  }
+
+  UefiCpuPkg/CpuDxe/CpuDxe.inf {
+
+  FILE_GUID = $(UP_CPU_DXE_GUID)
+
+
+  #
+  # Directly use MpInitLibUp. It depends on DxeMpInitLibUpDepLib which
+  # checks the Protocol of gEfiMpInitLibUpDepProtocolGuid.
+  #
+  MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
+  NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
+  }
+
   OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.fdf b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
index 9e290ea78f61..1029916c3484 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.fdf
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
@@ -185,7 +185,10 @@ INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
+
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
+INF  FILE_GUID = $(UP_CPU_DXE_GUID) UefiCpuPkg/CpuDxe/CpuDxe.inf
+
 INF  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 45ffa2dbe35f..71526bba3183 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -72,6 +72,12 @@
 !endif
 !endif
 
+  #
+  # Define the FILE_GUID of CpuMpPei/CpuDxe for unique-processor version.
+  #
+  DEFINE UP_CPU_PEI_GUID  = 280251c4-1d09-4035-9062-839acb5f18c1
+  DEFINE UP_CPU_DXE_GUID  = 6490f1c5-ebcc-4665-8892-0075b9bb49b7
+
 [BuildOptions]
   GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
   INTEL:RELEASE_*_*_CC_FLAGS   = /D MDEPKG_NDEBUG
@@ -728,7 +734,29 @@
   MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
   OvmfPkg/SmmAccess/SmmAccessPei.inf
 !endif
-  UefiCpuPkg/CpuMpPei/CpuMpPei.inf
+
+  UefiCpuPkg/CpuMpPei/CpuMpPei.inf {
+
+  #
+  # Directly use PeiMpInitLib. It depends on PeiMpInitLibMpDepLib which
+  # checks the PPI of gEfiPeiMpInitLibMpDepPpiGuid.
+  #
+  MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+  NULL|OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibMpDepLib.inf
+  }
+
+  UefiCpuPkg/CpuMpPei/CpuMpPei.inf {
+
+  FILE_GUID = $(UP_CPU_PEI_GUID)
+
+
+  #
+  # Directly use MpInitLibUp. It depends on PeiMpInitLibUpDepLib which
+  # checks the PPI of gEfiPeiMpInitLibUpDepPpiGuid.
+  #
+  MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
+  NULL|OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibUpDepLib.inf
+  }
 
 !include OvmfPkg/OvmfTpmComponentsPei.dsc.inc
 
@@ -760,7 +788,30 @@
 
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-  UefiCpuPkg/CpuDxe/CpuDxe.inf
+
+  UefiCpuPkg/CpuDxe/CpuDxe.inf {
+
+  #
+  # Directly use DxeMpInitLib. It depends on DxeMpInitLibMpDepLib which
+  # checks the Protocol of gEfiMpInitLibMpDepProtocolGuid.
+  #
+  MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+  NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
+  }
+
+

[edk2-devel] [PATCH V2 3/6] OvmfPkg: Add MpInitLibDepLib

2022-05-06 Thread Min Xu
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918

There are 4 MpInitLibDepLib:
 - PeiMpInitLibMpDepLib:
   MpInitLib multi-processor dependency
 - PeiMpInitLibUpDepLib:
   MpInitLib unique-processor dependency
 - DxeMpInitLibMpDepLib:
   MpInitLib multi-processor dependency
 - DxeMpInitLibUpDepLib
   MpInitLib unique-processor dependency

The Pei libs depend on the corresponding PPI. The Dxe libs depend on the
corresponding Protocol.

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 
---
 .../MpInitLibDepLib/DxeMpInitLibMpDepLib.inf  | 27 +++
 .../MpInitLibDepLib/DxeMpInitLibUpDepLib.inf  | 27 +++
 .../Library/MpInitLibDepLib/MpInitLibDepLib.c | 23 
 .../MpInitLibDepLib/PeiMpInitLibMpDepLib.inf  | 27 +++
 .../MpInitLibDepLib/PeiMpInitLibUpDepLib.inf  | 27 +++
 5 files changed, 131 insertions(+)
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/MpInitLibDepLib.c
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibMpDepLib.inf
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibUpDepLib.inf

diff --git a/OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf 
b/OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
new file mode 100644
index ..97a8a52d4c29
--- /dev/null
+++ b/OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
@@ -0,0 +1,27 @@
+## @file
+#
+#  Copyright (c) 2022, Intel Corporation. All rights reserved.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = DxeMpInitLibMpDepLib
+  FILE_GUID  = 57461928-290D-4FEC-A439-377420A829BE
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = NULL
+
+[LibraryClasses]
+  BaseLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[Sources]
+  MpInitLibDepLib.c
+
+[Depex]
+  gEfiMpInitLibMpDepProtocolGuid
\ No newline at end of file
diff --git a/OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf 
b/OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
new file mode 100644
index ..1241fa5de2fa
--- /dev/null
+++ b/OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
@@ -0,0 +1,27 @@
+## @file
+#
+#  Copyright (c) 2022, Intel Corporation. All rights reserved.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = DxeMpInitLibUpDepLib
+  FILE_GUID  = 95FA4B7B-930E-4755-A9B7-10F0716DA374
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = NULL
+
+[LibraryClasses]
+  BaseLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[Sources]
+  MpInitLibDepLib.c
+
+[Depex]
+  gEfiMpInitLibUpDepProtocolGuid
\ No newline at end of file
diff --git a/OvmfPkg/Library/MpInitLibDepLib/MpInitLibDepLib.c 
b/OvmfPkg/Library/MpInitLibDepLib/MpInitLibDepLib.c
new file mode 100644
index ..a7501bd9d960
--- /dev/null
+++ b/OvmfPkg/Library/MpInitLibDepLib/MpInitLibDepLib.c
@@ -0,0 +1,23 @@
+/** @file
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+
+/**
+This is null constructor which always return EFI_SUCCESS.
+@param  ImageHandle   The firmware allocated handle for the EFI image.
+@param  SystemTable   A pointer to the EFI System Table.
+@retval EFI_SUCCESS   Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibDepContructor (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return EFI_SUCCESS;
+}
diff --git a/OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibMpDepLib.inf 
b/OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibMpDepLib.inf
new file mode 100644
index ..3a3c24ecd142
--- /dev/null
+++ b/OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibMpDepLib.inf
@@ -0,0 +1,27 @@
+## @file
+#
+#  Copyright (c) 2022, Intel Corporation. All rights reserved.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = PeiMpInitLibMpDepLib
+  FILE_GUID  = D14271DE-FBEA-4AAC-9633-7143DCD7C1C8
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = NULL
+
+[LibraryClasses]
+  BaseLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[Sources]
+  MpInitLibDepLib.c
+
+[Depex]
+  gEfiPeiMpInitLibMpDepPpiGuid
\ No newline at end of file
diff --git a/OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibUp

[edk2-devel] [PATCH V2 5/6] OvmfPkg/TdxDxe: Install MpInitLibDepLib protocols

2022-05-06 Thread Min Xu
From: Min M Xu 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918

In Td guest CpuDxe driver uses the MpInitLibUp, the other guest type
use the MpInitLib. So we install different Protocols according to
the current working guest type.

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 
---
 OvmfPkg/TdxDxe/TdxDxe.c   | 22 +-
 OvmfPkg/TdxDxe/TdxDxe.inf |  2 ++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/TdxDxe/TdxDxe.c b/OvmfPkg/TdxDxe/TdxDxe.c
index f0929998233c..2318db989792 100644
--- a/OvmfPkg/TdxDxe/TdxDxe.c
+++ b/OvmfPkg/TdxDxe/TdxDxe.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -250,13 +251,32 @@ TdxDxeEntryPoint (
 
   if (!TdIsEnabled ()) {
 //
-// If it is Non-Td guest, we're done.
+// If it is Non-Td guest, we install gEfiMpInitLibMpDepProtocolGuid so that
+// MpInitLib will be used in CpuDxe driver.
 //
+gBS->InstallProtocolInterface (
+   &ImageHandle,
+   &gEfiMpInitLibMpDepProtocolGuid,
+   EFI_NATIVE_INTERFACE,
+   NULL
+   );
+
 return EFI_SUCCESS;
   }
 
   SetMmioSharedBit ();
 
+  //
+  // It is Td guest, we install gEfiMpInitLibUpDepProtocolGuid so that
+  // MpInitLibUp will be used in CpuDxe driver.
+  //
+  gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEfiMpInitLibUpDepProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+
   //
   // Call TDINFO to get actual number of cpus in domain
   //
diff --git a/OvmfPkg/TdxDxe/TdxDxe.inf b/OvmfPkg/TdxDxe/TdxDxe.inf
index 2ec2ef2ed5f2..a7e0abda1522 100644
--- a/OvmfPkg/TdxDxe/TdxDxe.inf
+++ b/OvmfPkg/TdxDxe/TdxDxe.inf
@@ -50,6 +50,8 @@
   gQemuAcpiTableNotifyProtocolGuid ## CONSUMES
   gEfiAcpiSdtProtocolGuid  ## CONSUMES
   gEfiAcpiTableProtocolGuid## CONSUMES
+  gEfiMpInitLibMpDepProtocolGuid
+  gEfiMpInitLibUpDepProtocolGuid
 
 [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89567): https://edk2.groups.io/g/devel/message/89567
Mute This Topic: https://groups.io/mt/90946719/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 4/6] OvmfPkg/Sec: Install MpInitLibDepLib PPIs in SecMain.c

2022-05-06 Thread Min Xu
From: Min M Xu 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918

Td guest should use MpInitLibUp, other guest use the MpInitLib. So
in SecMain.c different PPI is installed according to the working
guest type.

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 
---
 OvmfPkg/Sec/SecMain.c   | 34 --
 OvmfPkg/Sec/SecMain.inf |  2 ++
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index 89371361cd05..1167d22a68cc 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "AmdSev.h"
@@ -61,12 +62,30 @@ EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI  mTemporaryRamSupportPpi 
= {
   TemporaryRamMigration
 };
 
-EFI_PEI_PPI_DESCRIPTOR  mPrivateDispatchTable[] = {
+EFI_PEI_PPI_DESCRIPTOR  mPrivateDispatchTableMp[] = {
+  {
+(EFI_PEI_PPI_DESCRIPTOR_PPI),
+&gEfiTemporaryRamSupportPpiGuid,
+&mTemporaryRamSupportPpi
+  },
   {
 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+&gEfiPeiMpInitLibMpDepPpiGuid,
+NULL
+  },
+};
+
+EFI_PEI_PPI_DESCRIPTOR  mPrivateDispatchTableUp[] = {
+  {
+(EFI_PEI_PPI_DESCRIPTOR_PPI),
 &gEfiTemporaryRamSupportPpiGuid,
 &mTemporaryRamSupportPpi
   },
+  {
+(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+&gEfiPeiMpInitLibUpDepPpiGuid,
+NULL
+  },
 };
 
 //
@@ -936,6 +955,7 @@ SecStartupPhase2 (
   EFI_SEC_PEI_HAND_OFF*SecCoreData;
   EFI_FIRMWARE_VOLUME_HEADER  *BootFv;
   EFI_PEI_CORE_ENTRY_POINTPeiCoreEntryPoint;
+  EFI_PEI_PPI_DESCRIPTOR  *EfiPeiPpiDescriptor;
 
   SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Context;
 
@@ -948,10 +968,20 @@ SecStartupPhase2 (
   SecCoreData->BootFirmwareVolumeBase = BootFv;
   SecCoreData->BootFirmwareVolumeSize = (UINTN)BootFv->FvLength;
 
+  //
+  // Td guest is required to use the MpInitLibUp (unique-processor version).
+  // Other guests use the MpInitLib (multi-processor version).
+  //
+  if (CcProbe () == CcGuestTypeIntelTdx) {
+EfiPeiPpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)&mPrivateDispatchTableUp;
+  } else {
+EfiPeiPpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)&mPrivateDispatchTableMp;
+  }
+
   //
   // Transfer the control to the PEI core
   //
-  (*PeiCoreEntryPoint)(SecCoreData, (EFI_PEI_PPI_DESCRIPTOR 
*)&mPrivateDispatchTable);
+  (*PeiCoreEntryPoint)(SecCoreData, EfiPeiPpiDescriptor);
 
   //
   // If we get here then the PEI Core returned, which is not recoverable.
diff --git a/OvmfPkg/Sec/SecMain.inf b/OvmfPkg/Sec/SecMain.inf
index 1557b5f4a84e..561a840f29c5 100644
--- a/OvmfPkg/Sec/SecMain.inf
+++ b/OvmfPkg/Sec/SecMain.inf
@@ -59,6 +59,8 @@
 
 [Ppis]
   gEfiTemporaryRamSupportPpiGuid# PPI ALWAYS_PRODUCED
+  gEfiPeiMpInitLibMpDepPpiGuid
+  gEfiPeiMpInitLibUpDepPpiGuid
 
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89566): https://edk2.groups.io/g/devel/message/89566
Mute This Topic: https://groups.io/mt/90946718/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 1/6] UefiCpuPkg: Revert "UefiCpuPkg: Enable Tdx support in MpInitLib"

2022-05-06 Thread Min Xu
From: Min M Xu 

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 
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 
---
 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/Library/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
 
 [Sources.X64]
   X64/AmdSev.c
   X64/MpFuncs.nasm
-  MpLibTdx.c
 
 [Sources.common]
   AmdSev.c
@@ -38,7 +36,6 @@
   MpLib.c
   MpLib.h
   Microcode.c
-  MpIntelTdx.h
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h 
b/UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h
deleted file mode 100644
index 8a26f6c19fc4..
--- 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 information 
for
-the requested processor is deposited.
-  @param[out]  HealthDataReturn processor health data.
-
-  @retval EFI_SUCCESS Processor information was returned.
-  @retval EFI_DEVICE_ERRORThe 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 
platform.
-  @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 
logical
-  processors in the system, including 
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 enabled
-  logical processors was retrieved.
-  @retval EFI_DEVICE_ERRORThe calling processor is an AP.
-  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and 
NumberOfEnabledProcessors
-  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/MpInitLib/MpLib.c
index 91c7afaeb2ad..4a73787ee43a 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -9,11 +9,9 @@
 **/
 
 #include "MpLib.h"
-#include "MpIntelTdx.h"
 #include 
 #include 
 #include 
-#include 
 
 EFI_GUID  mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;
 
@@ -1805,10 +1803,6 @@ MpInitLibInitialize (
   UINTNBackupBufferAddr;
   UINTNApIdtBase;
 
-  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidential

[edk2-devel] [PATCH V2 2/6] OvmfPkg: Add MpInitLibDepLib related PPI/Protocol definitions

2022-05-06 Thread Min Xu
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918

MpInitLibDepLib is a set of libraries which depend on PPI/Protocol.
This patch defines the related PPI/Protocols in OvmfPkg.

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 
---
 OvmfPkg/Include/Ppi/MpInitLibDep.h| 28 +++
 .../Include/Protocol/MpInitLibDepProtocols.h  | 28 +++
 OvmfPkg/OvmfPkg.dec   |  5 
 3 files changed, 61 insertions(+)
 create mode 100644 OvmfPkg/Include/Ppi/MpInitLibDep.h
 create mode 100644 OvmfPkg/Include/Protocol/MpInitLibDepProtocols.h

diff --git a/OvmfPkg/Include/Ppi/MpInitLibDep.h 
b/OvmfPkg/Include/Ppi/MpInitLibDep.h
new file mode 100644
index ..232ff52e19fe
--- /dev/null
+++ b/OvmfPkg/Include/Ppi/MpInitLibDep.h
@@ -0,0 +1,28 @@
+/** @file
+  MpInitLibDepLib PPI definitions
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MPINITLIB_DEP_H_
+#define MPINITLIB_DEP_H_
+
+// {138F9CF4-F0E7-4721-8F49-F5FFECF42D40}
+#define EFI_PEI_MPINITLIB_MP_DEP_PPI_GUID \
+{ \
+  0x138f9cf4, 0xf0e7, 0x4721, { 0x8f, 0x49, 0xf5, 0xff, 0xec, 0xf4, 0x2d, 0x40 
} \
+};
+
+extern EFI_GUID  gEfiPeiMpInitLibMpDepPpiGuid;
+
+// {0B590774-BC67-49F4-A7DB-E82E89E6B5D6}
+#define EFI_PEI_MPINITLIB_UP_DEP_PPI_GUID \
+{ \
+  0xb590774, 0xbc67, 0x49f4, { 0xa7, 0xdb, 0xe8, 0x2e, 0x89, 0xe6, 0xb5, 0xd6 
} \
+};
+
+extern EFI_GUID  gEfiPeiMpInitLibUpDepPpiGuid;
+
+#endif
diff --git a/OvmfPkg/Include/Protocol/MpInitLibDepProtocols.h 
b/OvmfPkg/Include/Protocol/MpInitLibDepProtocols.h
new file mode 100644
index ..449c8fedb3c6
--- /dev/null
+++ b/OvmfPkg/Include/Protocol/MpInitLibDepProtocols.h
@@ -0,0 +1,28 @@
+/** @file
+  MpInitLibDep Protocol Guid definitions
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MPINITLIB_DEP_PROTOCOLS_H_
+#define MPINITLIB_DEP_PROTOCOLS_H_
+
+// {BB00A5CA-08CE-462F-A537-43C74A825CA4}
+#define EFI_MPINITLIB_MP_DEP_PROTOCOL_GUID \
+{ \
+  0xbb00a5ca, 0x8ce, 0x462f, { 0xa5, 0x37, 0x43, 0xc7, 0x4a, 0x82, 0x5c, 0xa4 
} \
+};
+
+extern EFI_GUID  gEfiMpInitLibMpDepProtocolGuid;
+
+// {A9E7CEF1-5682-42CC-B123-9930973F4A9F}
+#define EFI_PEI_MPINITLIB_UP_DEP_PPI_GUID \
+{ \
+  0xa9e7cef1, 0x5682, 0x42cc, { 0xb1, 0x23, 0x99, 0x30, 0x97, 0x3f, 0x4a, 0x9f 
} \
+};
+
+extern EFI_GUID  gEfiMpInitLibUpDepProtocolGuid;
+
+#endif
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index b9ca44120289..8c2048051bea 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -152,6 +152,9 @@
   # the PEI phase, regardless of memory encryption
   gOvmfTpmMmioAccessiblePpiGuid = {0x35c84ff2, 0x7bfe, 0x453d, {0x84, 
0x5f, 0x68, 0x3a, 0x49, 0x2c, 0xf7, 0xb7}}
 
+  gEfiPeiMpInitLibMpDepPpiGuid  = {0x138f9cf4, 0xf0e7, 0x4721, { 0x8f, 
0x49, 0xf5, 0xff, 0xec, 0xf4, 0x2d, 0x40}}
+  gEfiPeiMpInitLibUpDepPpiGuid  = {0xb590774, 0xbc67, 0x49f4, { 0xa7, 
0xdb, 0xe8, 0x2e, 0x89, 0xe6, 0xb5, 0xd6}}
+
 [Protocols]
   gVirtioDeviceProtocolGuid = {0xfa920010, 0x6785, 0x4941, {0xb6, 
0xec, 0x49, 0x8c, 0x57, 0x9f, 0x16, 0x0a}}
   gXenBusProtocolGuid   = {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 
0x5d, 0xb8, 0xac, 0x6f, 0x7d, 0x65, 0xe6}}
@@ -167,6 +170,8 @@
   gEfiVgaMiniPortProtocolGuid   = {0xc7735a2f, 0x88f5, 0x4882, {0xae, 
0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 0xb3}}
   gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 
0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}}
   gQemuAcpiTableNotifyProtocolGuid  = {0x928939b2, 0x4235, 0x462f, {0x95, 
0x80, 0xf6, 0xa2, 0xb2, 0xc2, 0x1a, 0x4f}}
+  gEfiMpInitLibMpDepProtocolGuid= {0xbb00a5ca, 0x8ce,  0x462f, {0xa5, 
0x37, 0x43, 0xc7, 0x4a, 0x82, 0x5c, 0xa4}}
+  gEfiMpInitLibUpDepProtocolGuid= {0xa9e7cef1, 0x5682, 0x42cc, {0xb1, 
0x23, 0x99, 0x30, 0x97, 0x3f, 0x4a, 0x9f}}
 
 [PcdsFixedAtBuild]
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|0x0|UINT32|0
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89564): https://edk2.groups.io/g/devel/message/89564
Mute This Topic: https://groups.io/mt/90946716/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 0/6] Support 2 CpuMpPei/CpuDxe in One image

2022-05-06 Thread Min Xu
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918

Above BZ reports an issue that commit 88da06ca triggers ASSERT in some
scenario. This patch-set is to fix this issue.

As commit 88da06ca describes TDVF BSP and APs are simplied and it can
simply use MpInitLibUp instead of MpInitLib. To achieve this goal, we
include 2 CpuMpPei/CpuDxe drivers in OvmfPkgX64 and IntelTdxX64. This
is done by setting different FILE_GUID to these drivers (of the same
name). In the other hand, we import a set of MpInitLibDepLib. These
libs simply depend on the PPI/Protocols. While these PPI/Protocols are
installed according to the guest type.

This patch-set is a replacement of
https://edk2.groups.io/g/devel/message/89381. Please see the dicussion in
 - https://edk2.groups.io/g/devel/message/89382
 - https://edk2.groups.io/g/devel/message/89455
 - https://edk2.groups.io/g/devel/message/89522
 - https://edk2.groups.io/g/devel/message/89535

The code is at: https://github.com/mxu9/edk2/tree/Rework-MpInitLib.v2

v2 changes:
 - Remove the un-used FILE_GUID definitions.
 - Delete un-used EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST in DispatchTable.
 - Add more comments.

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 

Min M Xu (4):
  UefiCpuPkg: Revert "UefiCpuPkg: Enable Tdx support in MpInitLib"
  OvmfPkg/Sec: Install MpInitLibDepLib PPIs in SecMain.c
  OvmfPkg/TdxDxe: Install MpInitLibDepLib protocols
  OvmfPkg: Enable 2 different CpuMpPei and CpuDxe drivers

Min Xu (2):
  OvmfPkg: Add MpInitLibDepLib related PPI/Protocol definitions
  OvmfPkg: Add MpInitLibDepLib

 OvmfPkg/Include/Ppi/MpInitLibDep.h|  28 +
 .../Include/Protocol/MpInitLibDepProtocols.h  |  28 +
 OvmfPkg/IntelTdx/IntelTdxX64.dsc  |  30 -
 OvmfPkg/IntelTdx/IntelTdxX64.fdf  |   3 +
 .../MpInitLibDepLib/DxeMpInitLibMpDepLib.inf  |  27 +
 .../MpInitLibDepLib/DxeMpInitLibUpDepLib.inf  |  27 +
 .../Library/MpInitLibDepLib/MpInitLibDepLib.c |  23 
 .../MpInitLibDepLib/PeiMpInitLibMpDepLib.inf  |  27 +
 .../MpInitLibDepLib/PeiMpInitLibUpDepLib.inf  |  27 +
 OvmfPkg/OvmfPkg.dec   |   5 +
 OvmfPkg/OvmfPkgX64.dsc|  55 -
 OvmfPkg/OvmfPkgX64.fdf|   4 +
 OvmfPkg/Sec/SecMain.c |  34 +-
 OvmfPkg/Sec/SecMain.inf   |   2 +
 OvmfPkg/TdxDxe/TdxDxe.c   |  22 +++-
 OvmfPkg/TdxDxe/TdxDxe.inf |   2 +
 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 -
 22 files changed, 343 insertions(+), 314 deletions(-)
 create mode 100644 OvmfPkg/Include/Ppi/MpInitLibDep.h
 create mode 100644 OvmfPkg/Include/Protocol/MpInitLibDepProtocols.h
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/MpInitLibDepLib.c
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibMpDepLib.inf
 create mode 100644 OvmfPkg/Library/MpInitLibDepLib/PeiMpInitLibUpDepLib.inf
 delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpIntelTdx.h
 delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpLibTdx.c
 delete mode 100644 UefiCpuPkg/Library/MpInitLib/MpLibTdxNull.c

-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89562): https://edk2.groups.io/g/devel/message/89562
Mute This Topic: https://groups.io/mt/90946714/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 6/6] OvmfPkg: Enable 2 different CpuMpPei and CpuDxe drivers

2022-05-06 Thread Min Xu
On May 6, 2022 1:07 PM, Ni Ray wrote:
> >
> > +DEFINE MP_CPU_DXE_GUID  = 2d73044a-1df3-415d-b054-17fe05765c3c
> Can you remove the above GUID definition?
> 
> > +DEFINE MP_CPU_PEI_GUID  = 3dd59561-e4ea-4846-b7c5-c7b74a061190
> Can you remove the above GUID definition?
> 
> > +DEFINE UP_CPU_PEI_GUID  = 280251c4-1d09-4035-9062-839acb5f18c1
> > +
> > +DEFINE MP_CPU_DXE_GUID  = 2d73044a-1df3-415d-b054-17fe05765c3c
> Can you remove the above GUID definition?
> 
> > +DEFINE UP_CPU_DXE_GUID  = 6490f1c5-ebcc-4665-8892-0075b9bb49b7
> > +
> >  [BuildOptions]
> >GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
> >INTEL:RELEASE_*_*_CC_FLAGS   = /D MDEPKG_NDEBUG
> > @@ -728,7 +734,24 @@
> >MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> >OvmfPkg/SmmAccess/SmmAccessPei.inf
> >  !endif
> > -  UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> > +
> > +  UefiCpuPkg/CpuMpPei/CpuMpPei.inf {
> > +
> > +  FILE_GUID = $(MP_CPU_PEI_GUID)
> 
> The above  is not needed.
> 
> > +
> > +INF  FILE_GUID = $(MP_CPU_DXE_GUID) UefiCpuPkg/CpuDxe/CpuDxe.inf
> 
> The above FILE_GUID override is not needed.
> 
> > +INF  FILE_GUID = $(UP_CPU_DXE_GUID) UefiCpuPkg/CpuDxe/CpuDxe.inf
> > +
Thanks for reminder. All above will be fixed in the next version.

Min


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89561): https://edk2.groups.io/g/devel/message/89561
Mute This Topic: https://groups.io/mt/90912398/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 4/6] OvmfPkg/Sec: Install MpInitLibDepLib PPIs in SecMain.c

2022-05-06 Thread Min Xu
On May 6, 2022 1:04 PM, Ni Ray wrote:
> >
> > -EFI_PEI_PPI_DESCRIPTOR  mPrivateDispatchTable[] = {
> > +EFI_PEI_PPI_DESCRIPTOR  mPrivateDispatchTableMp[] = {
> >{
> >  (EFI_PEI_PPI_DESCRIPTOR_PPI |
> > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> 
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST should be removed for the first
> element in the PPI descriptor array.
Thanks for reminder. It will be deleted in the next version.

Thanks
Min


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89560): https://edk2.groups.io/g/devel/message/89560
Mute This Topic: https://groups.io/mt/90912395/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel][edk2-platforms][PATCH V2 0/1] Add PlatformPayloadPkg

2022-05-06 Thread Guo Dong
From: Guo Dong 

changes from patch V1:
a) Change package name from PayloadPlatformPkg to PlatformPayloadPkg
b) Put PlatformPayloadPkg to Features/Intel instead of Platform/Intel
c) Reuse DSC/FDF files from MinPlatforms
d) Following Features orgnaizaion updated AdvancedFeaturePkg DSC/FDF
e) Updated PlatformPayloadPkg.py and Readme file

https://github.com/tianocore/edk2-platforms/pull/41

Guo Dong (1):
  Features/Intel/PlatformPayloadPkg: add platform payload FV

 Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc|  
  5 +
 Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc  |  
  7 ++
 Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc   |  
  7 ++
 Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf|  
  7 ++
 Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf |  
  7 ++
 Features/Intel/PlatformPayloadPkg/Fvb/FvbInfo.c |  
 77 +
 Features/Intel/PlatformPayloadPkg/Fvb/FvbService.c  | 
1088 
+++
 Features/Intel/PlatformPayloadPkg/Fvb/FvbService.h  |  
185 

 Features/Intel/PlatformPayloadPkg/Fvb/FvbServiceSmm.c   |  
139 
+
 Features/Intel/PlatformPayloadPkg/Fvb/FvbSmm.inf|  
 66 
 Features/Intel/PlatformPayloadPkg/Fvb/FvbSmmCommon.h|  
 68 ++
 Features/Intel/PlatformPayloadPkg/Include/Guid/NvVariableInfoGuid.h |  
 24 +
 Features/Intel/PlatformPayloadPkg/Include/Guid/SpiFlashInfoGuid.h   |  
 38 
 Features/Intel/PlatformPayloadPkg/Include/Library/FlashDeviceLib.h  |  
104 

 Features/Intel/PlatformPayloadPkg/Include/Library/SpiFlashLib.h |  
213 
+++
 Features/Intel/PlatformPayloadPkg/Include/PlatformPayloadFeature.dsc|  
112 
+++
 Features/Intel/PlatformPayloadPkg/Include/PostMemory.fdf|  
 20 +
 Features/Intel/PlatformPayloadPkg/Include/PreMemory.fdf |  
  8 +++
 Features/Intel/PlatformPayloadPkg/Library/FlashDeviceLib/FlashDeviceLib.c   |  
160 
+++
 Features/Intel/PlatformPayloadPkg/Library/FlashDeviceLib/FlashDeviceLib.inf |  
 38 
 Features/Intel/PlatformPayloadPkg/Library/PcdInitLib/PcdInitLib.c   |  
 89 +++
 Features/Intel/PlatformPayloadPkg/Library/PcdInitLib/PcdInitLib.inf |  
 50 +++
 Features/Intel/PlatformPayloadPkg/Library/SpiFlashLib/PchSpi.c  |  
170 
+++
 Features/Intel/PlatformPayloadPkg/Library/SpiFlashLib/RegsSpi.h |  
120 
+
 Features/Intel/PlatformPayloadPkg/Library/SpiFlashLib/SpiCommon.h   |  
203 

[edk2-devel] [PATCH] MdeModulePkg/PCD: Pcd initialize DXE have assert

2022-05-06 Thread guo . guo
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3917

When PlatformPkg.dsc has multiple SKU IDs but didn't exist delta PCD,
System will hang on BuildPcdDxeDataBase.

Ideally, if didn't exist delta PCD by different SKU ID,
UpdatePcdDatabase () shouldn't return EFI_NOT_FOUND.

Signed-off-by: Gua Guo 
---
 MdeModulePkg/Universal/PCD/Dxe/Service.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c 
b/MdeModulePkg/Universal/PCD/Dxe/Service.c
index 3965846b93..5ade8d988b 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
@@ -817,6 +817,11 @@ UpdatePcdDatabase (
   //
   Index= (mPcdDatabase.DxeDb->Length + 7) & (~7);
   SkuDelta = NULL;
+
+  if (Index == mDxePcdDbSize) {
+return EFI_SUCCESS;
+  }
+
   while (Index < mDxePcdDbSize) {
 SkuDelta = (PCD_DATABASE_SKU_DELTA *)((UINT8 *)mDxePcdDbBinary + Index);
 if ((SkuDelta->SkuId == SkuId) && (SkuDelta->SkuIdCompared == 0)) {
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89557): https://edk2.groups.io/g/devel/message/89557
Mute This Topic: https://groups.io/mt/90934230/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] TianoCore Community Meeting 20220505 APAC/NAMO

2022-05-06 Thread Demeter, Miki
**Highlights:**
- Coverity update from Felix
- GSOC – 7 Prospects going through ranking and rating  Should know near the end 
of May.


# Meeting Minutes:

1) **Event Updates (_5 minutes]**
- **No Event Updates **

2) [**Stable Tag Updates (_5 minutes_)**
- Soft Freeze - 2022-05-9
- Hard freeze - 2022-05-16
- 2022- Release – 2022-05-30
 -** Stable Tag 20220225 released **

3) **Stewards Download (_20 minutes_)**
- No stewards update Monthly meeting was cancelled this month

-**Coverity Status**
- Coverity update – Felix is working on Coverity
-- issues trying to find some middle ground for who fixes issues – Maintainers 
may have to step up
-- Open Coverity only allows one week scan per week – Can’t make developers 
wait for a week to scan patches


-** Bugzilla Status **
- Still Need developers to update issues Bug Scrubs working through issues


4) **Opens (_30 minutes_)**
-  No Opens

** AR:  ** Miki to send rajnish chauhan [7:48 PM] rajnish chauhan (Guest)
rajnis...@gmail.com


Next meeting will be back on the on the first Thursday of the month.


--
Miki Demeter (she/her/Miki)
Security Researcher / FW Developer
FST
Intel Corporation

Co-Chair, Network of Intel African-Ancestry(NIA) - Oregon
NIA-Oregon

Portland Women in Tech Best Speaker
miki.deme...@intel.com
503.712.8030 (office)
971.248.0123 (cell)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89556): https://edk2.groups.io/g/devel/message/89556
Mute This Topic: https://groups.io/mt/90934214/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] UefiPayloadPkg: Fix the build failure

2022-05-06 Thread duntan
Add double quotes to LlvmObjcopyPath.
Blank space in LlvmObjcopyPath will cause build failure.
This build failure is introduced by 2306555bf908 (
"UefiPayloadPkg: Fix IA32 entry build failure").

Signed-off-by: Dun Tan 
Cc: Ray Ni 
Cc: Guo Dong 
Cc: Benjamin You 
Cc: Sean Rhodes 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 8af381336d..50335d4316 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -111,9 +111,9 @@ def BuildUniversalPayload(Args, MacroList):
 #
 # Copy the DXEFV as a section in elf format Universal Payload entry.
 #
-remove_section = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}"
-add_section= f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--add-section .upld_info={UpldInfoFile} --add-section 
.upld.uefi_fv={FvOutputDir} {EntryOutputDir}"
-set_section= f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--set-section-alignment .upld.upld_info=16 --set-section-alignment 
.upld.uefi_fv=16 {EntryOutputDir}"
+remove_section = f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}'
+add_section= f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--add-section .upld_info={UpldInfoFile} --add-section 
.upld.uefi_fv={FvOutputDir} {EntryOutputDir}'
+set_section= f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--set-section-alignment .upld.upld_info=16 --set-section-alignment 
.upld.uefi_fv=16 {EntryOutputDir}'
 RunCommand(remove_section)
 RunCommand(add_section)
 RunCommand(set_section)
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89555): https://edk2.groups.io/g/devel/message/89555
Mute This Topic: https://groups.io/mt/90931912/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V2 1/1] OvmfPkg: Add README for TDVF

2022-05-06 Thread Yao, Jiewen
Merged https://github.com/tianocore/edk2/pull/2858

> -Original Message-
> From: Xu, Min M 
> Sent: Wednesday, May 4, 2022 8:14 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M ; Brijesh Singh ;
> Aktas, Erdem ; Gerd Hoffmann
> ; James Bottomley ; Yao, Jiewen
> ; Tom Lendacky 
> Subject: [PATCH V2 1/1] OvmfPkg: Add README for TDVF
> 
> RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3249
> 
> Add README for TDVF.
> 
> Cc: Brijesh Singh 
> Cc: Erdem Aktas 
> Cc: Gerd Hoffmann 
> Cc: James Bottomley 
> Cc: Jiewen Yao 
> Cc: Tom Lendacky 
> Signed-off-by: Min Xu 
> ---
>  OvmfPkg/IntelTdx/README | 88
> +
>  1 file changed, 88 insertions(+)
>  create mode 100644 OvmfPkg/IntelTdx/README
> 
> diff --git a/OvmfPkg/IntelTdx/README b/OvmfPkg/IntelTdx/README
> new file mode 100644
> index ..20426a4f0bf8
> --- /dev/null
> +++ b/OvmfPkg/IntelTdx/README
> @@ -0,0 +1,88 @@
> +TDVF Overview
> +-
> +
> +Intel Trust Domain Extension (TDX) is Intel Architecture extension
> +to provide trusted, isolated VM execution by removing CSP software
> +(hypervisor etc) from the TCB. TDX Virtual Firmware (TDVF) is an
> +EDK II based project to enable UEFI support for TDX based Virtual
> +Machines. It provides the capability to launch a TD.
> +
> +The Intel® TDX Virtual Firmware Design Guide is at
> +https://www.intel.com/content/dam/develop/external/us/en/documents/tdx-
> virtual-firmware-design-guide-rev-1.01.pdf.
> +
> +More information can be found at:
> +https://www.intel.com/content/www/us/en/developer/articles/technical/intel
> -trust-domain-extensions.html
> +
> +
> +Configurations and Features
> +
> +
> +There are 2 configurations for TDVF.
> +
> +Config-A:
> + - Merge the *basic* TDVF feature to existing OvmfX64Pkg.dsc. (Align
> +   with existing SEV)
> + - Threat model: VMM is NOT out of TCB. (We don’t make things worse)
> + - The OvmfX64Pkg.dsc includes SEV/TDX/normal OVMF basic boot capability.
> +   The final binary can run on SEV/TDX/normal OVMF.
> + - No changes to existing OvmfPkgX64 image layout.
> + - No need to add additional security features if they do not exist today.
> + - No need to remove features if they exist today.
> + - RTMR is not supported.
> + - PEI phase is NOT skipped in either Td or Non-Td.
> +
> +Config-B:
> + - (*) Add a standalone IntelTdx.dsc to a TDX specific directory for a *full*
> +   feature TDVF.(Align with existing SEV)
> + - (*) Threat model: VMM is out of TCB. (We need necessary change to prevent
> +   attack from VMM)
> + - (*) IntelTdx.dsc includes TDX/normal OVMF basic boot capability. The final
> +   binary can run on TDX/normal OVMF.
> + - It might eventually merge with AmdSev.dsc, but NOT at this point of
> +   time. And we don’t know when it will happen. We need sync with AMD in
> +   the community after both of us think the solutions are mature to merge.
> + - Need to add necessary security feature as mandatory requirement, such
> +   as RTMR based Trusted Boot support.
> + - Need to measure the external input from Host VMM, such as TdHob, CFV.
> + - Need to measure other external input, such as FW_CFG data, os loader,
> +   initrd, etc.
> + - Need to remove unnecessary attack surfaces, such as network stack.
> +
> +In current stage, Config-A has been merged into edk2-master branch.
> +The corresponding pkg file is OvmfPkg/OvmfPkgX64.dsc.
> +
> +Config-B is split into several waves. The corresponding pkg file is
> +OvmfPkg/IntelTdx/IntelTdxX64.dsc. The features with (*) have been
> implemented
> +and merged into edk2-master branch. Others are in upstreaming progress.
> +
> +Build
> +--
> +- Build the TDVF (Config-A) target:
> +`cd /path/to/edk2`
> +`source edksetup.sh`
> +`build.sh -p OvmfPkg/OvmfPkgX64.dsc -a X64 -t GCC5`
> +
> +- Build the TDVF (Config-B) target:
> +`cd /path/to/edk2`
> +`set PACKAGES_PATH=/path/to/edk2/OvmfPkg`
> +`source edksetup.sh`
> +`build.sh -p OvmfPkg/IntelTdx/IntelTdxX64.dsc -a X64 -t GCC5`
> +
> +Usage
> +-
> +
> +Assuming TDX-QEMU/TDX-KVM are already built, one can start a TD virtual
> +machine as [launching-td-guest](https://github.com/intel/qemu-tdx/blob/tdx-
> qemu-upstream-rfc-v3/docs/system/i386/tdx.rst#launching-a-td-tdx-vm):
> +
> +`qemu_system_x86 \`
> +`   -machine ...,confidential-guest-support=tdx0 \`
> +`   -object tdx-guest,id=tdx0,[sept-ve-disable=off] \`
> +`   -drive if=pflash,format=raw,unit=0,file=/path/to/OVMF_CODE.fd \`
> +`   -drive if=pflash,format=raw,unit=1,file=/path/to/OVMF_VARS.fd \`
> +
> +Note:
> +TDX-QEMU/TDX-KVM are still in upstreaming progress. Please refer to:
> + - kvm  : https://github.com/intel/tdx/tree/kvm-upstream
> + - qemu : https://github.com/intel/qemu-tdx/blob/tdx-qemu-upstream-rfc-v3
> +
> +Once above 2 upstreaming are completed a minimum qemu/kvm version will
> be updated here.
> --
> 2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Repl

Re: [edk2-devel] [PATCH v2] MdeModulePkg/XhciDxe: Add access xHCI Extended Capabilities Pointer

2022-05-06 Thread Wu, Hao A
Please refer to the inline comments below:


> -Original Message-
> From: Chiu, Ian 
> Sent: Monday, April 25, 2022 9:45 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Ian ; Huang, Jenny ;
> Shih, More ; Wu, Hao A ; Ni, Ray
> 
> Subject: [PATCH v2] MdeModulePkg/XhciDxe: Add access xHCI Extended
> Capabilities Pointer
> 
> From: Ian Chiu 
> 
> Add support process Port Speed field value of PORTSC according to Supported
> Protocol Capability
> (new design in xHCI spec 1.2 2019)


Please help to remove the above line. My take is that 'Supported Protocol 
Capability' contents already exist in the XHCI Spec 1.1 version.


> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3914
> 
> The value of Port Speed field in PORTSC bit[10:13] (xHCI spec 1.2 2019 section
> 5.4.8)
> should be change to use this value to query thru Protocol Speed ID (PSI)
> (xHCI spec 1.2 2019 section 7.2.1) in xHCI Supported Protocol Capability and
> return the value according the Protocol Speed ID (PSIV) Dword.


Could you help to add a brief summary on the PSI check when mapping to 
different port speeds (how the checks are mapping to low speed, high speed and 
super speed) in the log message?


> 
> Cc: Jenny Huang 
> Cc: More Shih 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Ian Chiu 
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c|  41 --
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h|   2 +
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 147 
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  87 
>  4 files changed, 262 insertions(+), 15 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index b79499e225..f5b99210c9 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -398,25 +398,32 @@ XhcGetRootHubPortStatus (
>State = XhcReadOpReg (Xhc, Offset);
> 
> 
> 
>//
> 
> -  // According to XHCI 1.1 spec November 2017,
> 
> -  // bit 10~13 of the root port status register identifies the speed of the
> attached device.
> 
> +  // According to XHCI 1.2 spec November 2019,


I think you can still use the reference information from the XHCI 1.1 spec.
The Support Protocol Capability related content already exists in this version 
of spec.


> 
> +  // Section 7.2 xHCI Support Protocol Capability
> 
>//
> 
> -  switch ((State & XHC_PORTSC_PS) >> 10) {
> 
> -case 2:
> 
> -  PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
> 
> -  break;
> 
> +  PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State &
> XHC_PORTSC_PS) >> 10));
> 
> +  if (PortStatus->PortStatus == 0) {
> 
> +//
> 
> +// According to XHCI 1.1 spec November 2017,
> 
> +// bit 10~13 of the root port status register identifies the speed of the
> attached device.
> 
> +//
> 
> +switch ((State & XHC_PORTSC_PS) >> 10) {
> 
> +  case 2:
> 
> +PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
> 
> +break;
> 
> 
> 
> -case 3:
> 
> -  PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
> 
> -  break;
> 
> +  case 3:
> 
> +PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
> 
> +break;
> 
> 
> 
> -case 4:
> 
> -case 5:
> 
> -  PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
> 
> -  break;
> 
> +  case 4:
> 
> +  case 5:
> 
> +PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
> 
> +break;
> 
> 
> 
> -default:
> 
> -  break;
> 
> +  default:
> 
> +break;
> 
> +}
> 
>}
> 
> 
> 
>//
> 
> @@ -1820,6 +1827,8 @@ XhcCreateUsbHc (
>Xhc->ExtCapRegBase = ExtCapReg << 2;
> 
>Xhc->UsbLegSupOffset   = XhcGetCapabilityAddr (Xhc, XHC_CAP_USB_LEGACY);
> 
>Xhc->DebugCapSupOffset = XhcGetCapabilityAddr (Xhc,
> XHC_CAP_USB_DEBUG);
> 
> +  Xhc->Usb2SupOffset = XhcGetUsbSupportedCapabilityAddr (Xhc,
> USB_SUPPORT_PROTOCOL_USB2_MAJOR_VER);
> 
> +  Xhc->UsbSsSupOffset = XhcGetUsbSupportedCapabilityAddr (Xhc,
> USB_SUPPORT_PROTOCOL_USB3_MAJOR_VER);
> 
> 
> 
>DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: Capability length 0x%x\n", Xhc-
> >CapLength));
> 
>DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: HcSParams1 0x%x\n", Xhc-
> >HcSParams1));
> 
> @@ -1829,6 +1838,8 @@ XhcCreateUsbHc (
>DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: RTSOff 0x%x\n", Xhc->RTSOff));
> 
>DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: UsbLegSupOffset 0x%x\n", Xhc-
> >UsbLegSupOffset));
> 
>DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: DebugCapSupOffset 0x%x\n", Xhc-
> >DebugCapSupOffset));
> 
> +  DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: Usb2SupOffset 0x%x\n", Xhc-
> >Usb2SupOffset));
> 
> +  DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: UsbSsSupOffset 0x%x\n", Xhc-
> >UsbSsSupOffset));
> 
> 
> 
>//
> 
>// Create AsyncRequest Polling Timer
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> index 5054d796b1..7eed7bd15e 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> +++ b/MdeMo

Re: [edk2-devel] [PATCH v3 05/10] MdePkg/CompilerIntrinsicsLib: copy over intrinsics from edk2-libc repo

2022-05-06 Thread Gerd Hoffmann
On Thu, May 05, 2022 at 01:10:12PM +0100, Leif Lindholm wrote:
> On Thu, May 05, 2022 at 12:23:18 +0200, Gerd Hoffmann wrote:
> > On Thu, May 05, 2022 at 10:50:27AM +0100, Leif Lindholm wrote:
> > > ...I think these files should also be given the SPDX treatment, and
> > > while doing that have the explicit patent grant added by changing them
> > > from BSD2 to BSD+Patent.
> > 
> > See patch #6 ;)
> 
> Right. But bringing it in under a license that does not include the
> explicit patent grant creates uncertainty about how terrified large
> slow-moving companies need to be to fine comb every individual commit
> at every import/export stage.

Ok, I can quash those two commits if it makes things easier.

> 
> > (comments on the process are welcome too, not sure I can just change the
> > licence without intel explicitly acking this ...).
> 
> Swapping an explicit license to an SPDX tag describing the same
> license should not be controversial. And neither should *adding* a
> patent grant to that license. (The Intel copyright statements should
> obviously be retained.)
> 
> If you feel we need to get an explicit nod from someone at Intel
> ... that would be easier when Kinney wasn't on sabbatical :)

Well, I'm not a lawyer, so I prefer to play safe ...

If there is agreement that adding the patent grant isn't a problem
that is fine with me too.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89552): https://edk2.groups.io/g/devel/message/89552
Mute This Topic: https://groups.io/mt/90772975/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] MdePkg: Add WPA3 related TLS configure macro

2022-05-06 Thread yi1 li
Hi Jiewen,



1) {0x13, *} is defined in TLS1.3



Due to TlsLib in edk2 is not fully support TLS1.3, I think I need to remove 1.3 
cipher suite to avoid confusion.



2) 3) Although it is not absolutely required, I highly recommend to add 
specific value to TLS_HASH_ALGO, to align with definition in RFC.



I think we can add the version value to the enum name to identify it is TLS1.2 
specific.

> +  Tls12HashAlgoSha512 = 6,

> +} TLS1_2_HASH_ALGO;



4) RFC4492 is obsoleted by RFC8422 - 
https://datatracker.ietf.org/doc/html/rfc8422#section-5.1.1



Agree with it, should remove deprecated algo.



5) 6) "signature_algorithms" is changed in TLS 1.3 - 
https://datatracker.ietf.org/doc/html/rfc8446#section-4.2.3.



Similar to 1), if we align with tls1.2, we need to continue to use 
Hash&Signature Pair instead of Scheme,

even if some algorithms are deprecated in tls1.3. I prefer to keep using this 
Pair.



Since this is a backwards compatible extension field, we of course could use 
the Signature Scheme to deprecate MD5 SHA1 and others,

but this would be a bit confusing due to the sudden appearance of  a tls1.3 
structure.



7) Last but not least, I hope to see how those new definition is used.



This commit show how we use Hash&Signature Pair to set SignatureAlgoList:

https://github.com/tianocore/edk2/pull/2856/commits/cedb3c322e6d9a7efc139121bfa95c2f49383675#diff-a09163cae884557cab2f09c088c9bc53180bdcd8d7679abb6b217eeb130e071c



Consumer can call TlsSetSignatureAlgoList() with a Hash&Signature Pair array,

Then form a parameter list according to the name map TlsSignatureAlgoToName[] 
and TlsHashAlgoToName[],

Finally call the Openssl function like: 
SSL_set1_sigalgs_list(ssl,"DSA+SHA512:RSA+SHA512:ECDSA+SHA512 ");



The TLS code is in final testing, it would be very helpful if you could give 
some advice.

Thank you,
Yi



-Original Message-
From: Yao, Jiewen 
Sent: Wednesday, May 4, 2022 6:13 PM
To: devel@edk2.groups.io; Li, Yi1 
Cc: Kinney, Michael D ; Gao, Liming 

Subject: RE: [edk2-devel] [PATCH 1/1] MdePkg: Add WPA3 related TLS configure 
macro



Thanks Yi.



Some feedback:



1) {0x13, *} is defined in TLS1.3 - 
https://datatracker.ietf.org/doc/html/rfc8446#appendix-B.4

The comment ">  /// TLS Cipher Suite, refers to A.5 of rfc-2246, rfc-4346 and 
rfc-5246." should be updated to include 8446 as well.



2) Although it is not absolutely required, I highly recommend to add specific 
value to TLS_HASH_ALGO, to align with definition in RFC.

> +  TlsHashAlgoNone = 0,

> +  TlsHashAlgoMd5 = 1,

> +  TlsHashAlgoSha1 = 2,

> +  TlsHashAlgoSha224 = 3,

> +  TlsHashAlgoSha256 = 4,

> +  TlsHashAlgoSha384 = 5,

> +  TlsHashAlgoSha512 = 6,

> +} TLS_HASH_ALGO;



3) Ditto, for TLS_SIGNATURE_ALGO.



> +  TlsSignatureAlgoAnonymous = 0,

> +  TlsSignatureAlgoRsa = 1,

> +  TlsSignatureAlgoDsa = 2,

> +  TlsSignatureAlgoEcdsa = 3,

> +} TLS_SIGNATURE_ALGO;



The value is assigned in the spec. It cannot be changed.



4) RFC4492 is obsoleted by RFC8422 - 
https://datatracker.ietf.org/doc/html/rfc8422#section-5.1.1



=

   RFC 4492 defined 25 different curves in the NamedCurve registry (now

   renamed the "TLS Supported Groups" registry, although the enumeration

   below is still named NamedCurve) for use in TLS.  Only three have

   seen much use.  This specification is deprecating the rest (with

   numbers 1-22).

=



I don't see a reason to define so many deprecated algorithms.

Would you please align with section 5.1.1 in RFC8422? You may consider to add 
x25519 and x448 as well.





   enum {

   deprecated(1..22),

   secp256r1 (23), secp384r1 (24), secp521r1 (25),

   x25519(29), x448(30),

   reserved (0xFE00..0xFEFF),

   deprecated(0xFF01..0xFF02),

   (0x)

   } NamedCurve;





5) Since you added TLS 1.3 cipher suit, I assume you also want to add 
definition for TLS 1.3.



Please aware that "signature_algorithms" is changed in TLS 1.3 - 
https://datatracker.ietf.org/doc/html/rfc8446#section-4.2.3.

I am not sure if you need define that as well.





  enum {

  /* RSASSA-PKCS1-v1_5 algorithms */

  rsa_pkcs1_sha256(0x0401),

  rsa_pkcs1_sha384(0x0501),

  rsa_pkcs1_sha512(0x0601),



  /* ECDSA algorithms */

  ecdsa_secp256r1_sha256(0x0403),

  ecdsa_secp384r1_sha384(0x0503),

  ecdsa_secp521r1_sha512(0x0603),



  /* RSASSA-PSS algorithms with public key OID rsaEncryption */

  rsa_pss_rsae_sha256(0x0804),

  rsa_pss_rsae_sha384(0x0805),

  rsa_pss_rsae_sha512(0x0806),



  /* EdDSA algorithms */

  ed25519(0x0807),

  ed448(0x0808),



  /* RSASSA-PSS algorithms with public key OID RSASSA-PSS */

  rsa_pss_pss_sha256(0x0809),

  rsa_pss_pss_sha384(0x080a),

  rs