[edk2-devel] [PATCH 3/3] UefiCpuPkg: Removed the unused MpLock

2022-11-02 Thread Yuanhao Xie
From: Yuanhao 

Signed-off-by: Yuanhao Xie 
Cc: Eric Dong 
Cc: Rahul Kumar 
Cc: Ray Ni 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 1 -
 UefiCpuPkg/Library/MpInitLib/MpLib.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index c7d1e58909..25e0b3c585 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1942,7 +1942,6 @@ MpInitLibInitialize (
   CpuMpData->SwitchBspFlag= FALSE;
   CpuMpData->CpuData  = (CPU_AP_DATA *)(CpuMpData + 1);
   CpuMpData->CpuInfoInHob = (UINT64)(UINTN)(CpuMpData->CpuData + 
MaxLogicalProcessorNumber);
-  InitializeSpinLock (>MpLock);
   CpuMpData->SevEsIsEnabled   = ConfidentialComputingGuestHas (CCAttrAmdSevEs);
   CpuMpData->SevSnpIsEnabled  = ConfidentialComputingGuestHas 
(CCAttrAmdSevSnp);
   CpuMpData->SevEsAPBuffer= (UINTN)-1;
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index d6a416b943..b5bd695ead 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -241,7 +241,6 @@ struct _CPU_MP_DATA {
   // Please make sure the fields offset same in the different
   // architecture.
   //
-  SPIN_LOCKMpLock;
   UINTNBuffer;
   UINTNCpuApStackSize;
   MP_ASSEMBLY_ADDRESS_MAP  AddressMap;
-- 
2.36.1.windows.1



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




[edk2-devel] [PATCH 2/3] UefiCpuPkg: Skip Mp initialization in DXE phase

2022-11-02 Thread Yuanhao Xie
From: Yuanhao 

If PEI and DXE stages are in the same bit mode, Mp initialization
 is removed in DXE phase.

Signed-off-by: Yuanhao Xie 
Cc: Eric Dong 
Cc: Rahul Kumar 
Cc: Ray Ni 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 128 
+---
 UefiCpuPkg/Library/MpInitLib/MpLib.h |   1 +
 2 files changed, 90 insertions(+), 39 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 5430688946..c7d1e58909 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1842,12 +1842,36 @@ MpInitLibInitialize (
   UINTNApResetVectorSizeAbove1Mb;
   UINTNBackupBufferAddr;
   UINTNApIdtBase;
+  BOOLEAN  FirstTimeMpInitializing;
 
-  OldCpuMpData = GetCpuMpDataFromGuidedHob ();
-  if (OldCpuMpData == NULL) {
+  OldCpuMpData= GetCpuMpDataFromGuidedHob ();
+  FirstTimeMpInitializing = (BOOLEAN)(OldCpuMpData == NULL);
+
+  if (FirstTimeMpInitializing) {
 MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
+//
+// The first time Mp is initialized, or the saved CpuMpData is lost, the
+// complete process including preparing the buffer, filling the CpuMpData,
+// loading the microcode, and waking up the Aps needs to be performed.
+//
   } else {
 MaxLogicalProcessorNumber = OldCpuMpData->CpuCount;
+//
+// If both PEI and DXE phases are 64-bit, CpuMpdata collected in PEI stage
+// can be reused in DXE stage, thus no need to redo the initialization.
+// For the case where DXE is 64-bit and PEI is 32-bit, a partial
+// initialization of Mp is required.
+//
+if (OldCpuMpData->SizeOfUINTN == sizeof (UINTN)) {
+  DEBUG ((DEBUG_INFO, "OldCpuMpData->SizeOfUINTN: %04d, sizeof (UINTN): 
%04d\n", OldCpuMpData->SizeOfUINTN, sizeof (UINTN)));
+
+  OldCpuMpData->NewCpuMpData = OldCpuMpData;
+  //
+  // Initialize global data for MP support
+  //
+  InitMpGlobalData (OldCpuMpData);
+  return EFI_SUCCESS;
+}
   }
 
   ASSERT (MaxLogicalProcessorNumber != 0);
@@ -1991,7 +2015,7 @@ MpInitLibInitialize (
   //
   ProgramVirtualWireMode ();
 
-  if (OldCpuMpData == NULL) {
+  if (FirstTimeMpInitializing) {
 if (MaxLogicalProcessorNumber > 1) {
   //
   // Wakeup all APs and calculate the processor count in system
@@ -2015,58 +2039,84 @@ MpInitLibInitialize (
 // Detect and apply Microcode on BSP
 //
 MicrocodeDetect (CpuMpData, CpuMpData->BspNumber);
+
+//
+// CpuMpData->CpuCount was updated in CollectProcessorCount()
+// during the first time Mp Initialization.
+//
+if (CpuMpData->CpuCount > 1) {
+  WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);
+  //
+  // Wait for all APs to complete initialization.
+  //
+  while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
+CpuPause ();
+  }
+}
+//
+// After Mp is initialized, sizeof(UINTN) is saved and will be transferred 
to DXE.
+// It is used to decide whether Mp initialization needs to be done again.
+// SizeOfUINTN and other fields (CpuInfoInHob, CpuCount, BspNumber) 
declared at the top of
+// the CPU_MP_DATA structure are independent of the bit mode( 32 or 64).
+//
+CpuMpData->SizeOfUINTN = sizeof (UINTN);
   } else {
 //
-// APs have been wakeup before, just get the CPU Information
-// from HOB
+// For the else case where DXE is 64-bit and PEI is 32-bit, a partial
+// initialization of Mp is required.
 //
+
 OldCpuMpData->NewCpuMpData = CpuMpData;
-CpuMpData->CpuCount= OldCpuMpData->CpuCount;
-CpuMpData->BspNumber   = OldCpuMpData->BspNumber;
-CpuMpData->CpuInfoInHob= OldCpuMpData->CpuInfoInHob;
-CpuInfoInHob   = (CPU_INFO_IN_HOB 
*)(UINTN)CpuMpData->CpuInfoInHob;
+//
+// CpuCount, BspNumber, CpuInfoInHob as well as SizeOfUINTN are 
collected during PEI,
+// and need to be saved in HOB for DXE. The rest fields of _CPU_MP_DATA is 
more like the temporary field.
+// They will be updated during DXE if the DXE mode is different from PEI.
+//
+CpuMpData->CpuCount = OldCpuMpData->CpuCount;
+CpuMpData->BspNumber= OldCpuMpData->BspNumber;
+CpuMpData->CpuInfoInHob = OldCpuMpData->CpuInfoInHob;
+CpuInfoInHob= (CPU_INFO_IN_HOB 
*)(UINTN)CpuMpData->CpuInfoInHob;
 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
+  //
+  // In PEI phase, or for first time initialization, initializeSpinLock is
+  // performed during CollectProcessorCount(). In DXE phase, it is done 
during traversal here.
+  //
   InitializeSpinLock (>CpuData[Index].ApLock);
   CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 

[edk2-devel] [PATCH 1/3] UefiCpuPkg: Remove the duplicate loading of microcode in DXE stage

2022-11-02 Thread Yuanhao Xie
From: Yuanhao 

If both in the DXE and PEI phase Mp initialization is excuted, the
microcode loading during Mp initialization of the DXE stage can be
removed regardless of the bit modes.

Signed-off-by: Yuanhao Xie 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 58 
+-
 1 file changed, 41 insertions(+), 17 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 1c053f87a4..5430688946 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -432,6 +432,27 @@ ApFuncEnableX2Apic (
   SetApicMode (LOCAL_APIC_MODE_X2APIC);
 }
 
+/**
+  Sync BSP's MTRR table to AP during waking upAp
+
+  @param[in, out] Buffer  Pointer to private data buffer.
+**/
+VOID
+EFIAPI
+ApMtrrSync (
+  IN OUT VOID  *Buffer
+  )
+{
+  CPU_MP_DATA  *CpuMpData;
+
+  CpuMpData = (CPU_MP_DATA *)Buffer;
+
+  //
+  // Sync BSP's MTRR table to AP
+  //
+  MtrrSetAllMtrrs (>MtrrTable);
+}
+
 /**
   Do sync on APs.
 
@@ -1977,6 +1998,23 @@ MpInitLibInitialize (
   //
   CollectProcessorCount (CpuMpData);
 }
+
+if (!GetMicrocodePatchInfoFromHob (
+   >MicrocodePatchAddress,
+   >MicrocodePatchRegionSize
+   ))
+{
+  //
+  // The microcode patch information cache HOB does not exist, which means
+  // the microcode patches data has not been loaded into memory yet
+  //
+  ShadowMicrocodeUpdatePatch (CpuMpData);
+}
+
+//
+// Detect and apply Microcode on BSP
+//
+MicrocodeDetect (CpuMpData, CpuMpData->BspNumber);
   } else {
 //
 // APs have been wakeup before, just get the CPU Information
@@ -1994,22 +2032,6 @@ MpInitLibInitialize (
 }
   }
 
-  if (!GetMicrocodePatchInfoFromHob (
- >MicrocodePatchAddress,
- >MicrocodePatchRegionSize
- ))
-  {
-//
-// The microcode patch information cache HOB does not exist, which means
-// the microcode patches data has not been loaded into memory yet
-//
-ShadowMicrocodeUpdatePatch (CpuMpData);
-  }
-
-  //
-  // Detect and apply Microcode on BSP
-  //
-  MicrocodeDetect (CpuMpData, CpuMpData->BspNumber);
   //
   // Store BSP's MTRR setting
   //
@@ -2026,9 +2048,11 @@ MpInitLibInitialize (
   // in DXE.
   //
   CpuMpData->InitFlag = ApInitReconfig;
+  WakeUpAP (CpuMpData, TRUE, 0, ApMtrrSync, CpuMpData, TRUE);
+} else {
+  WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);
 }
 
-WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);
 //
 // Wait for all APs finished initialization
 //
-- 
2.36.1.windows.1



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




[edk2-devel] [PATCH 0/3] Remove the redundent Mp initialization

2022-11-02 Thread Yuanhao Xie
1. Removed the duplicated loading of microcode in DXE phase.
2. emoved repeated Mp initialization, taking into account the 
different bit mode (32bit/64bit) combinations of PEI and DXE stages.
3. Removed the unused MpLock.

Yuanhao (3):
  UefiCpuPkg: Remove the duplicate loading of microcode in DXE stage
  UefiCpuPkg: Skip Mp initialization in DXE phase
  UefiCpuPkg: Removed the unused MpLock

 UefiCpuPkg/Library/MpInitLib/MpLib.c | 177 
+
 UefiCpuPkg/Library/MpInitLib/MpLib.h |   2 +-
 2 files changed, 126 insertions(+), 53 deletions(-)

-- 
2.36.1.windows.1



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




[edk2-devel] AARCH64 :The system disk bus is set to SATA, and the system disk cannot be found after power on

2022-11-02 Thread 曾浩
  hi:     As the title, Not supported by arm, but supported by x86,why?          Because ARM does not support pio?       I look forward to your help. Thank you 

 _._,_._,_Groups.io Links:   You receive all messages sent to this group. View/Reply Online (#95881) ||  Mute This Topic  | New TopicYour Subscription | Contact Group Owner |  Unsubscribe  [arch...@mail-archive.com] _._,_._,_ 



Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support input UPD as NULL.

2022-11-02 Thread Kuo, Ted
Hi Chasel,

I have few comments. Please find [Ted] inline.

Thanks,
Ted

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Chiu, Chasel
Sent: Wednesday, November 2, 2022 1:46 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Zeng, Star 
Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support input UPD as 
NULL.

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

FSP specification supports input UPD as NULL cases which FSP will
use built-in UPD region instead.
FSP should not return INVALID_PARAMETER in such cases.

In FSP-T entry point case, the valid FSP-T UPD region pointer will be
passed to platform FSP code to consume.
In FSP-M and FSP-S cases, valid UPD pointer will be decided when
updating corresponding pointer field in FspGlobalData.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/SecFspApiChk.c | 12 ++--
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm | 73 
+++--
 IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm  | 40 
++--
 3 files changed, 91 insertions(+), 34 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c 
b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
index a44fbf2a50..5f59938518 100644
--- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
+++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
@@ -44,6 +44,8 @@ FspApiCallingCheck (
 //
 if (((UINTN)FspData != MAX_ADDRESS) && ((UINTN)FspData != MAX_UINT32)) {
   Status = EFI_UNSUPPORTED;
+} else if (ApiParam == NULL) {
+  Status = EFI_SUCCESS;
 } else if (EFI_ERROR (FspUpdSignatureCheck (ApiIdx, ApiParam))) {
   Status = EFI_INVALID_PARAMETER;
 }
@@ -67,9 +69,13 @@ FspApiCallingCheck (
 } else {
   if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {
 Status = EFI_UNSUPPORTED;
-  } else if (EFI_ERROR (FspUpdSignatureCheck (FspSiliconInitApiIndex, 
ApiParam))) {
-Status = EFI_INVALID_PARAMETER;
   } else if (ApiIdx == FspSiliconInitApiIndex) {
+if (ApiParam == NULL) {
+  Status = EFI_SUCCESS;
+} else if (EFI_ERROR (FspUpdSignatureCheck (FspSiliconInitApiIndex, 
ApiParam))) {
+  Status = EFI_INVALID_PARAMETER;
+}
+
 //
 // Reset MultiPhase NumberOfPhases to zero
 //
@@ -89,6 +95,8 @@ FspApiCallingCheck (
 } else {
   if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {
 Status = EFI_UNSUPPORTED;
+  } else if (ApiParam == NULL) {
+Status = EFI_SUCCESS;
   } else if (EFI_ERROR (FspUpdSignatureCheck (FspSmmInitApiIndex, 
ApiParam))) {
 Status = EFI_INVALID_PARAMETER;
   }
diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm 
b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
index 61030a843b..73821ad22a 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
@@ -21,7 +21,7 @@ extern   ASM_PFX(PcdGet32 (PcdFspReservedBufferSize))
 ; Following functions will be provided in PlatformSecLib
 ;
 extern ASM_PFX(AsmGetFspBaseAddress)
-extern ASM_PFX(AsmGetFspInfoHeader)
+extern ASM_PFX(AsmGetFspInfoHeaderNoStack)
 ;extern ASM_PFX(LoadMicrocode); @todo: needs a weak implementation
 extern ASM_PFX(SecPlatformInit)   ; @todo: needs a weak implementation
 extern ASM_PFX(SecCarInit)
@@ -160,6 +160,47 @@ endstruc
  RET_ESI_EXT   mm7
 %endmacro
 
+%macro CALL_EDI  1
+
+  mov edi,  %%ReturnAddress
+  jmp %1
+%%ReturnAddress:
+
+%endmacro
+
+%macro CALL_EBP 1
+  mov ebp, %%ReturnAddress
+  jmp %1
+%%ReturnAddress:
+%endmacro
+
+%macro RET_EBP 0
+  jmp ebp   ; restore EIP from EBP
+%endmacro
+
+;
+; Load UPD region pointer in ECX
+;
+global ASM_PFX(LoadUpdPointerToECX)
+ASM_PFX(LoadUpdPointerToECX):
+  ;
+  ; esp + 4 is input UPD parameter
+  ; If esp + 4 is NULL the default UPD should be used
+  ; ecx will be the UPD region that should be used
+  ;
+  mov   ecx, dword [esp + 4]
+  cmp   ecx, 0
+  jnz   ParamValid
+
+  ;
+  ; Fall back to default UPD region
+  ;
+  CALL_EDI  ASM_PFX(AsmGetFspInfoHeaderNoStack)
+  mov   ecx, DWORD [eax + 01Ch]  ; Read FsptImageBaseAddress
+  add   ecx, DWORD [eax + 024h]  ; Get Cfg Region base address = 
FsptImageBaseAddress + CfgRegionOffset
+ParamValid:
+  RET_EBP
+
 ;
 ; @todo: The strong/weak implementation does not work.
 ;This needs to be reviewed later.
@@ -187,10 +228,9 @@ endstruc
 global ASM_PFX(LoadMicrocodeDefault)
 ASM_PFX(LoadMicrocodeDefault):
; Inputs:
-   ;   esp -> LoadMicrocodeParams pointer
+   ;   ecx -> UPD region contains LoadMicrocodeParams pointer
; Register Usage:
-   ;   esp  Preserved
-   ;   All others destroyed
+   ;   All are destroyed
; Assumptions:
;   No memory available, stack is hard-coded and used for return address
;   Executed by SBSP and NBSP
@@ 

Re: [edk2-devel] [PATCH 1/2] MdePkg/IndustryStandard: add definitions for ACPI APMT

2022-11-02 Thread Gao, Zhichao
Reviewed-by: Zhichao Gao 

Thanks,
Zhichao

> -Original Message-
> From: Sami Mujawar 
> Sent: Tuesday, November 1, 2022 7:42 PM
> To: devel@edk2.groups.io; jbra...@nvidia.com
> Cc: Kinney, Michael D ; Gao, Liming
> ; Liu, Zhiguang ; Gao,
> Zhichao ; Ni, Ray ; n...@arm.com
> Subject: Re: [edk2-devel] [PATCH 1/2] MdePkg/IndustryStandard: add
> definitions for ACPI APMT
> 
> Hi Jeff,
> 
> Thank you for this patch.
> 
> These changes look good to me.
> 
> Reviewed-by: Sami Mujawar 
> 
> Regards,
> 
> Sami Mujawar
> 
> On 27/10/2022 03:40 pm, Jeff Brasen via groups.io wrote:
> > This adds #defines and struct typedefs for the various node types in
> >
> > the  ACPI Arm Performance Monitoring Unit (APMT) table.
> >
> >
> >
> > Signed-off-by: Jeff Brasen 
> >
> > ---
> >
> >   MdePkg/Include/IndustryStandard/Acpi64.h  |  5 ++
> >
> >   .../ArmPerformanceMonitoringUnitTable.h   | 69
> +++
> >
> >   2 files changed, 74 insertions(+)
> >
> >   create mode 100644
> MdePkg/Include/IndustryStandard/ArmPerformanceMonitoringUnitTable.h
> >
> >
> >
> > diff --git a/MdePkg/Include/IndustryStandard/Acpi64.h
> b/MdePkg/Include/IndustryStandard/Acpi64.h
> >
> > index fe5ebfac2b..575ca0430c 100644
> >
> > --- a/MdePkg/Include/IndustryStandard/Acpi64.h
> >
> > +++ b/MdePkg/Include/IndustryStandard/Acpi64.h
> >
> > @@ -2847,6 +2847,11 @@ typedef struct {
> >
> >   ///
> >
> >   #define
> EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE
> SIGNATURE_32('A', 'P', 'I', 'C')
> >
> >
> >
> > +///
> >
> > +/// "APMT" Arm Performance Monitoring Unit Table
> >
> > +///
> >
> > +#define
> EFI_ACPI_6_4_ARM_PERFORMANCE_MONITORING_UNIT_TABLE_SIGNATU
> RE  SIGNATURE_32('A', 'P', 'M', 'T')
> >
> > +
> >
> >   ///
> >
> >   /// "BERT" Boot Error Record Table
> >
> >   ///
> >
> > diff --git
> a/MdePkg/Include/IndustryStandard/ArmPerformanceMonitoringUnitTable.
> h
> b/MdePkg/Include/IndustryStandard/ArmPerformanceMonitoringUnitTable
> .h
> >
> > new file mode 100644
> >
> > index 00..fe7084cffd
> >
> > --- /dev/null
> >
> > +++
> b/MdePkg/Include/IndustryStandard/ArmPerformanceMonitoringUnitTable
> .h
> >
> > @@ -0,0 +1,69 @@
> >
> > +/** @file
> >
> > +  ACPI Arm Performance Monitoring Unit (APMT) table
> >
> > +  as specified in ARM spec DEN0117
> >
> > +
> >
> > +  Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
> >
> > +  Copyright (c) 2022, ARM Limited. All rights reserved.
> >
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> > +**/
> >
> > +
> >
> > +#ifndef ARM_PERFORMANCE_MONITORING_UNIT_TABLE_H_
> >
> > +#define ARM_PERFORMANCE_MONITORING_UNIT_TABLE_H_
> >
> > +
> >
> > +#include 
> >
> > +
> >
> > +#pragma pack(1)
> >
> > +
> >
> > +///
> >
> > +/// Arm Performance Monitoring Unit (APMT) tabl
> >
> > +///
> >
> > +typedef struct {
> >
> > +  EFI_ACPI_DESCRIPTION_HEADERHeader;
> >
> > +} EFI_ACPI_ARM_PERFORMANCE_MONITORING_UNIT_TABLE_HEADER;
> >
> > +
> >
> > +///
> >
> > +/// APMT Revision (as defined in DEN0117.)
> >
> > +///
> >
> > +#define
> EFI_ACPI_ARM_PERFORMANCE_MONITORING_UNIT_TABLE_REVISION
> 0x00
> >
> > +
> >
> > +///
> >
> > +/// Arm PMU Node Structure
> >
> > +///
> >
> > +
> >
> > +// Node Flags
> >
> > +#define EFI_ACPI_APMT_DUAL_PAGE_EXTENSION_SUPPORTED  BIT0
> >
> > +#define EFI_ACPI_APMT_PROCESSOR_AFFINITY_TYPE_CONTAINER
> BIT1
> >
> > +#define EFI_ACPI_APMT_PROCESSOR_AFFINITY_TYPE_PROCESSOR  0
> // BIT 1
> >
> > +#define EFI_ACPI_APMT_64BIT_SINGLE_COPY_ATOMICITY_SUPPORTED
> BIT2
> >
> > +
> >
> > +// Interrupt Flags
> >
> > +#define EFI_ACPI_APMT_INTERRUPT_MODE_EDGE_TRIGGERED   BIT0
> >
> > +#define EFI_ACPI_APMT_INTERRUPT_MODE_LEVEL_TRIGGERED  0 // BIT
> 0
> >
> > +#define EFI_ACPI_APMT_INTERRUPT_TYPE_WIRED0 // BIT 1
> >
> > +
> >
> > +// Node Type
> >
> > +#define EFI_ACPI_APMT_NODE_TYPE_MEMORY_CONTROLLER  0x00
> >
> > +#define EFI_ACPI_APMT_NODE_TYPE_SMMU   0x01
> >
> > +#define EFI_ACPI_APMT_NODE_TYPE_PCIE_ROOT_COMPLEX  0x02
> >
> > +#define EFI_ACPI_APMT_NODE_TYPE_ACPI_DEVICE0x03
> >
> > +#define EFI_ACPI_APMT_NODE_TYPE_CPU_CACHE  0x04
> >
> > +
> >
> > +typedef struct {
> >
> > +  UINT16Length;
> >
> > +  UINT8 NodeFlags;
> >
> > +  UINT8 NodeType;
> >
> > +  UINT32Identifier;
> >
> > +  UINT64NodeInstancePrimary;
> >
> > +  UINT32NodeInstanceSecondary;
> >
> > +  UINT64BaseAddress0;
> >
> > +  UINT64BaseAddress1;
> >
> > +  UINT32OverflowInterrupt;
> >
> > +  UINT32Reserved1;
> >
> > +  UINT32OverflowInterruptFlags;
> >
> > +  UINT32ProcessorAffinity;
> >
> > +  UINT32ImplementationId;
> >
> > +} EFI_ACPI_ARM_PERFORMANCE_MONITORING_UNIT_NODE;
> >
> > +
> >
> > +#pragma pack()
> >
> > +
> >
> > +#endif
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95879): https://edk2.groups.io/g/devel/message/95879
Mute This Topic: https://groups.io/mt/94605427/21656
Group Owner: 

Re: [edk2-devel] [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in SafeString

2022-11-02 Thread Pedro Falcato
Hi Liming,

I've just sent out the v3.

Thanks,
Pedro


On Thu, Nov 3, 2022 at 1:01 AM gaoliming  wrote:

> Pedro:
>
>  Marvin gave one suggestion for the code change (
> https://edk2.groups.io/g/devel/message/95635). Can you response it?
>
>
>
> Thanks
>
> Liming
>
> *发件人:* Pedro Falcato 
> *发送时间:* 2022年11月3日 7:42
> *收件人:* Kinney, Michael D 
> *抄送:* Yao, Jiewen ; devel@edk2.groups.io; Vitaly
> Cheptsov ; Marvin Häuser ;
> Gao, Liming ; Liu, Zhiguang <
> zhiguang@intel.com>
> *主题:* Re: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> SafeString
>
>
>
> Can someone push this? Is there a blocker here?
>
>
>
> On Wed, Oct 26, 2022 at 4:54 PM Kinney, Michael D <
> michael.d.kin...@intel.com> wrote:
>
> Acked-by: Michael D Kinney 
>
>
> > -Original Message-
> > From: Yao, Jiewen 
> > Sent: Wednesday, October 26, 2022 6:35 AM
> > To: Kinney, Michael D ; Pedro Falcato <
> pedro.falc...@gmail.com>; devel@edk2.groups.io
> > Cc: Vitaly Cheptsov ; Marvin Häuser <
> mhaeu...@posteo.de>; Gao, Liming ; Liu,
> > Zhiguang 
> > Subject: RE: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> SafeString
> >
> > That is good catch.
> >
> > Reviewed-by: Jiewen Yao 
> >
> >
> > > -Original Message-
> > > From: Kinney, Michael D 
> > > Sent: Wednesday, October 26, 2022 12:23 AM
> > > To: Pedro Falcato ; devel@edk2.groups.io
> > > Cc: Vitaly Cheptsov ; Marvin Häuser
> > > ; Gao, Liming ; Liu,
> > > Zhiguang ; Yao, Jiewen 
> > > Subject: RE: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> > > SafeString
> > >
> > > Adding Jiewen Yao.
> > >
> > > Mike
> > >
> > > > -Original Message-
> > > > From: Pedro Falcato 
> > > > Sent: Monday, October 24, 2022 3:43 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Pedro Falcato ; Vitaly Cheptsov
> > > ; Marvin Häuser ;
> > > > Kinney, Michael D ; Gao, Liming
> > > ; Liu, Zhiguang 
> > > > Subject: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> > > SafeString
> > > >
> > > > OpenCore folks established an ASAN-equipped project to fuzz Ext4Dxe,
> > > > which was able to catch these (mostly harmless) issues.
> > > >
> > > > Signed-off-by: Pedro Falcato 
> > > > Cc: Vitaly Cheptsov 
> > > > Cc: Marvin Häuser 
> > > > Cc: Michael D Kinney 
> > > > Cc: Liming Gao 
> > > > Cc: Zhiguang Liu 
> > > > ---
> > > >  MdePkg/Library/BaseLib/SafeString.c | 24 
> > > >  1 file changed, 20 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/MdePkg/Library/BaseLib/SafeString.c
> > > b/MdePkg/Library/BaseLib/SafeString.c
> > > > index f338a32a3a41..77a2585ad56d 100644
> > > > --- a/MdePkg/Library/BaseLib/SafeString.c
> > > > +++ b/MdePkg/Library/BaseLib/SafeString.c
> > > > @@ -863,6 +863,9 @@ StrHexToUintnS (
> > > >OUT   UINTN   *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;
> > > > +
> > > > +  FoundLeadingZero = FALSE;
> > > >ASSERT (((UINTN)String & BIT0) == 0);
> > > >
> > > >//
> > > > @@ -893,11 +896,12 @@ StrHexToUintnS (
> > > >// Ignore leading Zeros after the spaces
> > > >//
> > > >while (*String == L'0') {
> > > > +FoundLeadingZero = TRUE;
> > > >  String++;
> > > >}
> > > >
> > > >if (CharToUpper (*String) == L'X') {
> > > > -if (*(String - 1) != L'0') {
> > > > +if (!FoundLeadingZero) {
> > > >*Data = 0;
> > > >return RETURN_SUCCESS;
> > > >  }
> > > > @@ -992,6 +996,9 @@ StrHexToUint64S (
> > > >OUT   UINT64  *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;
> > > > +
> > > > +  FoundLeadingZero = FALSE;
> > > >ASSERT (((UINTN)String & BIT0) == 0);
> > > >
> > > >//
> > > > @@ -1022,11 +1029,12 @@ StrHexToUint64S (
> > > >// Ignore leading Zeros after the spaces
> > > >//
> > > >while (*String == L'0') {
> > > > +FoundLeadingZero = TRUE;
> > > >  String++;
> > > >}
> > > >
> > > >if (CharToUpper (*String) == L'X') {
> > > > -if (*(String - 1) != L'0') {
> > > > +if (!FoundLeadingZero) {
> > > >*Data = 0;
> > > >return RETURN_SUCCESS;
> > > >  }
> > > > @@ -2393,6 +2401,9 @@ AsciiStrHexToUintnS (
> > > >OUT   UINTN  *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;
> > > > +
> > > > +  FoundLeadingZero = FALSE;
> > > >//
> > > >// 1. Neither String nor Data shall be a null pointer.
> > > >//
> > > > @@ -2421,11 +2432,12 @@ AsciiStrHexToUintnS (
> > > >// Ignore leading Zeros after the spaces
> > > >//
> > > >while (*String == '0') {
> > > > +FoundLeadingZero = TRUE;
> > > >  String++;
> > > >}
> > > >
> > > >if (AsciiCharToUpper (*String) == 'X') {
> > > > -if (*(String - 1) != '0') {
> > > > +if (!FoundLeadingZero) {
> > > >*Data = 0;
> > > >return RETURN_SUCCESS;
> > > >  }
> > > > @@ -2517,6 +2529,9 @@ AsciiStrHexToUint64S (
> > > >OUT   UINT64  *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;

Re: [edk2-devel] [PATCH 3/8] UefiCpuPkg: Use CcExitLib instead of VmgExitLib

2022-11-02 Thread Min Xu
On November 2, 2022 9:50 PM, Lendacky, Thomas wrote:
> 
> On 11/2/22 00:10, Min Xu wrote:
> > From: Min M Xu 
> >
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123
> >
> > VmgExitLib once was designed to provide interfaces to support #VC
> > handler and issue VMGEXIT instruction. After TDVF (enable TDX feature
> > in OVMF) is introduced, this library is updated to support #VE as
> > well. Now the name of VmgExitLib cannot reflect what the lib does. So
> > VmgExitLib is replaced by CcExitLib.
> 
> I get a build failure when building this patch:
> 
> build.py...
> /root/kernels/ovmf-build-X64/OvmfPkg/OvmfPkgX64.dsc(...): error 4000:
> Instance of library class [CcExitLib] is not found
>  in [/root/kernels/ovmf-build-
> X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandl
> erLib.inf] [X64]
>  consumed by module [/root/kernels/ovmf-build-
> X64/OvmfPkg/Sec/SecMain.inf]
> 
> - Failed -
> 
Thanks for reminder. I will fix it and submit a new version.

Thanks
Min


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




[edk2-devel] [PATCH v3 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in SafeString

2022-11-02 Thread Pedro Falcato
There was a OOB access in *StrHexTo* functions, when passed strings like
"XDEADBEEF".

OpenCore folks established an ASAN-equipped project to fuzz Ext4Dxe,
which was able to catch these (mostly harmless) issues.

Cc: Vitaly Cheptsov 
Cc: Marvin Häuser 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Pedro Falcato 
Acked-by: Michael D Kinney 
Reviewed-by: Jiewen Yao 
---
 MdePkg/Library/BaseLib/SafeString.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Library/BaseLib/SafeString.c 
b/MdePkg/Library/BaseLib/SafeString.c
index f338a32a3a41..b75b33381732 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -863,6 +863,9 @@ StrHexToUintnS (
   OUT   UINTN   *Data
   )
 {
+  BOOLEAN  FoundLeadingZero;
+
+  FoundLeadingZero = FALSE;
   ASSERT (((UINTN)String & BIT0) == 0);
 
   //
@@ -892,12 +895,14 @@ StrHexToUintnS (
   //
   // Ignore leading Zeros after the spaces
   //
+
+  FoundLeadingZero = *String == L'0';
   while (*String == L'0') {
 String++;
   }
 
   if (CharToUpper (*String) == L'X') {
-if (*(String - 1) != L'0') {
+if (!FoundLeadingZero) {
   *Data = 0;
   return RETURN_SUCCESS;
 }
@@ -992,6 +997,9 @@ StrHexToUint64S (
   OUT   UINT64  *Data
   )
 {
+  BOOLEAN  FoundLeadingZero;
+
+  FoundLeadingZero = FALSE;
   ASSERT (((UINTN)String & BIT0) == 0);
 
   //
@@ -1021,12 +1029,13 @@ StrHexToUint64S (
   //
   // Ignore leading Zeros after the spaces
   //
+  FoundLeadingZero = *String == L'0';
   while (*String == L'0') {
 String++;
   }
 
   if (CharToUpper (*String) == L'X') {
-if (*(String - 1) != L'0') {
+if (!FoundLeadingZero) {
   *Data = 0;
   return RETURN_SUCCESS;
 }
@@ -2393,6 +2402,9 @@ AsciiStrHexToUintnS (
   OUT   UINTN  *Data
   )
 {
+  BOOLEAN  FoundLeadingZero;
+
+  FoundLeadingZero = FALSE;
   //
   // 1. Neither String nor Data shall be a null pointer.
   //
@@ -2420,12 +2432,13 @@ AsciiStrHexToUintnS (
   //
   // Ignore leading Zeros after the spaces
   //
+  FoundLeadingZero = *String == '0';
   while (*String == '0') {
 String++;
   }
 
   if (AsciiCharToUpper (*String) == 'X') {
-if (*(String - 1) != '0') {
+if (!FoundLeadingZero) {
   *Data = 0;
   return RETURN_SUCCESS;
 }
@@ -2517,6 +2530,9 @@ AsciiStrHexToUint64S (
   OUT   UINT64  *Data
   )
 {
+  BOOLEAN  FoundLeadingZero;
+
+  FoundLeadingZero = FALSE;
   //
   // 1. Neither String nor Data shall be a null pointer.
   //
@@ -2544,12 +2560,13 @@ AsciiStrHexToUint64S (
   //
   // Ignore leading Zeros after the spaces
   //
+  FoundLeadingZero = *String == '0';
   while (*String == '0') {
 String++;
   }
 
   if (AsciiCharToUpper (*String) == 'X') {
-if (*(String - 1) != '0') {
+if (!FoundLeadingZero) {
   *Data = 0;
   return RETURN_SUCCESS;
 }
-- 
2.38.1



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




Re: [edk2-devel] How to add a DXE driver to an OVMF image?

2022-11-02 Thread Andrew Fish via groups.io
If you are building with the firmware use the DebugLib in the INF and DEBUG(); 
macros.

DEBUG((DEBUG_ERROR, “It works\n”));

Also by setting your Depex to TRUE you are basically asking to run before the 
console is available. If you want to depend on all UEFI Services being present 
don’t set a dependency expression. The Depex is for ordering the early drivers 
that don’t follow the UEFI Driver Model. So for example you have to configure 
your chipset, and SPI driver to get UEFI NVRAM working etc. 

Thanks,

Andrew Fish

> On Nov 2, 2022, at 5:58 PM, Pedro Falcato  wrote:
> 
> Hi!
> 
> If I recall correctly, UEFI drivers are not guaranteed to have a valid ConOut 
> and ConIn, and you're not supposed to use those. They are (always?) valid in 
> UEFI apps.
> Can you try to use DebugLib (don't forget to place DebugLib in 
> LibraryClasses) and DEBUG((DEBUG_INFO, "Blah\n")); ? That should pretty much 
> work. Note that OVMF will send those debug messages to a special device, so 
> you can pass "-debugcon file:debug.log -global isa-debugcon.iobase=0x402" to 
> QEMU to keep them. The rest of your procedure looks mostly OK as far as I can 
> tell.
> 
> Crash theory: ConOut was garbage, so you tried to jump into a random address. 
> Random address had random data/instructions in there, which caused you an int 
> 6 -> Invalid opcode.
> 
> Thanks,
> Pedro
> 
> On Wed, Nov 2, 2022 at 2:02 PM d.meneses via groups.io  
> mailto:softi9...@groups.io>> wrote:
>> As detailed on this post on Super User 
>> , I am trying to add a DXE driver 
>> to an OVMF image I'm building with edk2. Nobody was able to help me there so 
>> I turn here for your help.
>>  
>> I haven't found any proper documentation on exactly what I'm trying to 
>> achieve so I am probably missing something.
>>  
>> So far what I have done is:
>> create the simplest DXE driver I managed
>> In folder MdeModulePkg/Application/Hello, I have:
>> Hello.c : 
>> include
>>  
>> ...
>>  
>> while (1)
>> SystemTable->ConOut->OutputString(SystemTable->ConOut,
>>   L"It works!\n");
>> return EFI_SUCCESS;
>> 
>>  
>> Hello.inf : 
>> [Defines]
>>   INF_VERSION= 0x00010005
>>   BASE_NAME  = Hello
>>   FILE_GUID  = ...
>>   MODULE_TYPE= DXE_DRIVER
>>   VERSION_STRING = 1.0
>>   ENTRY_POINT= UefiMain
>> 
>> 
>> [Sources]
>>   Hello.c
>> 
>> [Packages]
>>   MdePkg/MdePkg.dec
>>   MdeModulePkg/MdeModulePkg.dec
>> 
>> [LibraryClasses]
>>   UefiDriverEntryPoint
>>   UefiLib
>> 
>> [Depex]
>> TRUE
>> Set OvmfPkg/OvmfPkgX64.dsc as my target platform with GCC5 as the toolchain
>> Add MdeModulePkg/Application/Hello/Hello.inf to the end of the component 
>> section (I have tried to add it after other certain drivers) in the .dsc 
>> file.
>> Add MdeModulePkg/Application/Hello/Hello.inf to the end of the [FV.DXEFV] 
>> section in OvmfPkgX64.fdf (I have also tried to add it after other certain 
>> drivers)
>> Run build
>> Run QEMU with the resulting OVMF image: qemu-system-x86_64 -d int -D log.txt 
>>  -bios OVMF.fd -net none -drive file=fat:rw:bootdrv,format=raw
>> QEMU hangs with message "Guest has not initialized display (yet)"
>> log.txt has one log: check_exception old: 0x new 0x6
>>  
>> 
>> 
> 
> 
> -- 
> Pedro Falcato
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95875): https://edk2.groups.io/g/devel/message/95875
Mute This Topic: https://groups.io/mt/94734592/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/1] MdePkg/BaseLib: Fix out-of-bounds reads in SafeString

2022-11-02 Thread gaoliming via groups.io
Pedro:

 Marvin gave one suggestion for the code change 
(https://edk2.groups.io/g/devel/message/95635). Can you response it?

 

Thanks

Liming

发件人: Pedro Falcato  
发送时间: 2022年11月3日 7:42
收件人: Kinney, Michael D 
抄送: Yao, Jiewen ; devel@edk2.groups.io; Vitaly Cheptsov 
; Marvin Häuser ; Gao, Liming 
; Liu, Zhiguang 
主题: Re: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in SafeString

 

Can someone push this? Is there a blocker here?

 

On Wed, Oct 26, 2022 at 4:54 PM Kinney, Michael D mailto:michael.d.kin...@intel.com> > wrote:

Acked-by: Michael D Kinney mailto:michael.d.kin...@intel.com> >


> -Original Message-
> From: Yao, Jiewen mailto:jiewen@intel.com> >
> Sent: Wednesday, October 26, 2022 6:35 AM
> To: Kinney, Michael D   >; Pedro Falcato   >; devel@edk2.groups.io 
>  
> Cc: Vitaly Cheptsov mailto:vit9...@protonmail.com> 
> >; Marvin Häuser mailto:mhaeu...@posteo.de> >; Gao, 
> Liming mailto:gaolim...@byosoft.com.cn> >; Liu,
> Zhiguang mailto:zhiguang@intel.com> >
> Subject: RE: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in 
> SafeString
> 
> That is good catch.
> 
> Reviewed-by: Jiewen Yao mailto:jiewen@intel.com> >
> 
> 
> > -Original Message-
> > From: Kinney, Michael D  >  >
> > Sent: Wednesday, October 26, 2022 12:23 AM
> > To: Pedro Falcato mailto:pedro.falc...@gmail.com> 
> > >; devel@edk2.groups.io  
> > Cc: Vitaly Cheptsov mailto:vit9...@protonmail.com> 
> > >; Marvin Häuser
> > mailto:mhaeu...@posteo.de> >; Gao, Liming 
> > mailto:gaolim...@byosoft.com.cn> >; Liu,
> > Zhiguang mailto:zhiguang@intel.com> >; Yao, 
> > Jiewen mailto:jiewen@intel.com> >
> > Subject: RE: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> > SafeString
> >
> > Adding Jiewen Yao.
> >
> > Mike
> >
> > > -Original Message-
> > > From: Pedro Falcato  > >  >
> > > Sent: Monday, October 24, 2022 3:43 PM
> > > To: devel@edk2.groups.io  
> > > Cc: Pedro Falcato  > >  >; Vitaly Cheptsov
> > mailto:vit9...@protonmail.com> >; Marvin Häuser 
> > mailto:mhaeu...@posteo.de> >;
> > > Kinney, Michael D  > >  >; Gao, Liming
> > mailto:gaolim...@byosoft.com.cn> >; Liu, 
> > Zhiguang mailto:zhiguang@intel.com> >
> > > Subject: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> > SafeString
> > >
> > > OpenCore folks established an ASAN-equipped project to fuzz Ext4Dxe,
> > > which was able to catch these (mostly harmless) issues.
> > >
> > > Signed-off-by: Pedro Falcato  > >  >
> > > Cc: Vitaly Cheptsov  > >  >
> > > Cc: Marvin Häuser mailto:mhaeu...@posteo.de> >
> > > Cc: Michael D Kinney  > >  >
> > > Cc: Liming Gao  > >  >
> > > Cc: Zhiguang Liu mailto:zhiguang@intel.com> >
> > > ---
> > >  MdePkg/Library/BaseLib/SafeString.c | 24 
> > >  1 file changed, 20 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/MdePkg/Library/BaseLib/SafeString.c
> > b/MdePkg/Library/BaseLib/SafeString.c
> > > index f338a32a3a41..77a2585ad56d 100644
> > > --- a/MdePkg/Library/BaseLib/SafeString.c
> > > +++ b/MdePkg/Library/BaseLib/SafeString.c
> > > @@ -863,6 +863,9 @@ StrHexToUintnS (
> > >OUT   UINTN   *Data
> > >)
> > >  {
> > > +  BOOLEAN  FoundLeadingZero;
> > > +
> > > +  FoundLeadingZero = FALSE;
> > >ASSERT (((UINTN)String & BIT0) == 0);
> > >
> > >//
> > > @@ -893,11 +896,12 @@ StrHexToUintnS (
> > >// Ignore leading Zeros after the spaces
> > >//
> > >while (*String == L'0') {
> > > +FoundLeadingZero = TRUE;
> > >  String++;
> > >}
> > >
> > >if (CharToUpper (*String) == L'X') {
> > > -if (*(String - 1) != L'0') {
> > > +if (!FoundLeadingZero) {
> > >*Data = 0;
> > >return RETURN_SUCCESS;
> > >  }
> > > @@ -992,6 +996,9 @@ StrHexToUint64S (
> > >OUT   UINT64  *Data
> > >)
> > >  {
> > > +  BOOLEAN  FoundLeadingZero;
> > > +
> > > +  FoundLeadingZero = FALSE;
> > >ASSERT (((UINTN)String & BIT0) == 0);
> > >
> > >//
> > > @@ -1022,11 +1029,12 @@ StrHexToUint64S (
> > >// Ignore leading Zeros after the spaces
> > >//
> > >while (*String == L'0') {
> > > +FoundLeadingZero = TRUE;
> > >  String++;
> > >}
> > >
> > >if (CharToUpper (*String) == L'X') {
> > > -if (*(String - 1) != L'0') {
> > > +if (!FoundLeadingZero) {
> > >*Data = 0;
> > >return RETURN_SUCCESS;
> > >  }
> > > @@ -2393,6 +2401,9 @@ AsciiStrHexToUintnS (
> > >OUT   UINTN  *Data
> > >)
> > >  {
> > > +  BOOLEAN  FoundLeadingZero;
> > > +
> > > +  FoundLeadingZero = FALSE;
> > >//
> > > 

Re: [edk2-devel] How to add a DXE driver to an OVMF image?

2022-11-02 Thread Pedro Falcato
Hi!

If I recall correctly, UEFI drivers are not guaranteed to have a valid
ConOut and ConIn, and you're not supposed to use those. They are (always?)
valid in UEFI apps.
Can you try to use DebugLib (don't forget to place DebugLib in
LibraryClasses) and DEBUG((DEBUG_INFO, "Blah\n")); ? That should pretty
much work. Note that OVMF will send those debug messages to a special
device, so you can pass "-debugcon file:debug.log -global
isa-debugcon.iobase=0x402" to QEMU to keep them. The rest of your procedure
looks mostly OK as far as I can tell.

Crash theory: ConOut was garbage, so you tried to jump into a random
address. Random address had random data/instructions in there, which caused
you an int 6 -> Invalid opcode.

Thanks,
Pedro

On Wed, Nov 2, 2022 at 2:02 PM d.meneses via groups.io  wrote:

> As detailed on this post on Super User
> , I am trying to *add a DXE
> driver to an OVMF image* I'm building with edk2. Nobody was able to help
> me there so I turn here for your help.
>
> I haven't found any proper documentation on exactly what I'm trying to
> achieve so I am probably missing something.
>
> So far what I have done is:
>
>- create the simplest DXE driver I managed
>
> In folder *MdeModulePkg/Application/Hello*, I have:
> *Hello.c* :
> include
>
> ...
>
> while (1)
> SystemTable->ConOut->OutputString(SystemTable->ConOut,
>   L"It works!\n");
> return EFI_SUCCESS;
>
>
> *Hello.inf* :
> [Defines]
>   INF_VERSION= 0x00010005
>   BASE_NAME  = Hello
>   FILE_GUID  = ...
>   MODULE_TYPE= DXE_DRIVER
>   VERSION_STRING = 1.0
>   ENTRY_POINT= UefiMain
>
>
> [Sources]
>   Hello.c
>
> [Packages]
>   MdePkg/MdePkg.dec
>   MdeModulePkg/MdeModulePkg.dec
>
> [LibraryClasses]
>   UefiDriverEntryPoint
>   UefiLib
>
> [Depex]
> TRUE
>
>- Set *OvmfPkg/OvmfPkgX64.dsc* as my target platform with *GCC5* as
>the toolchain
>- Add *MdeModulePkg/Application/Hello/Hello.inf* to the end of the
>component section (I have tried to add it after other certain drivers) in
>the *.dsc* file.
>- Add *Mde**ModulePkg/Application/Hello/Hello.inf* to the end of the
>*[FV.DXEFV**]* section in *OvmfPkgX64.fdf* (I have also tried to add
>it after other certain drivers)
>- Run *build*
>- Run *QEMU* with the resulting *OVMF* image: *qemu-system-x86_64** -d
>int -D log.txt  -bios OVMF.fd -net none -drive
>file=fat:rw:bootdrv,format=raw*
>- *QEMU* hangs with message *"Guest has not initialized display (yet)"*
>- *log.txt* has one log: *check_exception old: 0x new 0x6*
>
>
> 
>
>

-- 
Pedro Falcato


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95873): https://edk2.groups.io/g/devel/message/95873
Mute This Topic: https://groups.io/mt/94734592/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] IntelFsp2Pkg: FSP should support input UPD as NULL.

2022-11-02 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Chiu, Chasel  
Sent: Tuesday, November 1, 2022 10:46 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Zeng, Star 
Subject: [PATCH v2] IntelFsp2Pkg: FSP should support input UPD as NULL.

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

FSP specification supports input UPD as NULL cases which FSP will use built-in 
UPD region instead.
FSP should not return INVALID_PARAMETER in such cases.

In FSP-T entry point case, the valid FSP-T UPD region pointer will be passed to 
platform FSP code to consume.
In FSP-M and FSP-S cases, valid UPD pointer will be decided when updating 
corresponding pointer field in FspGlobalData.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/SecFspApiChk.c | 12 ++--
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm | 73 
+++--
 IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm  | 40 
++--
 3 files changed, 91 insertions(+), 34 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c 
b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
index a44fbf2a50..5f59938518 100644
--- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
+++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
@@ -44,6 +44,8 @@ FspApiCallingCheck (
 // if (((UINTN)FspData != MAX_ADDRESS) && ((UINTN)FspData != 
MAX_UINT32)) {   Status = EFI_UNSUPPORTED;+} else if (ApiParam == NULL) 
{+  Status = EFI_SUCCESS; } else if (EFI_ERROR (FspUpdSignatureCheck 
(ApiIdx, ApiParam))) {   Status = EFI_INVALID_PARAMETER; }@@ -67,9 
+69,13 @@ FspApiCallingCheck (
 } else {   if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {  
   Status = EFI_UNSUPPORTED;-  } else if (EFI_ERROR (FspUpdSignatureCheck 
(FspSiliconInitApiIndex, ApiParam))) {-Status = EFI_INVALID_PARAMETER;  
 } else if (ApiIdx == FspSiliconInitApiIndex) {+if (ApiParam == 
NULL) {+  Status = EFI_SUCCESS;+} else if (EFI_ERROR 
(FspUpdSignatureCheck (FspSiliconInitApiIndex, ApiParam))) {+  Status = 
EFI_INVALID_PARAMETER;+}+ // // Reset MultiPhase 
NumberOfPhases to zero //@@ -89,6 +95,8 @@ FspApiCallingCheck (
 } else {   if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {  
   Status = EFI_UNSUPPORTED;+  } else if (ApiParam == NULL) {+
Status = EFI_SUCCESS;   } else if (EFI_ERROR (FspUpdSignatureCheck 
(FspSmmInitApiIndex, ApiParam))) { Status = EFI_INVALID_PARAMETER;  
 }diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm 
b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
index 61030a843b..73821ad22a 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
@@ -21,7 +21,7 @@ extern   ASM_PFX(PcdGet32 (PcdFspReservedBufferSize))
 ; Following functions will be provided in PlatformSecLib ; extern 
ASM_PFX(AsmGetFspBaseAddress)-extern ASM_PFX(AsmGetFspInfoHeader)+extern 
ASM_PFX(AsmGetFspInfoHeaderNoStack) ;extern ASM_PFX(LoadMicrocode); @todo: 
needs a weak implementation extern ASM_PFX(SecPlatformInit)   ; @todo: needs a 
weak implementation extern ASM_PFX(SecCarInit)@@ -160,6 +160,47 @@ endstruc
  RET_ESI_EXT   mm7 %endmacro +%macro CALL_EDI  1++  mov edi,  
%%ReturnAddress+  jmp %1+%%ReturnAddress:++%endmacro++%macro CALL_EBP 1+  
mov ebp, %%ReturnAddress+  jmp %1+%%ReturnAddress:+%endmacro++%macro 
RET_EBP 0+  jmp ebp   ; restore EIP from 
EBP+%endmacro++;+; Load UPD region pointer in ECX+;+global 
ASM_PFX(LoadUpdPointerToECX)+ASM_PFX(LoadUpdPointerToECX):+  ;+  ; esp + 4 is 
input UPD parameter+  ; If esp + 4 is NULL the default UPD should be used+  ; 
ecx will be the UPD region that should be used+  ;+  mov   ecx, dword [esp 
+ 4]+  cmp   ecx, 0+  jnz   ParamValid++  ;+  ; Fall back to default 
UPD region+  ;+  CALL_EDI  ASM_PFX(AsmGetFspInfoHeaderNoStack)+  mov   ecx, 
DWORD [eax + 01Ch]  ; Read FsptImageBaseAddress+  add   ecx, DWORD [eax 
+ 024h]  ; Get Cfg Region base address = FsptImageBaseAddress + 
CfgRegionOffset+ParamValid:+  RET_EBP+ ; ; @todo: The strong/weak 
implementation does not work. ;This needs to be reviewed later.@@ 
-187,10 +228,9 @@ endstruc
 global ASM_PFX(LoadMicrocodeDefault) ASM_PFX(LoadMicrocodeDefault):; 
Inputs:-   ;   esp -> LoadMicrocodeParams pointer+   ;   ecx -> UPD region 
contains LoadMicrocodeParams pointer; Register Usage:-   ;   esp  
Preserved-   ;   All others destroyed+   ;   All are destroyed; 
Assumptions:;   No memory available, stack is hard-coded and used for 
return address;   Executed by SBSP and NBSP@@ -201,12 +241,9 @@ 
ASM_PFX(LoadMicrocodeDefault):
;movd   ebp, mm7 +   movesp, ecx  ; ECX has been assigned to UPD 
regioncmpesp, 0  

Re: [edk2-devel] [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in SafeString

2022-11-02 Thread Pedro Falcato
Can someone push this? Is there a blocker here?

On Wed, Oct 26, 2022 at 4:54 PM Kinney, Michael D <
michael.d.kin...@intel.com> wrote:

> Acked-by: Michael D Kinney 
>
>
> > -Original Message-
> > From: Yao, Jiewen 
> > Sent: Wednesday, October 26, 2022 6:35 AM
> > To: Kinney, Michael D ; Pedro Falcato <
> pedro.falc...@gmail.com>; devel@edk2.groups.io
> > Cc: Vitaly Cheptsov ; Marvin Häuser <
> mhaeu...@posteo.de>; Gao, Liming ; Liu,
> > Zhiguang 
> > Subject: RE: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> SafeString
> >
> > That is good catch.
> >
> > Reviewed-by: Jiewen Yao 
> >
> >
> > > -Original Message-
> > > From: Kinney, Michael D 
> > > Sent: Wednesday, October 26, 2022 12:23 AM
> > > To: Pedro Falcato ; devel@edk2.groups.io
> > > Cc: Vitaly Cheptsov ; Marvin Häuser
> > > ; Gao, Liming ; Liu,
> > > Zhiguang ; Yao, Jiewen 
> > > Subject: RE: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> > > SafeString
> > >
> > > Adding Jiewen Yao.
> > >
> > > Mike
> > >
> > > > -Original Message-
> > > > From: Pedro Falcato 
> > > > Sent: Monday, October 24, 2022 3:43 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Pedro Falcato ; Vitaly Cheptsov
> > > ; Marvin Häuser ;
> > > > Kinney, Michael D ; Gao, Liming
> > > ; Liu, Zhiguang 
> > > > Subject: [PATCH v2 1/1] MdePkg/BaseLib: Fix out-of-bounds reads in
> > > SafeString
> > > >
> > > > OpenCore folks established an ASAN-equipped project to fuzz Ext4Dxe,
> > > > which was able to catch these (mostly harmless) issues.
> > > >
> > > > Signed-off-by: Pedro Falcato 
> > > > Cc: Vitaly Cheptsov 
> > > > Cc: Marvin Häuser 
> > > > Cc: Michael D Kinney 
> > > > Cc: Liming Gao 
> > > > Cc: Zhiguang Liu 
> > > > ---
> > > >  MdePkg/Library/BaseLib/SafeString.c | 24 
> > > >  1 file changed, 20 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/MdePkg/Library/BaseLib/SafeString.c
> > > b/MdePkg/Library/BaseLib/SafeString.c
> > > > index f338a32a3a41..77a2585ad56d 100644
> > > > --- a/MdePkg/Library/BaseLib/SafeString.c
> > > > +++ b/MdePkg/Library/BaseLib/SafeString.c
> > > > @@ -863,6 +863,9 @@ StrHexToUintnS (
> > > >OUT   UINTN   *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;
> > > > +
> > > > +  FoundLeadingZero = FALSE;
> > > >ASSERT (((UINTN)String & BIT0) == 0);
> > > >
> > > >//
> > > > @@ -893,11 +896,12 @@ StrHexToUintnS (
> > > >// Ignore leading Zeros after the spaces
> > > >//
> > > >while (*String == L'0') {
> > > > +FoundLeadingZero = TRUE;
> > > >  String++;
> > > >}
> > > >
> > > >if (CharToUpper (*String) == L'X') {
> > > > -if (*(String - 1) != L'0') {
> > > > +if (!FoundLeadingZero) {
> > > >*Data = 0;
> > > >return RETURN_SUCCESS;
> > > >  }
> > > > @@ -992,6 +996,9 @@ StrHexToUint64S (
> > > >OUT   UINT64  *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;
> > > > +
> > > > +  FoundLeadingZero = FALSE;
> > > >ASSERT (((UINTN)String & BIT0) == 0);
> > > >
> > > >//
> > > > @@ -1022,11 +1029,12 @@ StrHexToUint64S (
> > > >// Ignore leading Zeros after the spaces
> > > >//
> > > >while (*String == L'0') {
> > > > +FoundLeadingZero = TRUE;
> > > >  String++;
> > > >}
> > > >
> > > >if (CharToUpper (*String) == L'X') {
> > > > -if (*(String - 1) != L'0') {
> > > > +if (!FoundLeadingZero) {
> > > >*Data = 0;
> > > >return RETURN_SUCCESS;
> > > >  }
> > > > @@ -2393,6 +2401,9 @@ AsciiStrHexToUintnS (
> > > >OUT   UINTN  *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;
> > > > +
> > > > +  FoundLeadingZero = FALSE;
> > > >//
> > > >// 1. Neither String nor Data shall be a null pointer.
> > > >//
> > > > @@ -2421,11 +2432,12 @@ AsciiStrHexToUintnS (
> > > >// Ignore leading Zeros after the spaces
> > > >//
> > > >while (*String == '0') {
> > > > +FoundLeadingZero = TRUE;
> > > >  String++;
> > > >}
> > > >
> > > >if (AsciiCharToUpper (*String) == 'X') {
> > > > -if (*(String - 1) != '0') {
> > > > +if (!FoundLeadingZero) {
> > > >*Data = 0;
> > > >return RETURN_SUCCESS;
> > > >  }
> > > > @@ -2517,6 +2529,9 @@ AsciiStrHexToUint64S (
> > > >OUT   UINT64  *Data
> > > >)
> > > >  {
> > > > +  BOOLEAN  FoundLeadingZero;
> > > > +
> > > > +  FoundLeadingZero = FALSE;
> > > >//
> > > >// 1. Neither String nor Data shall be a null pointer.
> > > >//
> > > > @@ -2545,11 +2560,12 @@ AsciiStrHexToUint64S (
> > > >// Ignore leading Zeros after the spaces
> > > >//
> > > >while (*String == '0') {
> > > > +FoundLeadingZero = TRUE;
> > > >  String++;
> > > >}
> > > >
> > > >if (AsciiCharToUpper (*String) == 'X') {
> > > > -if (*(String - 1) != '0') {
> > > > +if (!FoundLeadingZero) {
> > > >*Data = 0;
> > > >return RETURN_SUCCESS;
> > > >  

Re: [edk2-devel] [PATCH] IntelFsp2Pkg: Update Function header to support IA32/X64.

2022-11-02 Thread Chiu, Chasel


Patch merged: 
https://github.com/tianocore/edk2/commit/c46204e25f5b929fae2b336c03c73fada632d4f4

Thanks,
Chasel


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chiu,
> Chasel
> Sent: Thursday, October 27, 2022 7:58 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Zeng, Star 
> Subject: [edk2-devel] [PATCH] IntelFsp2Pkg: Update Function header to
> support IA32/X64.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4126
> 
> Common functions will have either 32bit or 64bit instances which having
> different return code size. Function header should support both scenarios.
> 
> Cc: Nate DeSimone 
> Cc: Star Zeng 
> Signed-off-by: Chasel Chiu 
> ---
>  IntelFsp2Pkg/FspSecCore/SecFsp.h |  4 ++--
>  IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h | 12 ++--
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/FspSecCore/SecFsp.h
> b/IntelFsp2Pkg/FspSecCore/SecFsp.h
> index e84528b378..d7a5976c12 100644
> --- a/IntelFsp2Pkg/FspSecCore/SecFsp.h
> +++ b/IntelFsp2Pkg/FspSecCore/SecFsp.h
> @@ -70,7 +70,7 @@ FspDataPointerFixUp (
>@return   FSP binary base address.  **/-UINT32+UINTN EFIAPI
> AsmGetFspBaseAddress (   VOID@@ -82,7 +82,7 @@
> AsmGetFspBaseAddress (
>@return   FSP binary base address.  **/-UINT32+UINTN EFIAPI
> AsmGetFspInfoHeader (   VOIDdiff --git
> a/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h
> b/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h
> index c91ea4a78f..598fdb9ec5 100644
> --- a/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h
> +++ b/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h
> @@ -17,10 +17,10 @@
>The callee should not use XMM6/XMM7.   The return address is saved in
> MM7. -  @retval in saved in EAX - 0 means platform initialization success.+
> @retval in saved in EAX/RAX - 0 means platform initialization success.
> other means platform initialization fail. **/-UINT32+UINTN EFIAPI
> SecPlatformInit (   VOID@@ -37,10 +37,10 @@ SecPlatformInit (
> @param[in] FsptUpdDataPtr Address pointer to the FSPT_UPD data
> structure. It is saved in ESP. -  @retval in saved in EAX - 0 means Microcode
> is loaded successfully.+  @retval in saved in EAX/RAX - 0 means Microcode
> is loaded successfully. other means Microcode is 
> not loaded
> successfully. **/-UINT32+UINTN EFIAPI LoadMicrocode (   IN  VOID
> *FsptUpdDataPtr@@ -56,10 +56,10 @@ LoadMicrocode (
> @param[in] FsptUpdDataPtr Address pointer to the FSPT_UPD data
> structure. It is saved in ESP. -  @retval in saved in EAX - 0 means CAR
> initialization success.+  @retval in saved in EAX/RAX - 0 means CAR
> initialization success. other means CAR 
> initialization fail.
> **/-UINT32+UINTN EFIAPI SecCarInit (   IN  VOID  *FsptUpdDataPtr--
> 2.35.0.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#95662):
> https://edk2.groups.io/g/devel/message/95662
> Mute This Topic: https://groups.io/mt/94619463/1777047
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [chasel.c...@intel.com]
> -=-=-=-=-=-=
> 



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




Re: [edk2-devel] Making contributions to the EDK2 source

2022-11-02 Thread Michael D Kinney
This is a good page to reference.

https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process

Please let Miki or I know if you have any questions or if you think this 
documentation needs some clarifications.

Thanks,

Mike


From: devel@edk2.groups.io  On Behalf Of Robert Phelps 
via groups.io
Sent: Wednesday, November 2, 2022 8:40 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] Making contributions to the EDK2 source

Hi all,  I am sorry if this is a repeat, but I could not find or possibly 
decipher the instructions on how to contribute a patch.  I have followed the 
instructions on how to create the patches but cannot find the details on how to 
submit the patch.  It mentions submitting either by documentation from its 
website or sending to the development email list for the project.  It may be as 
simple as sending it to this email list but I wanted to make sure before doing 
so. Can someone either point me to the instructions that I missed or post those 
instruction so I can save them for this and future use.

Thanks in Advance,

Rob Phelps

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.



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




Re: [edk2-devel] [PATCH] CryptoPkg/Readme.md: typo and grammar fixes

2022-11-02 Thread Michael D Kinney
Hi Laszlo,

Thank you for all the updates.  One comment below.

Mike

> -Original Message-
> From: Laszlo Ersek 
> Sent: Wednesday, November 2, 2022 2:37 AM
> To: devel@edk2.groups.io; ler...@redhat.com
> Cc: Zurcher, Christopher ; Jiang, Guomin 
> ; Wang, Jian J
> ; Yao, Jiewen ; Kinney, Michael 
> D ; Lu, Xiaoyu1
> 
> Subject: [PATCH] CryptoPkg/Readme.md: typo and grammar fixes
> 
> Commit 244ce33bdd2f ("CryptoPkg: Add Readme.md", 2022-10-24) had added the
> long-awaited documentation on the dynamic crypto services. Fix some of the
> typos and arguable grammar errors in "Readme.md". A few light
> clarifications are also snuck in.
> 
> Cc: Christopher Zurcher 
> Cc: Guomin Jiang 
> Cc: Jian J Wang 
> Cc: Jiewen Yao 
> Cc: Michael D Kinney 
> Cc: Xiaoyu Lu 
> Signed-off-by: Laszlo Ersek 
> ---
> 
> Notes:
> Best displayed as a word-diff for review, for example with the command
> 
>   git show --word-diff
> 
> or on the web at
> 
>   
> https://pagure.io/lersek/edk2/c/a7269f170437?branch=cryptopkg_readme_typos
> 
>  CryptoPkg/Readme.md | 48 ++--
>  1 file changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/CryptoPkg/Readme.md b/CryptoPkg/Readme.md
> index 946aa1e99e7d..9dd3a951836b 100644
> --- a/CryptoPkg/Readme.md
> +++ b/CryptoPkg/Readme.md
> @@ -39,7 +39,7 @@ provides the smallest overall firmware overhead.
> 
>  ## Statically Linking Cryptographic Services
> 
> -The figure below shows an example of a firmware modules that requires the 
> use of
> +The figure below shows an example of a firmware module that requires the use 
> of
>  cryptographic services. The cryptographic services are provided by three 
> library
>  classes called BaseCryptLib, TlsLib, and HashApiLib. These library classes 
> are
>  implemented using APIs from the OpenSSL project that are abstracted by the
> @@ -49,7 +49,7 @@ full C runtime library for firmware components. Instead, 
> the CryptoPkg includes
>  the smallest subset of services required to build the OpenSSL project in the
>  private library class called IntrinsicLib.
> 
> -The CryptoPkg provides several instances if the BaseCryptLib and OpensslLib 
> with
> +The CryptoPkg provides several instances of the BaseCryptLib and OpensslLib 
> with
>  different cryptographic service features and performance optimizations. The
>  platform developer must select the correct instances based on cryptographic
>  service requirements in each UEFI/PI firmware phase (SEC, PEI, DXE, UEFI,
> @@ -97,9 +97,9 @@ linking is not available for SEC or UEFI RT modules.
> 
>  The EDK II modules/libraries that require cryptographic services use the same
>  BaseCryptLib/TlsLib/HashApiLib APIs. This means no source changes are 
> required
> -to use static linking or dynamic linking. It is a platform configuration 
> options
> -to select static linking or dynamic linking. This choice can be make 
> globally,
> -per firmware module type, or individual modules.
> +to use static linking or dynamic linking. It is a platform configuration 
> option
> +to select static linking or dynamic linking. This choice can be made 
> globally,
> +per firmware module type, or for individual modules.
> 
>  ```
>  +===++===+ +===+
> @@ -159,7 +159,7 @@ The table below provides a summary of the supported 
> cryptographic services. It
>  indicates if the family or service is deprecated or recommended to not be 
> used.
>  It also shows which *CryptLib library instances support the family or 
> service.
>  If a cell is blank then the service or family is always disabled and the
> -`PcdCryptoServiceFamilyEnable` settings for that family or service is 
> ignored.
> +`PcdCryptoServiceFamilyEnable` setting for that family or service is ignored.
>  If the cell is not blank, then the service or family is configurable using
>  `PcdCryptoServiceFamilyEnable` as long as the correct OpensslLib or TlsLib is
>  also configured.
> @@ -234,10 +234,10 @@ phases (SEC, PEI, DXE, UEFI, SMM, UEFI RT).
> 
>  The following table can be used to help select the best OpensslLib instance 
> for
>  each phase. The Size column only shows the estimated size increase for a
> -compressed IA32/X64 modules that uses the cryptographic services with
> +compressed IA32/X64 module that uses the cryptographic services with
>  `OpensslLib.inf` as the baseline size. The actual size increase depends on 
> the
>  specific set of enabled cryptographic services. If ECC services are not
> -required, then size can be reduced by using OpensslLib.inf instead of
> +required, then the size can be reduced by using OpensslLib.inf instead of
>  `OpensslLibFull.inf`. Performance optimization requires a size increase.
> 
>  | OpensslLib Instance | SSL | ECC | Perf Opt | CPU Arch | Size  |
> @@ -371,10 +371,10 @@ settings.
> 
>  ### UEFI Runtime Driver Library Mappings
> 
> -UEFI Runtime Drivers only supports static linking of cryptographic services.
> -The following 

Re: [edk2-devel] [PATCH 8/8] Maintainers: Update the VmgExitLib to CcExitLib

2022-11-02 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Xu, Min M 
> Sent: Tuesday, November 1, 2022 10:11 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M ; Kinney, Michael D 
> ; Gao, Liming ;
> Aktas, Erdem ; Gerd Hoffmann ; 
> James Bottomley ; Yao, Jiewen
> ; Tom Lendacky 
> Subject: [PATCH 8/8] Maintainers: Update the VmgExitLib to CcExitLib
> 
> From: Min M Xu 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123
> 
> VmgExitLib is renamed as CcExitLib. The related section in
> Maintainers.txt should be updated as well.
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Erdem Aktas 
> Cc: Gerd Hoffmann 
> Cc: James Bottomley 
> Cc: Jiewen Yao 
> Cc: Tom Lendacky 
> Signed-off-by: Min Xu 
> ---
>  Maintainers.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 889990fa566f..454b93420da4 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -475,7 +475,7 @@ F: OvmfPkg/Include/Library/MemEncryptSevLib.h
>  F: OvmfPkg/IoMmuDxe/AmdSevIoMmu.*
>  F: OvmfPkg/Library/BaseMemEncryptSevLib/
>  F: OvmfPkg/Library/PlatformBootManagerLibGrub/
> -F: OvmfPkg/Library/VmgExitLib/
> +F: OvmfPkg/Library/CcExitLib/
>  F: OvmfPkg/PlatformPei/AmdSev.c
>  F: OvmfPkg/ResetVector/
>  F: OvmfPkg/Sec/
> --
> 2.29.2.windows.2



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




Re: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi profile sync protocol support

2022-11-02 Thread Clark-williams, Zachary
Hey Maciej,

I can understand that and appreciate the attention you can spare for reviewing 
this change. 
If there are any peers you know who can/will want to review or have valuable 
input on this PR please feel free to send them an invite to review.

Thanks,
Zack

-Original Message-
From: Rabeda, Maciej  
Sent: Wednesday, November 2, 2022 5:35 AM
To: Clark-williams, Zachary ; Zimmer, Vincent 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Wu, Jiaxin 
; Otcheretianski, Andrei 
; Kasbekar, Saloni 
; Kinney, Michael D 
Cc: Alappat, Paul ; Patil, Ajit 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

@Kinney, Michael D
With the amount of work around IPUs, I can hardly spare time (maybe 2h/week on 
average - including code).
My time for EDK2 is currently fully allocated to:
1. https://github.com/tianocore/edk2-staging/tree/HttpProxy (@Kasbekar, Saloni) 
2. NVMe-oF boot prototype under nvme.org umbrella (@Zimmer, Vincent)

@Clark-williams, Zachary
Your patch is non-trivial and requires understanding on my side. Based on that 
and the above, this will take time.

-Original Message-
From: Clark-williams, Zachary 
Sent: Tuesday, November 1, 2022 6:41 PM
To: Zimmer, Vincent ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Wu, Jiaxin 
; Otcheretianski, Andrei 
Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

Great thank you Vincent, I will add them to the protocol header file and send 
an updated patch today.

-Original Message-
From: Zimmer, Vincent 
Sent: Tuesday, November 1, 2022 10:39 AM
To: Clark-williams, Zachary ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Wu, Jiaxin 
; Otcheretianski, Andrei 
Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

That's great
If these links are not already in the .h files of the patch I'd add them.
Typically the uefi networking code leverages uefi spec or ietf rfc's or other 
public collateral.  Letting folks know the background of these interfaces with 
a reference should help consumers IMHO Vincent

-Original Message-
From: Clark-williams, Zachary 
Sent: Tuesday, November 1, 2022 10:35 AM
To: Zimmer, Vincent ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Wu, Jiaxin 
; Otcheretianski, Andrei 
Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

Hey Vincent,

The documentation for describing the features in the PR description can be 
found in the CSME documentation found on the public accessible intel link below.

OCR - 
https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Foneclickrecovery.htm

KVM - 
https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Foneclickrecovery.htm

Thanks,
Zack

-Original Message-
From: Zimmer, Vincent 
Sent: Monday, October 31, 2022 2:16 PM
To: Clark-williams, Zachary 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

Quick question

Are the features described in " Enables KVM and One Click Recovery WLAN 
capability with WiFi Profile Sync feature and protocol. Adding 
WiFiProfileSyncProtocol, which supports the profilesync driver operations for 
transferring WiFi profiles from AMT to the Supplicant. WiFiConnectionManager 
will check for the WifiProfileSyncProtocol and if found will operate on the 
premise of a One Click Recovery, or KVM flow with a Wifi profile provided by 
AMT." in a public document?  Things like concept of profile sync?  I'm guessing 
they are since Linux probably does the same in the intel iwl driver?

Vincent

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Clark-williams, 
Zachary
Sent: Monday, October 31, 2022 12:31 PM
To: Kinney, Michael D ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; 'Fu, Siyuan' 
; Wu, Jiaxin ; Otcheretianski, Andrei 

Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: Re: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

++ visibility

-Original Message-
From: Clark-williams, Zachary
Sent: Friday, October 28, 2022 1:13 PM
To: Kinney, Michael D ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Fu, Siyuan 
; Wu, Jiaxin ; Otcheretianski, Andrei 

Subject: RE: [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi profile sync 

[edk2-devel] Making contributions to the EDK2 source

2022-11-02 Thread Robert Phelps via groups.io
Hi all,  I am sorry if this is a repeat, but I could not find or possibly 
decipher the instructions on how to contribute a patch.  I have followed the 
instructions on how to create the patches but cannot find the details on how to 
submit the patch.  It mentions submitting either by documentation from its 
website or sending to the development email list for the project.  It may be as 
simple as sending it to this email list but I wanted to make sure before doing 
so. Can someone either point me to the instructions that I missed or post those 
instruction so I can save them for this and future use.

Thanks in Advance,

Rob Phelps

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH v1 1/1] MiscBootServices: Stall_Func: Reduces the stall interval for Stall_Func

2022-11-02 Thread G Edhaya Chandran
Thank you Samer for creating the ticket on Bugzilla.

The next step by the forum is to build SCT with the patch at 
devel@edk2.groups.io | [PATCH v1 1/1] MiscBootServices: Stall_Func: Reduces the 
stall interval for Stall_Func ( 
https://edk2.groups.io/g/devel/topic/94007106#94539 )

and run regression on three reference hardwares. Once verified, we will 
upstream the patch.


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




[edk2-devel] How to add a DXE driver to an OVMF image?

2022-11-02 Thread d.meneses via groups.io
As detailed on this post on Super User ( 
https://superuser.com/q/1749795/1742482 ) , I am trying to *add a DXE driver to 
an OVMF image* I'm building with edk2. Nobody was able to help me there so I 
turn here for your help.

I haven't found any proper documentation on exactly what I'm trying to achieve 
so I am probably missing something.

So far what I have done is:

* create the simplest DXE driver I managed

In folder *MdeModulePkg/Application/Hello* , I have:
*Hello.c* :
include

...

while ( 1 )
SystemTable -> ConOut -> OutputString ( SystemTable ->ConOut,
L " It works! \n " );
return EFI_SUCCESS ;

*Hello.inf* :
[ Defines ]
INF_VERSION = 0x00010005
BASE_NAME = Hello
FILE_GUID =...
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = UefiMain

[ Sources ]
Hello.c

[ Packages ]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec

[ LibraryClasses ]
UefiDriverEntryPoint
UefiLib

[ Depex ]
TRUE

* Set *OvmfPkg/OvmfPkgX64.dsc* as my target platform with *GCC5* as the 
toolchain
* Add *MdeModulePkg/Application/Hello/Hello.inf* to the end of the component 
section (I have tried to add it after other certain drivers) in the *.dsc* file.
* 
Add *Mde* *ModulePkg/Application/Hello/Hello.inf* to the end of the *[ 
FV.DXEFV* *]* section in *OvmfPkgX64.fdf* (I have also tried to add it after 
other certain drivers)

* 
Run *build*

* 
Run *QEMU* with the resulting *OVMF* image: *qemu-system-x86_64* *-d int -D 
log.txt -bios OVMF.fd -net none -drive file=fat:rw:bootdrv, format=raw*

* 
*QEMU* hangs with message *"Guest has not initialized display (yet)"*

* 
*log.txt* has one log: *check_exception old: 0x new 0x6*


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




[edk2-devel] Event: TianoCore edk2-test Bug Triage Meeting - 11/03/2022 #cal-reminder

2022-11-02 Thread Group Notification
*Reminder: TianoCore edk2-test Bug Triage Meeting*

*When:*
11/03/2022
10:00pm to 11:00pm
(UTC+08:00) Asia/Shanghai

*Where:*
https://armltd.zoom.us/j/91247522013?pwd=ei9nUndTbG9oWEROS2M1aVREZkpiQT09=addon

*Organizer:* Edhaya Chandran edhaya.chand...@arm.com ( 
edhaya.chand...@arm.com?subject=Re:%20Event:%20TianoCore%20edk2-test%20Bug%20Triage%20Meeting
 )

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1621541 )

*Description:*


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




Re: [edk2-devel] [PATCH v1 1/1] MiscBootServices: Stall_Func: Reduces the stall interval for Stall_Func

2022-11-02 Thread Samer El-Haj-Mahmoud
BZ ticket created: https://bugzilla.tianocore.org/show_bug.cgi?id=4105

Patch was at: https://edk2.groups.io/g/discuss/message/1115


From: devel@edk2.groups.io  On Behalf Of G Edhaya 
Chandran via groups.io
Sent: Thursday, October 6, 2022 10:37 AM
To: Robert Wood ; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH v1 1/1] MiscBootServices: Stall_Func: Reduces 
the stall interval for Stall_Func

On Fri, Sep 30, 2022 at 05:28 AM, Robert Wood wrote:
MiscBootServicesBBTestFunction.c
Hi Robert,

   Can you please also raise a Bugzilla ticket for this issue here: Bug List 
(tianocore.org)
Please do attach the failure logs in the ticket.

This issue was discussed in the forum. May we know how the value of 400 was 
arrived for the new Stall value?

With Warm Regards,
Edhay

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.


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




Re: [edk2-devel] [PATCH 3/8] UefiCpuPkg: Use CcExitLib instead of VmgExitLib

2022-11-02 Thread Lendacky, Thomas via groups.io

On 11/2/22 00:10, Min Xu wrote:

From: Min M Xu 

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

VmgExitLib once was designed to provide interfaces to support #VC handler
and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
introduced, this library is updated to support #VE as well. Now the name
of VmgExitLib cannot reflect what the lib does. So VmgExitLib is replaced
by CcExitLib.


I get a build failure when building this patch:

build.py...
/root/kernels/ovmf-build-X64/OvmfPkg/OvmfPkgX64.dsc(...): error 4000: Instance 
of library class [CcExitLib] is not found
in 
[/root/kernels/ovmf-build-X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf]
 [X64]
consumed by module 
[/root/kernels/ovmf-build-X64/OvmfPkg/Sec/SecMain.inf]

- Failed -

Thanks,
Tom



Cc: Eric Dong 
Cc: Ray Ni 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Tom Lendacky 
Signed-off-by: Min Xu 
---
  .../DxeCpuExceptionHandlerLib.inf  |  2 +-
  .../PeiCpuExceptionHandlerLib.inf  |  2 +-
  .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c |  6 +++---
  .../CpuExceptionHandlerLib/SecPeiCpuException.c|  6 +++---
  .../SecPeiCpuExceptionHandlerLib.inf   |  2 +-
  .../SmmCpuExceptionHandlerLib.inf  |  2 +-
  .../Xcode5SecPeiCpuExceptionHandlerLib.inf |  2 +-
  UefiCpuPkg/Library/MpInitLib/AmdSev.c  | 10 +-
  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf  |  2 +-
  UefiCpuPkg/Library/MpInitLib/DxeMpLib.c|  8 
  UefiCpuPkg/Library/MpInitLib/MpLib.c   |  2 +-
  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf  |  2 +-
  UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c  | 10 +-
  UefiCpuPkg/UefiCpuPkg.dsc  |  2 ++
  14 files changed, 30 insertions(+), 28 deletions(-)

diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
index e7a81bebdb13..d0f82095cf92 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
@@ -60,4 +60,4 @@
PeCoffGetEntryPointLib
MemoryAllocationLib
DebugLib
-  VmgExitLib
+  CcExitLib
diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
index 7c2ec3b2db4c..5339f8e60404 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
@@ -52,7 +52,7 @@
HobLib
MemoryAllocationLib
SynchronizationLib
-  VmgExitLib
+  CcExitLib
  
  [Pcd]

gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard# CONSUMES
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
index a7d0897ef1f9..748cf8d3bfc6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
  **/
  
  #include 

-#include 
+#include 
  #include "CpuExceptionCommon.h"
  
  /**

@@ -40,7 +40,7 @@ CommonExceptionHandlerWorker (
//   On other   - ExceptionType contains (possibly new) exception
//value
//
-  Status = VmgExitHandleVc (, SystemContext);
+  Status = CcExitHandleVc (, SystemContext);
if (!EFI_ERROR (Status)) {
  return;
}
@@ -57,7 +57,7 @@ CommonExceptionHandlerWorker (
//   On other   - ExceptionType contains (possibly new) exception
//value
//
-  Status = VmTdExitHandleVe (, SystemContext);
+  Status = CcExitHandleVe (, SystemContext);
if (!EFI_ERROR (Status)) {
  return;
}
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
index ad5e0e9ed4f1..497cd1649930 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
  **/
  
  #include 

-#include 
+#include 
  #include "CpuExceptionCommon.h"
  
  CONST UINTN  mDoFarReturnFlag = 0;

@@ -39,7 +39,7 @@ CommonExceptionHandler (
//   On other   - ExceptionType contains (possibly new) exception
//value
//
-  Status = VmgExitHandleVc (, SystemContext);
+  Status = CcExitHandleVc (, SystemContext);
if (!EFI_ERROR (Status)) {
  return;
}
@@ 

Re: [edk2-devel] [PATCH 3/8] UefiCpuPkg: Use CcExitLib instead of VmgExitLib

2022-11-02 Thread Lendacky, Thomas via groups.io




On 11/2/22 08:17, Tom Lendacky wrote:

On 11/2/22 00:10, Min Xu wrote:

From: Min M Xu 

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

VmgExitLib once was designed to provide interfaces to support #VC handler
and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
introduced, this library is updated to support #VE as well. Now the name
of VmgExitLib cannot reflect what the lib does. So VmgExitLib is replaced
by CcExitLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Tom Lendacky 
Signed-off-by: Min Xu 
---
  .../DxeCpuExceptionHandlerLib.inf  |  2 +-
  .../PeiCpuExceptionHandlerLib.inf  |  2 +-
  .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c |  6 +++---
  .../CpuExceptionHandlerLib/SecPeiCpuException.c    |  6 +++---
  .../SecPeiCpuExceptionHandlerLib.inf   |  2 +-
  .../SmmCpuExceptionHandlerLib.inf  |  2 +-
  .../Xcode5SecPeiCpuExceptionHandlerLib.inf |  2 +-
  UefiCpuPkg/Library/MpInitLib/AmdSev.c  | 10 +-
  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf  |  2 +-
  UefiCpuPkg/Library/MpInitLib/DxeMpLib.c    |  8 
  UefiCpuPkg/Library/MpInitLib/MpLib.c   |  2 +-
  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf  |  2 +-
  UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c  | 10 +-
  UefiCpuPkg/UefiCpuPkg.dsc  |  2 ++
  14 files changed, 30 insertions(+), 28 deletions(-)




diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 0e1a99ddc09f..57c74ba844d2 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -60,6 +60,7 @@

PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf

TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf

    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf


Should you be deleting the VmgExitLibNull reference now? Or is this to 
handle issues with the edk2-platforms tree? If so, when will this be 
removed and VmgExitLibNull deleted?


Ah, never mind... for some reason patch #7 didn't make it to my Inbox so I 
missed that.


Thanks,
Tom



Thanks,
Tom


+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
    MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf

SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf

    CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
@@ -164,6 +165,7 @@
    UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
    UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf
    UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
    UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
    UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf
    UefiCpuPkg/SecCore/SecCore.inf



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




Re: [edk2-devel] [PATCH 3/8] UefiCpuPkg: Use CcExitLib instead of VmgExitLib

2022-11-02 Thread Lendacky, Thomas via groups.io

On 11/2/22 00:10, Min Xu wrote:

From: Min M Xu 

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

VmgExitLib once was designed to provide interfaces to support #VC handler
and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
introduced, this library is updated to support #VE as well. Now the name
of VmgExitLib cannot reflect what the lib does. So VmgExitLib is replaced
by CcExitLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Tom Lendacky 
Signed-off-by: Min Xu 
---
  .../DxeCpuExceptionHandlerLib.inf  |  2 +-
  .../PeiCpuExceptionHandlerLib.inf  |  2 +-
  .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c |  6 +++---
  .../CpuExceptionHandlerLib/SecPeiCpuException.c|  6 +++---
  .../SecPeiCpuExceptionHandlerLib.inf   |  2 +-
  .../SmmCpuExceptionHandlerLib.inf  |  2 +-
  .../Xcode5SecPeiCpuExceptionHandlerLib.inf |  2 +-
  UefiCpuPkg/Library/MpInitLib/AmdSev.c  | 10 +-
  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf  |  2 +-
  UefiCpuPkg/Library/MpInitLib/DxeMpLib.c|  8 
  UefiCpuPkg/Library/MpInitLib/MpLib.c   |  2 +-
  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf  |  2 +-
  UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c  | 10 +-
  UefiCpuPkg/UefiCpuPkg.dsc  |  2 ++
  14 files changed, 30 insertions(+), 28 deletions(-)




diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 0e1a99ddc09f..57c74ba844d2 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -60,6 +60,7 @@

PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf

TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf


Should you be deleting the VmgExitLibNull reference now? Or is this to 
handle issues with the edk2-platforms tree? If so, when will this be 
removed and VmgExitLibNull deleted?


Thanks,
Tom


+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf

SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf
CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
@@ -164,6 +165,7 @@
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf
UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf
UefiCpuPkg/SecCore/SecCore.inf



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




Re: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi profile sync protocol support

2022-11-02 Thread Rabeda, Maciej
@Kinney, Michael D
With the amount of work around IPUs, I can hardly spare time (maybe 2h/week on 
average - including code).
My time for EDK2 is currently fully allocated to:
1. https://github.com/tianocore/edk2-staging/tree/HttpProxy (@Kasbekar, Saloni)
2. NVMe-oF boot prototype under nvme.org umbrella (@Zimmer, Vincent)

@Clark-williams, Zachary
Your patch is non-trivial and requires understanding on my side. Based on that 
and the above, this will take time.

-Original Message-
From: Clark-williams, Zachary  
Sent: Tuesday, November 1, 2022 6:41 PM
To: Zimmer, Vincent ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Wu, Jiaxin 
; Otcheretianski, Andrei 
Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

Great thank you Vincent, I will add them to the protocol header file and send 
an updated patch today.

-Original Message-
From: Zimmer, Vincent 
Sent: Tuesday, November 1, 2022 10:39 AM
To: Clark-williams, Zachary ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Wu, Jiaxin 
; Otcheretianski, Andrei 
Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

That's great
If these links are not already in the .h files of the patch I'd add them.
Typically the uefi networking code leverages uefi spec or ietf rfc's or other 
public collateral.  Letting folks know the background of these interfaces with 
a reference should help consumers IMHO Vincent

-Original Message-
From: Clark-williams, Zachary 
Sent: Tuesday, November 1, 2022 10:35 AM
To: Zimmer, Vincent ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Wu, Jiaxin 
; Otcheretianski, Andrei 
Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

Hey Vincent,

The documentation for describing the features in the PR description can be 
found in the CSME documentation found on the public accessible intel link below.

OCR - 
https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Foneclickrecovery.htm

KVM - 
https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Foneclickrecovery.htm

Thanks,
Zack

-Original Message-
From: Zimmer, Vincent 
Sent: Monday, October 31, 2022 2:16 PM
To: Clark-williams, Zachary 
Subject: RE: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

Quick question

Are the features described in " Enables KVM and One Click Recovery WLAN 
capability with WiFi Profile Sync feature and protocol. Adding 
WiFiProfileSyncProtocol, which supports the profilesync driver operations for 
transferring WiFi profiles from AMT to the Supplicant. WiFiConnectionManager 
will check for the WifiProfileSyncProtocol and if found will operate on the 
premise of a One Click Recovery, or KVM flow with a Wifi profile provided by 
AMT." in a public document?  Things like concept of profile sync?  I'm guessing 
they are since Linux probably does the same in the intel iwl driver?

Vincent

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Clark-williams, 
Zachary
Sent: Monday, October 31, 2022 12:31 PM
To: Kinney, Michael D ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; 'Fu, Siyuan' 
; Wu, Jiaxin ; Otcheretianski, Andrei 

Cc: Alappat, Paul ; Kasbekar, Saloni 
; Patil, Ajit 
Subject: Re: [edk2-devel] [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi 
profile sync protocol support

++ visibility

-Original Message-
From: Clark-williams, Zachary
Sent: Friday, October 28, 2022 1:13 PM
To: Kinney, Michael D ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io; Fu, Siyuan 
; Wu, Jiaxin ; Otcheretianski, Andrei 

Subject: RE: [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi profile sync 
protocol support

++More for reviewal!

-Original Message-
From: Clark-williams, Zachary
Sent: Friday, October 28, 2022 1:10 PM
To: Kinney, Michael D ; Rabeda, Maciej 
; Luo, Heng ; Kuo, Scottie 
; Kuo, Ted ; Dutkiewicz, Michal 
; devel@edk2.groups.io
Subject: RE: [PATCH v4] NetworkPkg/WifiProfileSync: Add WiFi profile sync 
protocol support

Thanks for the forward Mike!

Maciej and All, 

If you could please review the PR below. I would like to get this review 
completed within the week.

Thanks,
Zack

-Original Message-
From: Kinney, Michael D 
Sent: Thursday, October 27, 2022 1:09 PM
To: Rabeda, Maciej ; Kinney, Michael D 
; Clark-williams, Zachary 

Subject: FW: [PATCH v4] 

Re: [edk2-devel] [PATCH edk2-platforms 2/2] Maintainers.txt: update email address for Graeme Gregory

2022-11-02 Thread Leif Lindholm
On Tue, Nov 01, 2022 at 10:16:38 +, Graeme Gregory wrote:
> On Thu, Oct 27, 2022 at 12:05:09PM +0100, Leif Lindholm wrote:
> > From: Leif Lindholm 
> > 
> > Signed-off-by: Leif Lindholm 
> > Cc: Graeme Gregory 
> > Cc: Graeme Gregory 
> > Cc: Michael D Kinney 
> > Cc: Ard Biesheuvel 
> > ---
> >  Maintainers.txt | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Maintainers.txt b/Maintainers.txt
> > index 1a5b6828a867..bbf9c00c 100644
> > --- a/Maintainers.txt
> > +++ b/Maintainers.txt
> > @@ -355,7 +355,7 @@ F: Platform/Qemu/SbsaQemu/
> >  F: Silicon/Qemu/SbsaQemu/
> >  M: Ard Biesheuvel 
> >  M: Leif Lindholm 
> > -R: Graeme Gregory 
> > +R: Graeme Gregory 
> >  R: Radoslaw Biernacki 
> >  
> >  Raspberry Pi platforms and silicon
> 
> Acked-by: Graeme Gregory 

Thanks. Pushed as 03800a9e2241.

/
Leif



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




[edk2-devel] [PATCH] CryptoPkg/Readme.md: typo and grammar fixes

2022-11-02 Thread Laszlo Ersek
Commit 244ce33bdd2f ("CryptoPkg: Add Readme.md", 2022-10-24) had added the
long-awaited documentation on the dynamic crypto services. Fix some of the
typos and arguable grammar errors in "Readme.md". A few light
clarifications are also snuck in.

Cc: Christopher Zurcher 
Cc: Guomin Jiang 
Cc: Jian J Wang 
Cc: Jiewen Yao 
Cc: Michael D Kinney 
Cc: Xiaoyu Lu 
Signed-off-by: Laszlo Ersek 
---

Notes:
Best displayed as a word-diff for review, for example with the command

  git show --word-diff

or on the web at

  https://pagure.io/lersek/edk2/c/a7269f170437?branch=cryptopkg_readme_typos

 CryptoPkg/Readme.md | 48 ++--
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/CryptoPkg/Readme.md b/CryptoPkg/Readme.md
index 946aa1e99e7d..9dd3a951836b 100644
--- a/CryptoPkg/Readme.md
+++ b/CryptoPkg/Readme.md
@@ -39,7 +39,7 @@ provides the smallest overall firmware overhead.
 
 ## Statically Linking Cryptographic Services
 
-The figure below shows an example of a firmware modules that requires the use 
of
+The figure below shows an example of a firmware module that requires the use of
 cryptographic services. The cryptographic services are provided by three 
library
 classes called BaseCryptLib, TlsLib, and HashApiLib. These library classes are
 implemented using APIs from the OpenSSL project that are abstracted by the
@@ -49,7 +49,7 @@ full C runtime library for firmware components. Instead, the 
CryptoPkg includes
 the smallest subset of services required to build the OpenSSL project in the
 private library class called IntrinsicLib.
 
-The CryptoPkg provides several instances if the BaseCryptLib and OpensslLib 
with
+The CryptoPkg provides several instances of the BaseCryptLib and OpensslLib 
with
 different cryptographic service features and performance optimizations. The
 platform developer must select the correct instances based on cryptographic
 service requirements in each UEFI/PI firmware phase (SEC, PEI, DXE, UEFI,
@@ -97,9 +97,9 @@ linking is not available for SEC or UEFI RT modules.
 
 The EDK II modules/libraries that require cryptographic services use the same
 BaseCryptLib/TlsLib/HashApiLib APIs. This means no source changes are required
-to use static linking or dynamic linking. It is a platform configuration 
options
-to select static linking or dynamic linking. This choice can be make globally,
-per firmware module type, or individual modules.
+to use static linking or dynamic linking. It is a platform configuration option
+to select static linking or dynamic linking. This choice can be made globally,
+per firmware module type, or for individual modules.
 
 ```
 +===++===+ +===+
@@ -159,7 +159,7 @@ The table below provides a summary of the supported 
cryptographic services. It
 indicates if the family or service is deprecated or recommended to not be used.
 It also shows which *CryptLib library instances support the family or service.
 If a cell is blank then the service or family is always disabled and the
-`PcdCryptoServiceFamilyEnable` settings for that family or service is ignored.
+`PcdCryptoServiceFamilyEnable` setting for that family or service is ignored.
 If the cell is not blank, then the service or family is configurable using
 `PcdCryptoServiceFamilyEnable` as long as the correct OpensslLib or TlsLib is
 also configured.
@@ -234,10 +234,10 @@ phases (SEC, PEI, DXE, UEFI, SMM, UEFI RT).
 
 The following table can be used to help select the best OpensslLib instance for
 each phase. The Size column only shows the estimated size increase for a
-compressed IA32/X64 modules that uses the cryptographic services with
+compressed IA32/X64 module that uses the cryptographic services with
 `OpensslLib.inf` as the baseline size. The actual size increase depends on the
 specific set of enabled cryptographic services. If ECC services are not
-required, then size can be reduced by using OpensslLib.inf instead of
+required, then the size can be reduced by using OpensslLib.inf instead of
 `OpensslLibFull.inf`. Performance optimization requires a size increase.
 
 | OpensslLib Instance | SSL | ECC | Perf Opt | CPU Arch | Size  |
@@ -371,10 +371,10 @@ settings.
 
 ### UEFI Runtime Driver Library Mappings
 
-UEFI Runtime Drivers only supports static linking of cryptographic services.
-The following library mappings are recommended for UEFI Runtime Drivers. It 
uses
-the runtime specific version of the BaseCryptLib and the null version of the
-TlsLib because TLS services are not typically used in runtime.
+UEFI Runtime Drivers only support static linking of cryptographic services.
+The following library mappings are recommended for UEFI Runtime Drivers. They
+use the runtime specific version of the BaseCryptLib and the null version of 
the
+TlsLib because TLS services are not typically used at runtime.
 
 ```
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
@@ -388,13 +388,13 @@ TlsLib because TLS