Re: [edk2-devel] [PATCH 4/4] RedfishClientPkg: use Json value from a function argument

2024-02-20 Thread Nickle Wang via groups.io



Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, February 21, 2024 8:13 AM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin ; Abner Chang
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [PATCH 4/4] RedfishClientPkg: use Json value from a function argument
> 
> External email: Use caution opening links or attachments
> 
> 
> This patch replaces value Private->Json with Json used as second argument for
> RedfishIdentifyResource(). Currently Json argument is not used at all and the
> pattern for caller side is:
>   Status = RedfishIdentifyResourceCommon (Private, Private->Json);
> 
> So in scope of RedfishIdentifyResourceCommon Json actually is the same value 
> as
> Private->Json. Let's make code a bit cleaner.
> 
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Mike Maslenkin 
> ---
>  RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c   | 2 +-
>  .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c| 2 +-
>  .../ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c| 2 +-
>  .../ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c | 2 +-
>  RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c   | 2
> +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> index 0ae841499692..f3f993c8782e 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> @@ -729,7 +729,7 @@ RedfishIdentifyResourceCommon (
>EFI_STRING   EndOfChar;
> 
>REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
> 
> 
> 
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
> 
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
> 
>if (Supported) {
> 
>  Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION,
> REDPATH_ARRAY_PATTERN, );
> 
>  if (EFI_ERROR (Status)) {
> 
> diff --git
> a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.
> c
> b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.
> c
> index 0b9f2bf28434..f471c01c3790 100644
> ---
> a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.
> c
> +++
> b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommo
> +++ n.c
> @@ -791,7 +791,7 @@ RedfishIdentifyResourceCommon (  {
> 
>BOOLEAN  Supported;
> 
> 
> 
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
> 
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
> 
>if (Supported) {
> 
>  return EFI_SUCCESS;
> 
>}
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.c
> index cee6c8bf9ba1..d69fc176ad94 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.c
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSy
> +++ stemCommon.c
> @@ -848,7 +848,7 @@ RedfishIdentifyResourceCommon (
>EFI_STRING   EndOfChar;
> 
>REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
> 
> 
> 
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
> 
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
> 
>if (Supported) {
> 
>  Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION,
> REDPATH_ARRAY_PATTERN, );
> 
>  if (EFI_ERROR (Status)) {
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSyste
> mCommon.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSyste
> mCommon.c
> index a67ef3dac283..11bcb5f76cab 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSyste
> mCommon.c
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSys
> +++ temCommon.c
> @@ -1718,7 +1718,7 @@ RedfishIdentifyResourceCommon (
>EFI_STRING   EndOfChar;
> 
>REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
> 
> 
> 
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
> 
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
> 
>if (Supported) {
> 
>  Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION,
> REDPATH_ARRAY_PATTERN, );
> 
>  if (EFI_ERROR (Status)) {
> 
> diff --git
> a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
> b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
> index eb52c68c5dcb..00a69f748c3c 100644
> --- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
> 

Re: [edk2-devel] [PATCH 3/4] RedfishClientPkg/Bios: fix leak of GetPendingSettings URI.

2024-02-20 Thread Nickle Wang via groups.io



Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Mike
> Maslenkin via groups.io
> Sent: Wednesday, February 21, 2024 8:13 AM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin ; Abner Chang
> ; Nickle Wang ; Igor Kulchytskyy
> 
> Subject: [edk2-devel] [PATCH 3/4] RedfishClientPkg/Bios: fix leak of
> GetPendingSettings URI.
> 
> External email: Use caution opening links or attachments
> 
> 
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Mike Maslenkin 
> ---
>  RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> index 396ec22969b5..8548425c9c83 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> @@ -132,6 +132,7 @@ RedfishResourceConsumeResource (
>// Check and see if "@Redfish.Settings" exist or not.
> 
>//
> 
>ZeroMem (, sizeof (REDFISH_RESPONSE));
> 
> +  PendingSettingUri = NULL;
> 
>Status = GetPendingSettings (
> 
>   Private->RedfishService,
> 
>   Response.Payload,
> 
> @@ -206,6 +207,10 @@ RedfishResourceConsumeResource (
>  FreePool (Etag);
> 
>}
> 
> 
> 
> +  if (PendingSettingUri != NULL) {
> 
> +FreePool (PendingSettingUri);
> 
> +  }
> 
> +
> 
>return Status;
> 
>  }
> 
> 
> 
> --
> 2.32.0 (Apple Git-132)
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#115687): https://edk2.groups.io/g/devel/message/115687
> Mute This Topic: https://groups.io/mt/104479573/7129762
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [nick...@nvidia.com] -=-=-
> =-=-=-=
> 



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




Re: [edk2-devel] [PATCH 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback

2024-02-20 Thread Nickle Wang via groups.io
Hi Mike,



Thanks for incorporating my suggestion to address memory issue. For the name 
"CollectionUri", I know this is from my suggestion, but I think Abner is right. 
Could you please change it to "BiosUri" or "ResourceUri" since BIOS resource is 
not a Redfish collection?



@Abner Chang please comment here if you have other 
naming preference.



Thanks,

Nickle



> -Original Message-

> From: Mike Maslenkin 

> Sent: Wednesday, February 21, 2024 8:13 AM

> To: devel@edk2.groups.io

> Cc: Mike Maslenkin ; Nickle Wang

> ; Abner Chang ; Igor Kulchytskyy

> 

> Subject: [PATCH 2/4] RedfishClientPkg: refine

> RedfishExternalResourceResourceFeatureCallback

>

> External email: Use caution opening links or attachments

>

>

> Use local variable for CollectionUri passed to HandleResource() to avoid 
> problems

> in case of Private->Uri is overriden down the call stack.

>

> Suggested-by: Nickle Wang mailto:nick...@nvidia.com>>

> Cc: Abner Chang mailto:abner.ch...@amd.com>>

> Cc: Nickle Wang mailto:nick...@nvidia.com>>

> Cc: Igor Kulchytskyy mailto:ig...@ami.com>>

> Signed-off-by: Mike Maslenkin 
> mailto:mike.maslen...@gmail.com>>

> ---

>  RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++-

>  1 file changed, 6 insertions(+), 5 deletions(-)

>

> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c

> b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c

> index f40f2d85af80..396ec22969b5 100644

> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c

> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c

> @@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback (

>REDFISH_SERVICE  RedfishService;

>

>REDFISH_RESOURCE_COMMON_PRIVATE  *Private;

>

>EFI_STRING   ResourceUri;

>

> +  EFI_STRING   CollectionUri;

>

>

>

>if (FeatureAction != CallbackActionStartOperation) {

>

>  return EFI_UNSUPPORTED;

>

> @@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback (

>//

>

>// Initialize collection path

>

>//

>

> -  Private->Uri = RedfishGetUri (ResourceUri);

>

> -  if (Private->Uri == NULL) {

>

> +  CollectionUri = RedfishGetUri (ResourceUri);

>

> +  if (CollectionUri == NULL) {

>

>  ASSERT (FALSE);

>

>  FreePool (ResourceUri);

>

>  return EFI_OUT_OF_RESOURCES;

>

>}

>

>

>

> -  Status = HandleResource (Private, Private->Uri);

>

> +  Status = HandleResource (Private, CollectionUri);

>

>if (EFI_ERROR (Status)) {

>

> -DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r\n",

> __func__, Private->Uri, Status));

>

> +DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed:

> + %r\n", __func__, CollectionUri, Status));

>

>}

>

>

>

> -  FreePool (Private->Uri);

>

> +  FreePool (CollectionUri);

>

>FreePool (ResourceUri);

>

>return Status;

>

>  }

>

> --

> 2.32.0 (Apple Git-132)




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




Re: [edk2-devel] [PATCH 1/4] RedfishClientPkg/RedfishFeatureUtilityLib: fix memory leak on error path

2024-02-20 Thread Nickle Wang via groups.io


Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, February 21, 2024 8:13 AM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin ; Igor Kulchytskyy
> ; Nickle Wang ; Abner Chang
> 
> Subject: [PATCH 1/4] RedfishClientPkg/RedfishFeatureUtilityLib: fix memory 
> leak
> on error path
> 
> External email: Use caution opening links or attachments
> 
> 
> Cc: Igor Kulchytskyy 
> Cc: Nickle Wang 
> Signed-off-by: Mike Maslenkin 
> Reviewed-by: Abner Chang 
> ---
>  .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> index e1494471038c..21ce8ddad9d5 100644
> ---
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> +++
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> @@ -4010,6 +4010,7 @@ RedfishRemoveUnchangeableProperties (
>   (RedfishCS_uint32)AsciiStrSize (*JsonString)
> 
>   );
> 
>if (Status != RedfishCS_status_success) {
> 
> +FreePool (UpdatedJsonString);
> 
>  return EFI_DEVICE_ERROR;
> 
>}
> 
> 
> 
> --
> 2.32.0 (Apple Git-132)



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




Re: [edk2-devel] [PATCH v3 0/6] OvmfPkg: Add support for 5-level paging

2024-02-20 Thread Min Xu
On Tuesday, February 20, 2024 5:07 PM, Gerd Hoffmann wrote:
> Subject: [PATCH v3 0/6] OvmfPkg: Add support for 5-level paging
> 
> Patch #1 + #2 fix MdeModulePkg/DxeIplPeim to not assert in case a 5-level
> enabled build runs in 4-level paging mode.
> 
> Patch #2 - #4 update OvmfPkg ResetVector, adding support for 5-level paging
> (setup 5-level page tables in case both la57 and gigabyte pages are supported
> by the vCPU).
> 
> Patch #5 updates PlatformInitLib for 5-level paging support (update PhysBits
> calculation).
> 
> Known issues / limitations:
>  - BaseMemEncryptSevLib must be updated to also support 5-level
>paging for full 5-level paging support in SEV mode.
> 
> The patch series does *not* enable 5-level paging by default.
> Building with 5-level paging support can be done by compiling OVMF with '--
> pcd PcdUse5LevelPageTable=TRUE'.
> 
> v3:
>  - add resetvector fixes for sev and tdx
> v2 changes:
>  - fix sev/tdx handling with 5-level paging.
>  - more comments for 5-level page table setup.
>  - improve PAGE_* naming (new patch #3).
>  - rename Page5LevelSupported to Page5LevelEnabled (new patch #2).
>  - pick up some review tags.
> 
> Gerd Hoffmann (6):
>   MdeModulePkg/DxeIplPeim: fix PcdUse5LevelPageTable assert
>   MdeModulePkg/DxeIplPeim: rename variable
>   OvmfPkg/ResetVector: improve page table flag names
>   OvmfPkg/ResetVector: SEV: keep #vc handler installed longer
>   OvmfPkg/ResetVector: add 5-level paging support
>   OvmfPkg/PlatformInitLib: add 5-level paging support
> 
>  OvmfPkg/ResetVector/ResetVector.inf   |   1 +
>  .../Core/DxeIplPeim/X64/VirtualMemory.c   |  24 +--
>  OvmfPkg/Library/PlatformInitLib/MemDetect.c   |  57 --
>  OvmfPkg/ResetVector/Ia32/AmdSev.asm   |   7 +-
>  OvmfPkg/ResetVector/Ia32/IntelTdx.asm |  17 +-
>  OvmfPkg/ResetVector/Ia32/PageTables64.asm | 170 +++---
>  OvmfPkg/ResetVector/ResetVector.nasmb |   1 +
>  7 files changed, 224 insertions(+), 53 deletions(-)
> 

Test the patch-set in TDX (OvmfPkgX64 and Intel/IntelTdx) and both passed.

Tested-by: Min Xu 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115714): https://edk2.groups.io/g/devel/message/115714
Mute This Topic: https://groups.io/mt/104464306/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 3/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SwitchApContext()

2024-02-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: Gerd Hoffmann 
> Sent: Wednesday, February 21, 2024 1:50 AM
> To: devel@edk2.groups.io
> Cc: Oliver Steffen ; Laszlo Ersek
> ; Kumar, Rahul R ; Ni, Ray
> ; Gerd Hoffmann 
> Subject: [PATCH v2 3/5] UefiCpuPkg/MpInitLib: Add support for multiple
> HOBs to SwitchApContext()
> 
> Rename the MpHandOff parameter to FirstMpHandOff.  Add loops so the
> function inspects all HOBs present in the system.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.h |  2 +-
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 35 ++--
>  2 files changed, 24 insertions(+), 13 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> index bc2a0232291d..b5214b904b41 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> @@ -482,7 +482,7 @@ GetWakeupBuffer (
>  **/
>  VOID
>  SwitchApContext (
> -  IN MP_HAND_OFF  *MpHandOff
> +  IN CONST MP_HAND_OFF  *FirstMpHandOff
>);
> 
>  /**
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 8f198ff6d817..c13de34e5769 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1938,31 +1938,42 @@ GetBspNumber (
>This procedure allows the AP to switch to another section of
>memory and continue its loop there.
> 
> -  @param[in] MpHandOff  Pointer to MP hand-off data structure.
> +  @param[in] FirstMpHandOff  Pointer to first MP hand-off HOB.
>  **/
>  VOID
>  SwitchApContext (
> -  IN MP_HAND_OFF  *MpHandOff
> +  IN CONST MP_HAND_OFF  *FirstMpHandOff
>)
>  {
> -  UINTN   Index;
> -  UINT32  BspNumber;
> +  UINTN  Index;
> +  UINT32 BspNumber;
> +  CONST MP_HAND_OFF  *MpHandOff;
> 
> -  BspNumber = GetBspNumber (MpHandOff);
> +  BspNumber = GetBspNumber (FirstMpHandOff);
> 
> -  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> -if (Index != BspNumber) {
> -  *(UINTN
> *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress =
> (UINTN)SwitchContextPerAp;
> -  *(UINT32 *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress
> = MpHandOff->StartupSignalValue;
> +  for (MpHandOff = FirstMpHandOff;
> +   MpHandOff != NULL;
> +   MpHandOff = GetNextMpHandOffHob (MpHandOff))
> +  {
> +for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> +  if (MpHandOff->ProcessorIndex + Index != BspNumber) {
> +*(UINTN
> *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress =
> (UINTN)SwitchContextPerAp;
> +*(UINT32
> *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress   =
> MpHandOff->StartupSignalValue;
> +  }
>  }
>}
> 
>//
>// Wait all APs waken up if this is not the 1st broadcast of SIPI
>//
> -  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> -if (Index != BspNumber) {
> -  WaitApWakeup ((UINT32
> *)(UINTN)(MpHandOff->Info[Index].StartupSignalAddress));
> +  for (MpHandOff = FirstMpHandOff;
> +   MpHandOff != NULL;
> +   MpHandOff = GetNextMpHandOffHob (MpHandOff))
> +  {
> +for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> +  if (MpHandOff->ProcessorIndex + Index != BspNumber) {
> +WaitApWakeup ((UINT32
> *)(UINTN)(MpHandOff->Info[Index].StartupSignalAddress));
> +  }
>  }
>}
>  }
> --
> 2.43.2



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




Re: [edk2-devel] [PATCH] UefiCpuPkg: add volatile qualifier to page table related variable

2024-02-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: Zhou, Jianfeng 
> Sent: Wednesday, February 21, 2024 9:25 AM
> To: devel@edk2.groups.io
> Cc: Zhou, Jianfeng ; Ni, Ray ;
> Laszlo Ersek ; Kumar, Rahul R
> ; Gerd Hoffmann 
> Subject: [PATCH] UefiCpuPkg: add volatile qualifier to page table related
> variable
> 
> Add volatile qualifier to page table related variable to prevent
> compiler from optimizing away the variables which may lead to
> unexpected result.
> 
> Signed-off-by: Zhou Jianfeng 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> ---
>  UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 12
> ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> index 2ea40666cc..5cf6e8fea0 100644
> --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> @@ -26,7 +26,7 @@ PageTableLibSetPte4K (
>IN IA32_MAP_ATTRIBUTE  *Mask
> 
>)
> 
>  {
> 
> -  IA32_PTE_4K  LocalPte4K;
> 
> +  volatile IA32_PTE_4K  LocalPte4K;
> 
> 
> 
>LocalPte4K.Uint64 = Pte4K->Uint64;
> 
>if (Mask->Bits.PageTableBaseAddressLow ||
> Mask->Bits.PageTableBaseAddressHigh) {
> 
> @@ -78,7 +78,7 @@ PageTableLibSetPte4K (
>}
> 
> 
> 
>if (Pte4K->Uint64 != LocalPte4K.Uint64) {
> 
> -Pte4K->Uint64 = LocalPte4K.Uint64;
> 
> +*(volatile UINT64 *)&(Pte4K->Uint64) = LocalPte4K.Uint64;
> 
>}
> 
>  }
> 
> 
> 
> @@ -100,7 +100,7 @@ PageTableLibSetPleB (
>IN IA32_MAP_ATTRIBUTE *Mask
> 
>)
> 
>  {
> 
> -  IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE  LocalPleB;
> 
> +  volatile IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE  LocalPleB;
> 
> 
> 
>LocalPleB.Uint64 = PleB->Uint64;
> 
>if (Mask->Bits.PageTableBaseAddressLow ||
> Mask->Bits.PageTableBaseAddressHigh) {
> 
> @@ -154,7 +154,7 @@ PageTableLibSetPleB (
>}
> 
> 
> 
>if (PleB->Uint64 != LocalPleB.Uint64) {
> 
> -PleB->Uint64 = LocalPleB.Uint64;
> 
> +*(volatile UINT64 *)&(PleB->Uint64) = LocalPleB.Uint64;
> 
>}
> 
>  }
> 
> 
> 
> @@ -200,7 +200,7 @@ PageTableLibSetPnle (
>IN IA32_MAP_ATTRIBUTE*Mask
> 
>)
> 
>  {
> 
> -  IA32_PAGE_NON_LEAF_ENTRY  LocalPnle;
> 
> +  volatile IA32_PAGE_NON_LEAF_ENTRY  LocalPnle;
> 
> 
> 
>LocalPnle.Uint64 = Pnle->Uint64;
> 
>if (Mask->Bits.Present) {
> 
> @@ -231,7 +231,7 @@ PageTableLibSetPnle (
>LocalPnle.Bits.WriteThrough  = 0;
> 
>LocalPnle.Bits.CacheDisabled = 0;
> 
>if (Pnle->Uint64 != LocalPnle.Uint64) {
> 
> -Pnle->Uint64 = LocalPnle.Uint64;
> 
> +*(volatile UINT64 *)&(Pnle->Uint64) = LocalPnle.Uint64;
> 
>}
> 
>  }
> 
> 
> 
> --
> 2.31.1.windows.1



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




Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix IN OUT parameters marked as IN

2024-02-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: Zhou, Jianfeng 
> Sent: Wednesday, February 21, 2024 9:25 AM
> To: devel@edk2.groups.io
> Cc: Zhou, Jianfeng ; Ni, Ray ;
> Laszlo Ersek ; Kumar, Rahul R
> ; Gerd Hoffmann 
> Subject: [PATCH] UefiCpuPkg: Fix IN OUT parameters marked as IN
> 
> Some IN OUT parameters in CpuPageTableMap.c were mistakenly marked as
> IN.
> "IN" replaced with "IN OUT" in the following interfaces:
> 
> PageTableLibSetPte4K(): Pte4K
> PageTableLibSetPleB():  PleB
> PageTableLibSetPle():   Ple
> PageTableLibSetPnle():  Pnle
> 
> Signed-off-by: Zhou Jianfeng 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> ---
>  .../Library/CpuPageTableLib/CpuPageTableMap.c | 32 +--
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> index ae4caf8dfe..2ea40666cc 100644
> --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> @@ -20,10 +20,10 @@
>  **/
> 
>  VOID
> 
>  PageTableLibSetPte4K (
> 
> -  IN IA32_PTE_4K *Pte4K,
> 
> -  IN UINT64  Offset,
> 
> -  IN IA32_MAP_ATTRIBUTE  *Attribute,
> 
> -  IN IA32_MAP_ATTRIBUTE  *Mask
> 
> +  IN OUT IA32_PTE_4K *Pte4K,
> 
> +  IN UINT64  Offset,
> 
> +  IN IA32_MAP_ATTRIBUTE  *Attribute,
> 
> +  IN IA32_MAP_ATTRIBUTE  *Mask
> 
>)
> 
>  {
> 
>IA32_PTE_4K  LocalPte4K;
> 
> @@ -94,10 +94,10 @@ PageTableLibSetPte4K (
>  **/
> 
>  VOID
> 
>  PageTableLibSetPleB (
> 
> -  IN IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE  *PleB,
> 
> -  IN UINT64 Offset,
> 
> -  IN IA32_MAP_ATTRIBUTE *Attribute,
> 
> -  IN IA32_MAP_ATTRIBUTE *Mask
> 
> +  IN OUT IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE  *PleB,
> 
> +  IN UINT64 Offset,
> 
> +  IN IA32_MAP_ATTRIBUTE *Attribute,
> 
> +  IN IA32_MAP_ATTRIBUTE *Mask
> 
>)
> 
>  {
> 
>IA32_PAGE_LEAF_ENTRY_BIG_PAGESIZE  LocalPleB;
> 
> @@ -171,11 +171,11 @@ PageTableLibSetPleB (
>  **/
> 
>  VOID
> 
>  PageTableLibSetPle (
> 
> -  IN UINTN   Level,
> 
> -  IN IA32_PAGING_ENTRY   *Ple,
> 
> -  IN UINT64  Offset,
> 
> -  IN IA32_MAP_ATTRIBUTE  *Attribute,
> 
> -  IN IA32_MAP_ATTRIBUTE  *Mask
> 
> +  IN UINTN   Level,
> 
> +  IN OUT IA32_PAGING_ENTRY   *Ple,
> 
> +  IN UINT64  Offset,
> 
> +  IN IA32_MAP_ATTRIBUTE  *Attribute,
> 
> +  IN IA32_MAP_ATTRIBUTE  *Mask
> 
>)
> 
>  {
> 
>if (Level == 1) {
> 
> @@ -195,9 +195,9 @@ PageTableLibSetPle (
>  **/
> 
>  VOID
> 
>  PageTableLibSetPnle (
> 
> -  IN IA32_PAGE_NON_LEAF_ENTRY  *Pnle,
> 
> -  IN IA32_MAP_ATTRIBUTE*Attribute,
> 
> -  IN IA32_MAP_ATTRIBUTE*Mask
> 
> +  IN OUT IA32_PAGE_NON_LEAF_ENTRY  *Pnle,
> 
> +  IN IA32_MAP_ATTRIBUTE*Attribute,
> 
> +  IN IA32_MAP_ATTRIBUTE*Mask
> 
>)
> 
>  {
> 
>IA32_PAGE_NON_LEAF_ENTRY  LocalPnle;
> 
> --
> 2.31.1.windows.1



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




Re: [edk2-devel] [PATCH] MinPlatformPkg/PhatAcpiLib: Add to CoreDxeLib dsc

2024-02-20 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Clark-williams, Zachary 
> Sent: Tuesday, February 20, 2024 9:18 PM
> To: devel@edk2.groups.io
> Cc: Clark-williams, Zachary ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Liming Gao ;
> Dong, Eric 
> Subject: [PATCH] MinPlatformPkg/PhatAcpiLib: Add to CoreDxeLib dsc
> 
> From: Zachary Clark-Williams 
> 
> PhatAcpiLib update to match all file names to PhatAcpiLib and add the library 
> to
> CoreDxeLib for use.
> 
> Hsd-es-id: 22019504949
> 
> Change-Id: Ic184715a2b5ab117d464bad5cb251c674416e0dd
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Signed-off-by: Zachary Clark-Williams 
> ---
>  .../MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf  | 2 +-
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc| 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
> b/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
> index d2e0d070f..7e238eb8d 100644
> --- 
> a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpi
> +++ Lib.inf
> @@ -12,7 +12,7 @@
>FILE_GUID  = 3932BB84-ADFB-4C7A-BC59-E33FC7AD6E20
>VERSION_STRING = 1.0
>MODULE_TYPE= DXE_DRIVER
> -  LIBRARY_CLASS  = DxePhatAcpiLib|DXE_DRIVER
> +  LIBRARY_CLASS  = PhatAcpiLib|DXE_DRIVER
> 
>  [Sources]
>DxePhatAcpiLib.c
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> index b46993882..80cc12904 100644
> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> @@ -42,6 +42,7 @@
>  [LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_DRIVER,
> LibraryClasses.common.DXE_RUNTIME_DRIVER,
> LibraryClasses.common.UEFI_DRIVER,
> LibraryClasses.common.UEFI_APPLICATION]
> 
> VariableReadLib|MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRunti
> meVariableReadLib.inf
> 
> VariableWriteLib|MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRunti
> meVariableWriteLib.inf
> +
> + PhatAcpiLib|MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
> 
>  [LibraryClasses.common.DXE_DRIVER,
> LibraryClasses.common.DXE_RUNTIME_DRIVER,
> LibraryClasses.common.UEFI_DRIVER,
> LibraryClasses.common.UEFI_APPLICATION]
>  !if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE
> --
> 2.39.1.windows.1



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




[edk2-devel] [PATCH] MinPlatformPkg/PhatAcpiLib: Add to CoreDxeLib dsc

2024-02-20 Thread Clark-williams, Zachary
From: Zachary Clark-Williams 

PhatAcpiLib update to match all file names to PhatAcpiLib
and add the library to CoreDxeLib for use.

Hsd-es-id: 22019504949

Change-Id: Ic184715a2b5ab117d464bad5cb251c674416e0dd
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Zachary Clark-Williams 
---
 .../MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf  | 2 +-
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc| 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf 
b/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
index d2e0d070f..7e238eb8d 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
+++ b/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
@@ -12,7 +12,7 @@
   FILE_GUID  = 3932BB84-ADFB-4C7A-BC59-E33FC7AD6E20
   VERSION_STRING = 1.0
   MODULE_TYPE= DXE_DRIVER
-  LIBRARY_CLASS  = DxePhatAcpiLib|DXE_DRIVER
+  LIBRARY_CLASS  = PhatAcpiLib|DXE_DRIVER
 
 [Sources]
   DxePhatAcpiLib.c
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc 
b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
index b46993882..80cc12904 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
@@ -42,6 +42,7 @@
 [LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_DRIVER, 
LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, 
LibraryClasses.common.UEFI_APPLICATION]
   
VariableReadLib|MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.inf
   
VariableWriteLib|MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.inf
+  PhatAcpiLib|MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
 
 [LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, 
LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION]
 !if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE
-- 
2.39.1.windows.1



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




[edk2-devel] [PATCH v1 1/1] BaseTools/GenFds: Resolve absolute workspace INF paths

2024-02-20 Thread Michael Kubacki
From: Michael Kubacki 

Currently, if an INF path is an absolute path on Linux (begins with
"/"), the "/" character will be removed. If the path is an absolute
system path, this creates an invalid path.

An example of when this may be an issue is in external dependencies
where an INF is within the external dependency, the `set_build_var`
flag is set, and DSC files refer to files by its build variable
(e.g. `$(SHARED_BINARIES)/Module.inf`). INFs in a binary distribution
like this example may contain a [Binaries] section and refer to
different section files that can be used by a platform to compose an
FFS file. For example, the PE32 (.efi) and DEPEX (.depex) files.

In this case, `$(SHARED_BINARIES)` will be an absolute path to the
ext dep directory and `FfsInfStatement.__InfParse__` will remove the
leading "/" character so the path is invalid.

This change first checks if the absolute path will resolve into the
current workspace. If it does (as will happen in the shared crypto
ext dep example above), it modifies the path to be relative to the
workspace so later logic dependent on relative paths can operate on
it. If the absolute path is not within the current workspace, it
follows previous behavior for backward compatibility to that
scenario.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Signed-off-by: Michael Kubacki 
---
 BaseTools/Source/Python/GenFds/FfsInfStatement.py | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py 
b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 568efb6d7685..6550d939d49c 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -19,6 +19,7 @@ from .GenFdsGlobalVariable import GenFdsGlobalVariable
 from .Ffs import SectionSuffix,FdfFvFileTypeToFileType
 import subprocess
 import sys
+from pathlib import Path
 from . import Section
 from . import RuleSimpleFile
 from . import RuleComplexFile
@@ -156,7 +157,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
 if len(self.InfFileName) > 1 and self.InfFileName[0] == '\\' and 
self.InfFileName[1] == '\\':
 pass
 elif self.InfFileName[0] == '\\' or self.InfFileName[0] == '/' :
-self.InfFileName = self.InfFileName[1:]
+ws_path = Path(GenFdsGlobalVariable.WorkSpaceDir)
+inf_path = Path(self.InfFileName)
+if ws_path in inf_path.parents:
+self.InfFileName = str(inf_path.relative_to(ws_path))
+else:
+self.InfFileName = self.InfFileName[1:]
 
 if self.InfFileName.find('$') == -1:
 InfPath = NormPath(self.InfFileName)
-- 
2.40.1.vfs.0.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115708): https://edk2.groups.io/g/devel/message/115708
Mute This Topic: https://groups.io/mt/104482915/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 5/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SaveCpuMpData()

2024-02-20 Thread Ni, Ray
> 
> +  MaxCpusPerHob = (MAX_UINT16 - sizeof (EFI_HOB_GUID_TYPE) - sizeof
> (MP_HAND_OFF)) / sizeof (PROCESSOR_HAND_OFF);

Above formula assumes the maximum HOB length could be 0x.
But actually the maximum HOB length could be only 0xFFF8 because
PeiCore::PeiCreateHob() contains following logic:

  if (0x1 - Length <= 0x7) {
return EFI_INVALID_PARAMETER;
  }
  Length = (UINT16)((Length + 0x7) & (~0x7));

The if-check is to guarantee (Length + 0x7) & ~0x7 doesn't produce value 0
when the Length > 0xFFF8.

So, that means the formula should use 0xFFF8 instead of 0x (MAX_UINT16).


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115707): https://edk2.groups.io/g/devel/message/115707
Mute This Topic: https://groups.io/mt/104472313/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 4/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to MpInitLibInitialize

2024-02-20 Thread Ni, Ray
> 
> Loop over all MP_HAND_OFF HOBs instead of expecting a single HOB
> covering all CPUs in the system.
> 
> Add a new HaveMpHandOff variable to track whenever MP_HAND_OFF HOBs
> are

The commit message may need to be updated as "HaveMpHandOff" variable is gone 
in this version.

With that, Reviewed-by: Ray Ni 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115706): https://edk2.groups.io/g/devel/message/115706
Mute This Topic: https://groups.io/mt/104472311/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 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber()

2024-02-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: Gerd Hoffmann 
> Sent: Wednesday, February 21, 2024 1:50 AM
> To: devel@edk2.groups.io
> Cc: Oliver Steffen ; Laszlo Ersek
> ; Kumar, Rahul R ; Ni, Ray
> ; Gerd Hoffmann 
> Subject: [PATCH v2 2/5] UefiCpuPkg/MpInitLib: Add support for multiple
> HOBs to GetBspNumber()
> 
> Rename the MpHandOff parameter to FirstMpHandOff.  Add a loop so the
> function inspects all HOBs present in the system.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index e764bc9e4228..8f198ff6d817 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1894,26 +1894,33 @@ CheckAllAPs (
>  /**
>This function Get BspNumber.
> 
> -  @param[in] MpHandOffPointer to MpHandOff
> +  @param[in] FirstMpHandOff   Pointer to first MpHandOff HOB.
>@return BspNumber
>  **/
>  UINT32
>  GetBspNumber (
> -  IN CONST MP_HAND_OFF  *MpHandOff
> +  IN CONST MP_HAND_OFF  *FirstMpHandOff
>)
>  {
> -  UINT32  ApicId;
> -  UINT32  BspNumber;
> -  UINT32  Index;
> +  UINT32 ApicId;
> +  UINT32 BspNumber;
> +  UINT32 Index;
> +  CONST MP_HAND_OFF  *MpHandOff;
> 
>//
>// Get the processor number for the BSP
>//
>BspNumber = MAX_UINT32;
>ApicId= GetInitialApicId ();
> -  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> -if (MpHandOff->Info[Index].ApicId == ApicId) {
> -  BspNumber = Index;
> +
> +  for (MpHandOff = FirstMpHandOff;
> +   MpHandOff != NULL;
> +   MpHandOff = GetNextMpHandOffHob (MpHandOff))
> +  {
> +for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> +  if (MpHandOff->Info[Index].ApicId == ApicId) {
> +BspNumber = MpHandOff->ProcessorIndex + Index;
> +  }
>  }
>}
> 
> --
> 2.43.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115705): https://edk2.groups.io/g/devel/message/115705
Mute This Topic: https://groups.io/mt/104472310/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 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber()

2024-02-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray
> -Original Message-
> From: Gerd Hoffmann 
> Sent: Wednesday, February 21, 2024 1:50 AM
> To: devel@edk2.groups.io
> Cc: Oliver Steffen ; Laszlo Ersek
> ; Kumar, Rahul R ; Ni, Ray
> ; Gerd Hoffmann 
> Subject: [PATCH v2 2/5] UefiCpuPkg/MpInitLib: Add support for multiple
> HOBs to GetBspNumber()
> 
> Rename the MpHandOff parameter to FirstMpHandOff.  Add a loop so the
> function inspects all HOBs present in the system.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index e764bc9e4228..8f198ff6d817 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1894,26 +1894,33 @@ CheckAllAPs (
>  /**
>This function Get BspNumber.
> 
> -  @param[in] MpHandOffPointer to MpHandOff
> +  @param[in] FirstMpHandOff   Pointer to first MpHandOff HOB.
>@return BspNumber
>  **/
>  UINT32
>  GetBspNumber (
> -  IN CONST MP_HAND_OFF  *MpHandOff
> +  IN CONST MP_HAND_OFF  *FirstMpHandOff
>)
>  {
> -  UINT32  ApicId;
> -  UINT32  BspNumber;
> -  UINT32  Index;
> +  UINT32 ApicId;
> +  UINT32 BspNumber;
> +  UINT32 Index;
> +  CONST MP_HAND_OFF  *MpHandOff;
> 
>//
>// Get the processor number for the BSP
>//
>BspNumber = MAX_UINT32;
>ApicId= GetInitialApicId ();
> -  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> -if (MpHandOff->Info[Index].ApicId == ApicId) {
> -  BspNumber = Index;
> +
> +  for (MpHandOff = FirstMpHandOff;
> +   MpHandOff != NULL;
> +   MpHandOff = GetNextMpHandOffHob (MpHandOff))
> +  {
> +for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> +  if (MpHandOff->Info[Index].ApicId == ApicId) {
> +BspNumber = MpHandOff->ProcessorIndex + Index;
> +  }
>  }
>}
> 
> --
> 2.43.2



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




Re: [edk2-devel] [PATCH v2 1/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetMpHandOffHob

2024-02-20 Thread Ni, Ray
> -Original Message-
> From: Gerd Hoffmann 
> Sent: Wednesday, February 21, 2024 1:50 AM
> To: devel@edk2.groups.io
> Cc: Oliver Steffen ; Laszlo Ersek
> ; Kumar, Rahul R ; Ni, Ray
> ; Gerd Hoffmann 
> Subject: [PATCH v2 1/5] UefiCpuPkg/MpInitLib: Add support for multiple
> HOBs to GetMpHandOffHob
> 
> Rename the function to GetNextMpHandOffHob(), add MP_HAND_OFF
> parameter.
> When called with NULL pointer return the first HOB, otherwise return the
> next in the chain.
> 
> Also add the function prototype to the MpLib.h header file.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.h | 12 
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 26 --
>  2 files changed, 28 insertions(+), 10 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> index a96a6389c17d..bc2a0232291d 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> @@ -485,6 +485,18 @@ SwitchApContext (
>IN MP_HAND_OFF  *MpHandOff
>);
> 
> +/**
> +  Get pointer to next MP_HAND_OFF GUIDed HOB.
> +
> +  @param[in] MpHandOff  Previous HOB.  Pass NULL to get the first
> HOB.

Can you please emphasize in above comments that MpHandOff points to the GUIDed 
HOB data?
The function implementation assumes that.



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




[edk2-devel] [edk2-platforms][PATCH V3] OptionRomPkg: Update for UEFI spec v2.9 - mantis #1866

2024-02-20 Thread Gahan
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4689

Bug 4689 - GetInfo() of Adapter Information Protocol
should have a provision for IHV to return no data for
UEFI Spec compliance 2.9 [mantis #1866]

Cc: Ray Ni 
Signed-off-by: Gahan Saraiya 
---
 Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h 
b/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h
index 31c55a8e11..45c1f41414 100644
--- a/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h
+++ b/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h
@@ -350,23 +350,24 @@ VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI 
*PxePtr);

   This function returns information of type InformationType from the adapter.
   If an adapter does not support the requested informational type, then
-  EFI_UNSUPPORTED is returned.
+  EFI_UNSUPPORTED is returned.

   @param[in]  This   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
   @param[in]  InformationTypeA pointer to an EFI_GUID that defines the 
contents of InformationBlock.
-  @param[out] InforamtionBlock   The service returns a pointer to the 
buffer with the InformationBlock
+  @param[out] InformationBlock   The service returns a pointer to the 
buffer with the InformationBlock
  structure which contains details about 
the data specific to InformationType.
-  @param[out] InforamtionBlockSize   The driver returns the size of the 
InformationBlock in bytes.
+  @param[out] InformationBlockSize   The driver returns the size of the 
InformationBlock in bytes.

   @retval EFI_SUCCESSThe InformationType information was 
retrieved.
   @retval EFI_UNSUPPORTEDThe InformationType is not known.
+  @retval EFI_NOT_FOUND  Information is not available for the 
requested information type.
   @retval EFI_DEVICE_ERROR   The device reported an error.
   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to 
a lack of resources.
-  @retval EFI_INVALID_PARAMETER  This is NULL.
-  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
+  @retval EFI_INVALID_PARAMETER  This is NULL.
+  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
   @retval EFI_INVALID_PARAMETER  InformationBlockSize is NULL.

-**/
+**/
 EFI_STATUS
 EFIAPI
 UndiAipGetInfo (
@@ -396,7 +397,7 @@ UndiAipGetInfo (
   @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
   @retval EFI_WRITE_PROTECTEDThe InformationType cannot be modified 
using EFI_ADAPTER_INFO_SET_INFO().

-**/
+**/
 EFI_STATUS
 EFIAPI
 UndiAipSetInfo (
@@ -427,7 +428,7 @@ UndiAipSetInfo (
   @retval EFI_INVALID_PARAMETER InfoTypesBufferCount is NULL.
   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store 
the results.

-**/
+**/
 EFI_STATUS
 EFIAPI
 UndiAipGetSupportedTypes (
--
2.39.2.windows.1



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




[edk2-devel] [edk2-platforms][PATCH V3] MinPlatformPkg: Update for UEFI spec v2.9 - mantis #1866

2024-02-20 Thread Gahan
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4689

Bug 4689 - GetInfo() of Adapter Information Protocol
should have a provision for IHV to return no data for
UEFI Spec compliance 2.9 [mantis #1866]

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Gahan Saraiya 
---
 .../Test/Library/TestPointLib/DxeTestPointAip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c
index a7fe9530cf..fcfef58175 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c
@@ -12,7 +12,7 @@

   This function returns information of type InformationType from the adapter.
   If an adapter does not support the requested informational type, then
-  EFI_UNSUPPORTED is returned.
+  EFI_UNSUPPORTED is returned.

   @param[in]  This   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
   @param[in]  InformationTypeA pointer to an EFI_GUID that defines the 
contents of InformationBlock.
@@ -24,8 +24,8 @@
   @retval EFI_UNSUPPORTEDThe InformationType is not known.
   @retval EFI_DEVICE_ERROR   The device reported an error.
   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to 
a lack of resources.
-  @retval EFI_INVALID_PARAMETER  This is NULL.
-  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
+  @retval EFI_INVALID_PARAMETER  This is NULL.
+  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
   @retval EFI_INVALID_PARAMETER  InformationBlockSize is NULL.

 **/
--
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, February 21, 2024 8:13 AM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin ; Nickle Wang
> ; Chang, Abner ; Igor
> Kulchytskyy 
> Subject: [PATCH 2/4] RedfishClientPkg: refine
> RedfishExternalResourceResourceFeatureCallback
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Use local variable for CollectionUri passed to HandleResource() to avoid
> problems in case of Private->Uri is overriden down the call stack.
>
> Suggested-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Mike Maslenkin 
> ---
>  RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> index f40f2d85af80..396ec22969b5 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> @@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback (
>REDFISH_SERVICE  RedfishService;
>
>REDFISH_RESOURCE_COMMON_PRIVATE  *Private;
>
>EFI_STRING   ResourceUri;
>
> +  EFI_STRING   CollectionUri;
>
>
>
>if (FeatureAction != CallbackActionStartOperation) {
>
>  return EFI_UNSUPPORTED;
>
> @@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback
> (
>//
>
>// Initialize collection path
>
>//
>
> -  Private->Uri = RedfishGetUri (ResourceUri);
>
> -  if (Private->Uri == NULL) {
>
> +  CollectionUri = RedfishGetUri (ResourceUri);

I would like to leave this to Nickle to review if there is any impacts of not 
initializing Private->Uri. Is Private->Uri referred in the later process?
Apart from above, the naming of CollectionUri is not proper as BiosDxe is not a 
collection driver. I think the comment of " // Initialize collection path" is a 
copy & paste error.

Thanks
Abner

>
> +  if (CollectionUri == NULL) {
>
>  ASSERT (FALSE);
>
>  FreePool (ResourceUri);
>
>  return EFI_OUT_OF_RESOURCES;
>
>}
>
>
>
> -  Status = HandleResource (Private, Private->Uri);
>
> +  Status = HandleResource (Private, CollectionUri);
>
>if (EFI_ERROR (Status)) {
>
> -DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r\n",
> __func__, Private->Uri, Status));
>
> +DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed: %r\n",
> __func__, CollectionUri, Status));
>
>}
>
>
>
> -  FreePool (Private->Uri);
>
> +  FreePool (CollectionUri);
>
>FreePool (ResourceUri);
>
>return Status;
>
>  }
>
> --
> 2.32.0 (Apple Git-132)



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




Re: [edk2-devel] [PATCH 4/4] RedfishClientPkg: use Json value from a function argument

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Looks good, thank you!

Reviewed-by: Abner Chang 

> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, February 21, 2024 8:13 AM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin ; Chang, Abner
> ; Nickle Wang ; Igor
> Kulchytskyy 
> Subject: [PATCH 4/4] RedfishClientPkg: use Json value from a function
> argument
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> This patch replaces value Private->Json with Json used as second argument
> for RedfishIdentifyResource(). Currently Json argument is not used at all
> and the pattern for caller side is:
>   Status = RedfishIdentifyResourceCommon (Private, Private->Json);
>
> So in scope of RedfishIdentifyResourceCommon Json actually is the same
> value as Private->Json. Let's make code a bit cleaner.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Mike Maslenkin 
> ---
>  RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c   | 2 +-
>  .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c| 2 +-
>  .../ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c| 2
> +-
>  .../ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c | 2
> +-
>  RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
> | 2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> index 0ae841499692..f3f993c8782e 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> @@ -729,7 +729,7 @@ RedfishIdentifyResourceCommon (
>EFI_STRING   EndOfChar;
>
>REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
>
>
>
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
>
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
>
>if (Supported) {
>
>  Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION,
> REDPATH_ARRAY_PATTERN, );
>
>  if (EFI_ERROR (Status)) {
>
> diff --git
> a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.c
> b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.c
> index 0b9f2bf28434..f471c01c3790 100644
> ---
> a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.c
> +++
> b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.c
> @@ -791,7 +791,7 @@ RedfishIdentifyResourceCommon (
>  {
>
>BOOLEAN  Supported;
>
>
>
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
>
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
>
>if (Supported) {
>
>  return EFI_SUCCESS;
>
>}
>
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.c
> index cee6c8bf9ba1..d69fc176ad94 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.c
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.c
> @@ -848,7 +848,7 @@ RedfishIdentifyResourceCommon (
>EFI_STRING   EndOfChar;
>
>REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
>
>
>
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
>
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
>
>if (Supported) {
>
>  Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION,
> REDPATH_ARRAY_PATTERN, );
>
>  if (EFI_ERROR (Status)) {
>
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.c
> index a67ef3dac283..11bcb5f76cab 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.c
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.c
> @@ -1718,7 +1718,7 @@ RedfishIdentifyResourceCommon (
>EFI_STRING   EndOfChar;
>
>REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
>
>
>
> -  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
>
> +  Supported = RedfishIdentifyResource (Private->Uri, Json);
>
>if (Supported) {
>
>  Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION,
> REDPATH_ARRAY_PATTERN, );
>
>  if (EFI_ERROR (Status)) {
>
> diff --git
> a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
> b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.
> c
> index eb52c68c5dcb..00a69f748c3c 100644
> 

Re: [edk2-devel] [PATCH 3/4] RedfishClientPkg/Bios: fix leak of GetPendingSettings URI.

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, February 21, 2024 8:13 AM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin ; Chang, Abner
> ; Nickle Wang ; Igor
> Kulchytskyy 
> Subject: [PATCH 3/4] RedfishClientPkg/Bios: fix leak of GetPendingSettings
> URI.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Mike Maslenkin 
> ---
>  RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> index 396ec22969b5..8548425c9c83 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> @@ -132,6 +132,7 @@ RedfishResourceConsumeResource (
>// Check and see if "@Redfish.Settings" exist or not.
>
>//
>
>ZeroMem (, sizeof (REDFISH_RESPONSE));
>
> +  PendingSettingUri = NULL;
>
>Status = GetPendingSettings (
>
>   Private->RedfishService,
>
>   Response.Payload,
>
> @@ -206,6 +207,10 @@ RedfishResourceConsumeResource (
>  FreePool (Etag);
>
>}
>
>
>
> +  if (PendingSettingUri != NULL) {
>
> +FreePool (PendingSettingUri);
>
> +  }
>
> +
>
>return Status;
>
>  }
>
>
>
> --
> 2.32.0 (Apple Git-132)



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




Re: [edk2-devel] [PATCH 1/4] RedfishClientPkg/RedfishFeatureUtilityLib: fix memory leak on error path

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

One comment below,

> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, February 21, 2024 8:13 AM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin ; Igor Kulchytskyy
> ; Nickle Wang ; Chang, Abner
> 
> Subject: [PATCH 1/4] RedfishClientPkg/RedfishFeatureUtilityLib: fix memory
> leak on error path
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Cc: Igor Kulchytskyy 
> Cc: Nickle Wang 
> Signed-off-by: Mike Maslenkin 
> Reviewed-by: Abner Chang 
I think my name should be in "Cc:"?
Abner


> ---
>  .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> index e1494471038c..21ce8ddad9d5 100644
> ---
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> +++
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> @@ -4010,6 +4010,7 @@ RedfishRemoveUnchangeableProperties (
>   (RedfishCS_uint32)AsciiStrSize (*JsonString)
>
>   );
>
>if (Status != RedfishCS_status_success) {
>
> +FreePool (UpdatedJsonString);
>
>  return EFI_DEVICE_ERROR;
>
>}
>
>
>
> --
> 2.32.0 (Apple Git-132)



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




Re: [edk2-devel] [PATCH 6/6] RedfishPkg/RedfishCrtLib: fix unresolved external symbol issue

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, February 20, 2024 2:42 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [PATCH 6/6] RedfishPkg/RedfishCrtLib: fix unresolved external
> symbol issue
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Fix below compiler error reported in edk2 CI.
> ERROR - Linker #2001 from JsonLib.lib(load.obj) : unresolved external
> symbol __ftol2
> -The file MathFtol.c is copied from IntrinsicLib in CryptoPkg.
> -Add MathFtol.c to EccCheck IgnoreFiles.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishCrtLib/RedfishCrtLib.inf   |  7 +++-
>  .../RedfishCrtLib/Ia32/MathFtol.c | 37 +++
>  RedfishPkg/RedfishPkg.ci.yaml |  2 +
>  3 files changed, 45 insertions(+), 1 deletion(-)
>  create mode 100644
> RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
>
> diff --git a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
> b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
> index 6ff5dba75c..3a5e309d1a 100644
> --- a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
> +++ b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
> @@ -3,6 +3,7 @@
>  #
>  # Copyright (c) 2019, Intel Corporation. All rights reserved.
>  # (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  #SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -23,6 +24,9 @@
>  [Sources]
>RedfishCrtLib.c
>
> +[Sources.IA32]
> +  Ia32/MathFtol.c   | MSFT
> +
>  [LibraryClasses]
>BaseLib
>SortLib
> @@ -35,4 +39,5 @@
>MdeModulePkg/MdeModulePkg.dec
>RedfishPkg/RedfishPkg.dec
>
> -
> +[BuildOptions]
> +  MSFT:*_*_IA32_CC_FLAGS = /GL-
> diff --git a/RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
> b/RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
> new file mode 100644
> index 00..adfe249b1d
> --- /dev/null
> +++ b/RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
> @@ -0,0 +1,37 @@
> +/** @file

Hi Nickle,
Could you please add the information here after @file about where this file or 
the source code come from, such as the location of original file?
Thanks
Abner


> +  64-bit Math Worker Function.
> +  The 32-bit versions of C compiler generate calls to library routines
> +  to handle 64-bit math. These functions use non-standard calling
> conventions.
> +
> +Copyright (c) 2019, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +/*
> + * Floating point to integer conversion.
> + */
> +__declspec(naked) void
> +_ftol2 (
> +  void
> +  )
> +{
> +  _asm {
> +fistp qword ptr [esp-8]
> +mov   edx, [esp-4]
> +mov   eax, [esp-8]
> +ret
> +  }
> +}
> +
> +__declspec(naked) void
> +_ftol2_sse (
> +  void
> +  )
> +{
> +  _asm {
> +fistp dword ptr [esp-4]
> +mov   eax,[esp-4]
> +ret
> +  }
> +}
> diff --git a/RedfishPkg/RedfishPkg.ci.yaml b/RedfishPkg/RedfishPkg.ci.yaml
> index 69b6bf39f5..b95e8bfdc7 100644
> --- a/RedfishPkg/RedfishPkg.ci.yaml
> +++ b/RedfishPkg/RedfishPkg.ci.yaml
> @@ -2,6 +2,7 @@
>  # CI configuration for NetworkPkg
>  #
>  # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
>  {
> @@ -38,6 +39,7 @@
>  "PrivateInclude/Crt/string.h",
>  "PrivateInclude/Crt/time.h",
>  "PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c",
> +"PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c",
>  "Include/Library/RedfishCrtLib.h",
>  ##
>  ## For jansson library open source
> --
> 2.34.1



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




Re: [edk2-devel] [PATCH 5/6] RedfishPkg/RedfishDebugLib: use RedfishHttpLib

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

As I already reviewed offline on Nickle's personal Git repo,
Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, February 20, 2024 2:42 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [PATCH 5/6] RedfishPkg/RedfishDebugLib: use RedfishHttpLib
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Remove RedfishLib and use RedfishHttpLib for debug printing
> Redfish response data.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf | 4 ++--
>  RedfishPkg/Include/Library/RedfishDebugLib.h   | 2 +-
>  RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c   | 1 +
>  3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
> b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
> index 048d27c6dc..d468bb213b 100644
> --- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
> +++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  INF file for Redfish debug library.
>  #
> -#  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -32,7 +32,7 @@
>DebugLib
>JsonLib
>MemoryAllocationLib
> -  RedfishLib
> +  RedfishHttpLib
>UefiLib
>
>  [Depex]
> diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h
> b/RedfishPkg/Include/Library/RedfishDebugLib.h
> index 3430cf1d14..ad7a697586 100644
> --- a/RedfishPkg/Include/Library/RedfishDebugLib.h
> +++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
> @@ -11,9 +11,9 @@
>  #define REDFISH_DEBUG_LIB_H_
>
>  #include 
> +#include 
>  #include 
>  #include 
> -#include 
>
>  #include 
>
> diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> index 3728f51213..8b0425b8c3 100644
> --- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> +++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> @@ -13,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #ifndef IS_EMPTY_STRING
> --
> 2.34.1



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




Re: [edk2-devel] [PATCH 4/6] RedfishPkg/RedfishLib: include RedfishServiceData.h

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

As I already reviewed offline on Nickle's personal Git repo,
Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, February 20, 2024 2:42 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [PATCH 4/6] RedfishPkg/RedfishLib: include RedfishServiceData.h
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Redfish common structures are moved to RedfishServiceData.h. Remove
> them from RedfishLib.h
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishPkg/Include/Library/RedfishLib.h | 17 +
>  1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/RedfishPkg/Include/Library/RedfishLib.h
> b/RedfishPkg/Include/Library/RedfishLib.h
> index 8309a67c76..fb30ff68f6 100644
> --- a/RedfishPkg/Include/Library/RedfishLib.h
> +++ b/RedfishPkg/Include/Library/RedfishLib.h
> @@ -70,6 +70,7 @@
>  #ifndef REDFISH_LIB_H_
>  #define REDFISH_LIB_H_
>
> +#include 
>  #include 
>
>  #include 
> @@ -78,22 +79,6 @@
>  #define ODATA_TYPE_NAME_MAX_SIZE  128
>  #define ODATA_TYPE_MAX_SIZE   128
>
> -///
> -/// Library class public defines
> -///
> -typedef  VOID  *REDFISH_SERVICE;
> -typedef  VOID  *REDFISH_PAYLOAD;
> -
> -///
> -/// Library class public structures/unions
> -///
> -typedef struct {
> -  EFI_HTTP_STATUS_CODE*StatusCode;
> -  UINTN   HeaderCount;
> -  EFI_HTTP_HEADER *Headers;
> -  REDFISH_PAYLOAD Payload;
> -} REDFISH_RESPONSE;
> -
>  ///
>  /// Odata type-name mapping structure.
>  ///
> --
> 2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115694): https://edk2.groups.io/g/devel/message/115694
Mute This Topic: https://groups.io/mt/104463407/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/6] RedfishPkg: introduce RedfishHttpLib

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

As I already reviewed offline on Nickle's personal Git repo,
Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, February 20, 2024 2:42 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [PATCH 3/6] RedfishPkg: introduce RedfishHttpLib
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> RedfishHttpLib is a wrapper library for Redfish feature drivers to
> call Redfish HTTP Protocol easily.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishPkg/RedfishPkg.dec |   5 +
>  RedfishPkg/RedfishLibs.dsc.inc|   3 +-
>  RedfishPkg/RedfishPkg.dsc |   3 +-
>  .../Library/RedfishHttpLib/RedfishHttpLib.inf |  43 ++
>  RedfishPkg/Include/Library/RedfishHttpLib.h   | 326 ++
>  .../Library/RedfishHttpLib/RedfishHttpLib.c   | 585 ++
>  6 files changed, 963 insertions(+), 2 deletions(-)
>  create mode 100644 RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
>  create mode 100644 RedfishPkg/Include/Library/RedfishHttpLib.h
>  create mode 100644 RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.c
>
> diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
> index 114f8d2ad8..1a9c9ed7bc 100644
> --- a/RedfishPkg/RedfishPkg.dec
> +++ b/RedfishPkg/RedfishPkg.dec
> @@ -69,6 +69,11 @@
>#
>RedfishPlatformConfigLib|Include/Library/RedfishPlatformConfigLib.h
>
> +  ##  @libraryclass  Provides the library functions to access Redfish HTTP
> +  #   protocol.
> +  #
> +  RedfishHttpLib|Include/Library/RedfishHttpLib.h
> +
>  [LibraryClasses.Common.Private]
>##  @libraryclass  Provides the private C runtime library functions.
>#   CRT library is currently used by edk2 JsonLib (open source
> diff --git a/RedfishPkg/RedfishLibs.dsc.inc b/RedfishPkg/RedfishLibs.dsc.inc
> index 5426957da8..55846aaa9d 100644
> --- a/RedfishPkg/RedfishLibs.dsc.inc
> +++ b/RedfishPkg/RedfishLibs.dsc.inc
> @@ -6,7 +6,7 @@
>  # of EDKII network library classes.
>  #
>  # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> -# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  #SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -21,5 +21,6 @@
>
> RedfishPlatformCredentialLib|RedfishPkg/Library/RedfishPlatformCredentialI
> pmiLib/RedfishPlatformCredentialIpmiLib.inf
>HiiUtilityLib|RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.inf
>
> RedfishPlatformConfigLib|RedfishPkg/Library/RedfishPlatformConfigLib/Red
> fishPlatformConfigLib.inf
> +  RedfishHttpLib|RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
>  !endif
>
> diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
> index 5849e7cf9e..b0150043a9 100644
> --- a/RedfishPkg/RedfishPkg.dsc
> +++ b/RedfishPkg/RedfishPkg.dsc
> @@ -4,7 +4,7 @@
>  # Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
>  # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
>  # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> -# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  #SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -74,5 +74,6 @@
>RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
>RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.inf
>RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf
> +  RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
>
>!include RedfishPkg/Redfish.dsc.inc
> diff --git a/RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
> b/RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
> new file mode 100644
> index 00..fd53b8c2ed
> --- /dev/null
> +++ b/RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
> @@ -0,0 +1,43 @@
> +## @file
> +#  Redfish HTTP library is wrapper library for application to call Redfish
> +#  HTTP protocol easily.
> +#
> +#  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010006
> +  BASE_NAME  = RedfishHttpLib
> +  FILE_GUID  = 62855D9B-441B-436B-9CA6-B7FEB7ABF54E
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = RedfishHttpLib| DXE_DRIVER UEFI_DRIVER
> +  CONSTRUCTOR= RedfishHttpConstructor
> +
> +#
> +#  VALID_ARCHITECTURES   = IA32 X64 EBC
> +#
> +
> +[Sources]
> +  RedfishHttpLib.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> 

Re: [edk2-devel] [PATCH 2/6] RedfishPkg: implement Redfish HTTP protocol

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

One comment below.

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, February 20, 2024 2:41 PM
> To: devel@edk2.groups.io
> Cc: Igor Kulchytskyy ; Chang, Abner
> ; Nick Ramirez 
> Subject: [PATCH 2/6] RedfishPkg: implement Redfish HTTP protocol
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> implement Redfish HTTP protocol driver.
>
> Signed-off-by: Nickle Wang 
> Co-authored-by: Igor Kulchytskyy 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishPkg/RedfishPkg.dec |7 +-
>  RedfishPkg/RedfishComponents.dsc.inc  |3 +-
>  RedfishPkg/RedfishPkg.dsc |2 +
>  RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf  |   73 +
>  RedfishPkg/RedfishHttpDxe/RedfishHttpData.h   |  256 
>  RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h|   44 +
>  .../RedfishHttpDxe/RedfishHttpOperation.h |   76 +
>  RedfishPkg/RedfishHttpDxe/RedfishHttpData.c   |  667 
>  RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c| 1344
> +
>  .../RedfishHttpDxe/RedfishHttpOperation.c |  693 +
>  RedfishPkg/Redfish.fdf.inc|3 +-
>  11 files changed, 3164 insertions(+), 4 deletions(-)
>  create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
>  create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.h
>  create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h
>  create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.h
>  create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.c
>  create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c
>  create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.c
>
> diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
> index 9b424efdf3..114f8d2ad8 100644
> --- a/RedfishPkg/RedfishPkg.dec
> +++ b/RedfishPkg/RedfishPkg.dec
> @@ -157,8 +157,11 @@
># set to EFI_REST_EX_PROTOCOL.
>#
>
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT3
> 2|0x1009
> -  ## This is used to enable HTTP content encoding on Redfish communication.
> -
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceContentEncoding|TRUE|BO
> OLEAN|0x100A
> +  #
> +  # This PCD string is introduced for platform developer to set the encoding
> method supported by BMC Redfish.
> +  # Currently only "None" and "gzip" are supported.
> +  #
> +
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceContentEncoding|"None"|V
> OID*|0x100A
>#
># Use below PCDs to control Redfhs HTTP protocol.
>#
> diff --git a/RedfishPkg/RedfishComponents.dsc.inc
> b/RedfishPkg/RedfishComponents.dsc.inc
> index 464ffc8606..d6c5b73d7f 100644
> --- a/RedfishPkg/RedfishComponents.dsc.inc
> +++ b/RedfishPkg/RedfishComponents.dsc.inc
> @@ -7,7 +7,7 @@
>  # "RedfishDefines.dsc.inc".
>  #
>  # (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
> -# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  #SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -28,4 +28,5 @@
>RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
>RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf
>MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
> +  RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
>  !endif
> diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
> index 25ed193182..5849e7cf9e 100644
> --- a/RedfishPkg/RedfishPkg.dsc
> +++ b/RedfishPkg/RedfishPkg.dsc
> @@ -45,6 +45,8 @@
>
> UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesL
> ib.inf
>
> RedfishPlatformCredentialLib|RedfishPkg/Library/PlatformCredentialLibNull/
> PlatformCredentialLibNull.inf
>
> RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/
> RedfishContentCodingLibNull.inf
> +
> ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeR
> eportStatusCodeLib.inf
> +  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
>
># NULL instance of IPMI related library.
>IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
> diff --git a/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> b/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> new file mode 100644
> index 00..c7dfdffacf
> --- /dev/null
> +++ b/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> @@ -0,0 +1,73 @@
> +## @file
> +#  RedfishHttpDxe is the DXE driver which provides
> +#  EdkIIRedfishHttpProtocol to EDK2 Redfish Feature
> +#  drivers for HTTP operation.
> +#
> +#  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x0001000b
> +  BASE_NAME  

[edk2-devel] Merge commit in edk2-non-osi

2024-02-20 Thread Nate DeSimone
Hi Everyone,

It appears that a merge commit was introduced to edk2-non-osi due to a PR merge:

https://github.com/tianocore/edk2-non-osi/commit/61b65fccfe4c75bc9ecb7b542412a436e3db5de6

I would like to remind everyone that we generally don't accept submissions via 
PRs yet. At the very least please click "Rebase and merge" when closing the PR 
instead of "Merge pull request". Since that merge commit is currently at the 
top of the tree, can we delete it?

Thanks,
Nate


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




Re: [edk2-devel] [PATCH 1/6] RedfishPkg: introduce Redfish HTTP protocol

2024-02-20 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

As I already reviewed offline on Nickle's personal Git repo,
Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, February 20, 2024 2:41 PM
> To: devel@edk2.groups.io
> Cc: Igor Kulchytskyy ; Chang, Abner
> ; Nick Ramirez 
> Subject: [PATCH 1/6] RedfishPkg: introduce Redfish HTTP protocol
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Introduce Redfish HTTP protocol to improve Redfish performance
> and communication stability between BIOS and Redfish service.
> - Feature drivers often query same Redfish resource multiple
> times for different purpose. Implement HTTP cache mechanism to
> improve HTTP GET performance. "UseCache" parameter is provided
> if application likes to send HTTP GET request to Redfish service
> without using cache data.
> - This driver will retire stale cache data automatically when
> application modify Redfish resource at service side.
> - PCD PcdHttpCacheDisabled is used to disable cache mechanism in
> this driver for debugging purpose.
> - PCD PcdRedfishServiceContentEncoding is used to enable content
> encoding while sending data to Redfish service.
> - Redfish HTTP protocol also implement retry mechanism to retry
> HTTP request when BIOS receive unexpected response from Redfish service.
> This function helps BIOS Redfish to finish its job as much as possible.
> - PCDs are defined to control how many times BIOS will retry the
> request and how many time BIOS will wait between retries.
>
> Signed-off-by: Nickle Wang 
> Co-authored-by: Igor Kulchytskyy 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishPkg/RedfishPkg.dec |  24 +-
>  .../Protocol/EdkIIRedfishHttpProtocol.h   | 308 ++
>  RedfishPkg/Include/RedfishServiceData.h   |  43 +++
>  3 files changed, 374 insertions(+), 1 deletion(-)
>  create mode 100644
> RedfishPkg/Include/Protocol/EdkIIRedfishHttpProtocol.h
>  create mode 100644 RedfishPkg/Include/RedfishServiceData.h
>
> diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
> index 3ea9ff3ef7..9b424efdf3 100644
> --- a/RedfishPkg/RedfishPkg.dec
> +++ b/RedfishPkg/RedfishPkg.dec
> @@ -4,7 +4,7 @@
>  # Copyright (c) 2019, Intel Corporation. All rights reserved.
>  # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
>  # Copyright (c) 2023, American Megatrends International LLC.
> -# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
> @@ -93,6 +93,9 @@
># Redfish Host Interface ready notification protocol
>gEdkIIRedfishHostInterfaceReadyProtocolGuid = { 0xC3F6D062, 0x3D38,
> 0x4EA4, { 0x92, 0xB1, 0xE8, 0xF8, 0x02, 0x27, 0x63, 0xDF } }
>
> +  ## Include/Protocol/EdkIIRedfishHttpProtocol.h
> +  gEdkIIRedfishHttpProtocolGuid = { 0x58a0f47e, 0xf45f, 0x4d44, { 0x89,
> 0x5b, 0x2a, 0xfe, 0xb0, 0x80, 0x15, 0xe2 } }
> +
>  [Guids]
>gEfiRedfishPkgTokenSpaceGuid  = { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x88,
> 0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }}
>
> @@ -154,3 +157,22 @@
># set to EFI_REST_EX_PROTOCOL.
>#
>
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT3
> 2|0x1009
> +  ## This is used to enable HTTP content encoding on Redfish communication.
> +
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceContentEncoding|TRUE|BO
> OLEAN|0x100A
> +  #
> +  # Use below PCDs to control Redfhs HTTP protocol.
> +  #
> +  ## The number of retry when HTTP GET request failed. If the value is 0, 
> there
> is no retry enabled.
> +  gEfiRedfishPkgTokenSpaceGuid.PcdHttpGetRetry|0|UINT16|0x100B
> +  ## The number of retry when HTTP PUT request failed. If the value is 0,
> there is no retry enabled.
> +  gEfiRedfishPkgTokenSpaceGuid.PcdHttpPutRetry|0|UINT16|0x100C
> +  ## The number of retry when HTTP PATCH request failed. If the value is 0,
> there is no retry enabled.
> +
> gEfiRedfishPkgTokenSpaceGuid.PcdHttpPatchRetry|0|UINT16|0x100D
> +  ## The number of retry when HTTP POST request failed. If the value is 0,
> there is no retry enabled.
> +  gEfiRedfishPkgTokenSpaceGuid.PcdHttpPostRetry|0|UINT16|0x100E
> +  ## The number of retry when HTTP DELETE request failed. If the value is 0,
> there is no retry enabled.
> +
> gEfiRedfishPkgTokenSpaceGuid.PcdHttpDeleteRetry|0|UINT16|0x100F
> +  ## The number of second to wait before driver retry HTTP request. If the
> value is 0, there is no wait before next retry.
> +
> gEfiRedfishPkgTokenSpaceGuid.PcdHttpRetryWaitInSecond|1|UINT16|0x000
> 01010
> +  ## This is used to disable Redfish HTTP cache function and every request 
> will
> be sent to Redfish service.
> +
> gEfiRedfishPkgTokenSpaceGuid.PcdHttpCacheDisabled|FALSE|BOOLEAN|0x0
> 0001011
> diff --git 

[edk2-devel] [PATCH] MinPlatformPkg/DxePhatLib: Add to CoreDxeLib dsc

2024-02-20 Thread Clark-williams, Zachary
From: Zachary Clark-Williams 

PhatAcpiLib update to match all file names to DxePhatAcpiLib
and add the library to CoreDxeLib for use.

Hsd-es-id: 22019504949

Change-Id: Ic184715a2b5ab117d464bad5cb251c674416e0dd
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Zachary Clark-Williams 
---
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc 
b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
index b46993882..80cc12904 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
@@ -42,6 +42,7 @@
 [LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_DRIVER, 
LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, 
LibraryClasses.common.UEFI_APPLICATION]
   
VariableReadLib|MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableReadLib.inf
   
VariableWriteLib|MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWriteLib.inf
+  PhatAcpiLib|MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
 
 [LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.DXE_RUNTIME_DRIVER, 
LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION]
 !if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE
-- 
2.39.1.windows.1



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




[edk2-devel] [PATCH 4/4] RedfishClientPkg: use Json value from a function argument

2024-02-20 Thread Mike Maslenkin
This patch replaces value Private->Json with Json used as second argument
for RedfishIdentifyResource(). Currently Json argument is not used at all
and the pattern for caller side is:
  Status = RedfishIdentifyResourceCommon (Private, Private->Json);

So in scope of RedfishIdentifyResourceCommon Json actually is the same
value as Private->Json. Let's make code a bit cleaner.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c   | 2 +-
 .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c| 2 +-
 .../ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c| 2 +-
 .../ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c | 2 +-
 RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index 0ae841499692..f3f993c8782e 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -729,7 +729,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, );
 if (EFI_ERROR (Status)) {
diff --git 
a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c 
b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
index 0b9f2bf28434..f471c01c3790 100644
--- a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
+++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
@@ -791,7 +791,7 @@ RedfishIdentifyResourceCommon (
 {
   BOOLEAN  Supported;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 return EFI_SUCCESS;
   }
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
index cee6c8bf9ba1..d69fc176ad94 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
@@ -848,7 +848,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, );
 if (EFI_ERROR (Status)) {
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
index a67ef3dac283..11bcb5f76cab 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
@@ -1718,7 +1718,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, );
 if (EFI_ERROR (Status)) {
diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c 
b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
index eb52c68c5dcb..00a69f748c3c 100644
--- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
+++ b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
@@ -2516,7 +2516,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, );
 if (EFI_ERROR (Status)) {
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115688): 

[edk2-devel] [PATCH 3/4] RedfishClientPkg/Bios: fix leak of GetPendingSettings URI.

2024-02-20 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index 396ec22969b5..8548425c9c83 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -132,6 +132,7 @@ RedfishResourceConsumeResource (
   // Check and see if "@Redfish.Settings" exist or not.
   //
   ZeroMem (, sizeof (REDFISH_RESPONSE));
+  PendingSettingUri = NULL;
   Status = GetPendingSettings (
  Private->RedfishService,
  Response.Payload,
@@ -206,6 +207,10 @@ RedfishResourceConsumeResource (
 FreePool (Etag);
   }
 
+  if (PendingSettingUri != NULL) {
+FreePool (PendingSettingUri);
+  }
+
   return Status;
 }
 
-- 
2.32.0 (Apple Git-132)



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




[edk2-devel] [PATCH 1/4] RedfishClientPkg/RedfishFeatureUtilityLib: fix memory leak on error path

2024-02-20 Thread Mike Maslenkin
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index e1494471038c..21ce8ddad9d5 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -4010,6 +4010,7 @@ RedfishRemoveUnchangeableProperties (
  (RedfishCS_uint32)AsciiStrSize (*JsonString)
  );
   if (Status != RedfishCS_status_success) {
+FreePool (UpdatedJsonString);
 return EFI_DEVICE_ERROR;
   }
 
-- 
2.32.0 (Apple Git-132)



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




[edk2-devel] [PATCH 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback

2024-02-20 Thread Mike Maslenkin
Use local variable for CollectionUri passed to HandleResource() to avoid
problems in case of Private->Uri is overriden down the call stack.

Suggested-by: Nickle Wang 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index f40f2d85af80..396ec22969b5 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback (
   REDFISH_SERVICE  RedfishService;
   REDFISH_RESOURCE_COMMON_PRIVATE  *Private;
   EFI_STRING   ResourceUri;
+  EFI_STRING   CollectionUri;
 
   if (FeatureAction != CallbackActionStartOperation) {
 return EFI_UNSUPPORTED;
@@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback (
   //
   // Initialize collection path
   //
-  Private->Uri = RedfishGetUri (ResourceUri);
-  if (Private->Uri == NULL) {
+  CollectionUri = RedfishGetUri (ResourceUri);
+  if (CollectionUri == NULL) {
 ASSERT (FALSE);
 FreePool (ResourceUri);
 return EFI_OUT_OF_RESOURCES;
   }
 
-  Status = HandleResource (Private, Private->Uri);
+  Status = HandleResource (Private, CollectionUri);
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r\n", 
__func__, Private->Uri, Status));
+DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed: %r\n", 
__func__, CollectionUri, Status));
   }
 
-  FreePool (Private->Uri);
+  FreePool (CollectionUri);
   FreePool (ResourceUri);
   return Status;
 }
-- 
2.32.0 (Apple Git-132)



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




[edk2-devel] [edk2-redfish-client][PATCH 0/4] RedfishClientPkg: fix memory leaks and refine code

2024-02-20 Thread Mike Maslenkin
This set contains a trivial fix for a leak reviewed on Feb 1 [1]
and a fix for а leak discussed in [2].

PR: https://github.com/tianocore/edk2-redfish-client/pull/76

[1] https://edk2.groups.io/g/devel/message/114925
[2] https://edk2.groups.io/g/devel/message/114765


Signed-off-by: Mike Maslenkin 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115684): https://edk2.groups.io/g/devel/message/115684
Mute This Topic: https://groups.io/mt/104479570/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] Pkg-Module: OptionRomPkg

2024-02-20 Thread Pedro Falcato
On Tue, Feb 20, 2024 at 10:39 AM Gahan  wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4689
>
> Bug 4689 - GetInfo() of Adapter Information Protocol
> should have a provision for IHV to return no data for
> UEFI Spec compliance 2.9 [mantis #1866]

Hi Gahan,

FYI, your commit subject lines are all incorrect.
It's supposed to be "OptionRomPkg: Change X to Y" versus "Pkg-Module:
OptionRomPkg".

HTH

-- 
Pedro


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




Re: [edk2-devel] [PATCH] MinPlatformPkg/DxePhatLib: Add to CoreCommon dsc

2024-02-20 Thread Chiu, Chasel


Hi Zack,

Usually we would like the LIBRARY_CLASS to be "phase agnostic" so we can share 
the same API cross different phase implementation.
Please see if we only need to update DxePhatAcpiLib.inf LIBRARY_CLASS and add 
INF to CoreCommon.dsc

Thanks,
Chasel



> -Original Message-
> From: Clark-williams, Zachary 
> Sent: Tuesday, February 20, 2024 1:42 PM
> To: devel@edk2.groups.io
> Cc: Clark-williams, Zachary ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Liming Gao ;
> Dong, Eric 
> Subject: [PATCH] MinPlatformPkg/DxePhatLib: Add to CoreCommon dsc
> 
> From: Zachary Clark-Williams 
> 
> PhatAcpiLib update to match all file names to DxePhatAcpiLib and add the 
> library
> to CoreCommonPkg for use.
> 
> Change-Id: I6e18ecf5acfdbc2053cf60b9a151b891e4e0fdfe
> Hsd-es-id: 22019504949
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Signed-off-by: Zachary Clark-Williams 
> ---
>  .../Library/{PhatAcpiLib => DxePhatAcpiLib}/DxePhatAcpiLib.c| 2 +-
>  .../Library/{PhatAcpiLib => DxePhatAcpiLib}/DxePhatAcpiLib.inf  | 0
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
>  .../Include/Library/{PhatAcpiLib.h => DxePhatAcpiLib.h} | 0
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec| 2 +-
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc| 2 +-
>  6 files changed, 4 insertions(+), 3 deletions(-)  rename
> Platform/Intel/MinPlatformPkg/Acpi/Library/{PhatAcpiLib =>
> DxePhatAcpiLib}/DxePhatAcpiLib.c (96%)  rename
> Platform/Intel/MinPlatformPkg/Acpi/Library/{PhatAcpiLib =>
> DxePhatAcpiLib}/DxePhatAcpiLib.inf (100%)  rename
> Platform/Intel/MinPlatformPkg/Include/Library/{PhatAcpiLib.h =>
> DxePhatAcpiLib.h} (100%)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.c
> b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.c
> similarity index 96%
> rename from
> Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.c
> rename to
> Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.c
> index e0e502cf0..ebfc542a3 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.c
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatA
> +++ cpiLib.c
> @@ -6,7 +6,7 @@
>SPDX-License-Identifier: BSD-2-Clause-Patent  **/
> 
> -#include 
> +#include 
> 
>  #include 
>  #include 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
> b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.in
> f
> similarity index 100%
> rename from
> Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
> rename to
> Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.inf
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> index 790fccf40..657a9decc 100644
> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> @@ -150,6 +150,7 @@
> 
> LargeVariableReadLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLarge
> VariableReadLib.inf
> 
> LargeVariableWriteLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLarge
> VariableWriteLib.inf
>CompressLib|MinPlatformPkg/Library/CompressLib/CompressLib.inf
> +
> + DxePhatAcpiLib|MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiL
> + ib.inf
> 
>#
># CryptLib
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/PhatAcpiLib.h
> b/Platform/Intel/MinPlatformPkg/Include/Library/DxePhatAcpiLib.h
> similarity index 100%
> rename from Platform/Intel/MinPlatformPkg/Include/Library/PhatAcpiLib.h
> rename to Platform/Intel/MinPlatformPkg/Include/Library/DxePhatAcpiLib.h
> diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> index 09312d329..d006d7117 100644
> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> @@ -88,7 +88,7 @@
>LargeVariableReadLib|Include/Library/LargeVariableReadLib.h
>LargeVariableWriteLib|Include/Library/LargeVariableWriteLib.h
> 
> -  PhatAcpiLib|Include/Library/PhatAcpiLib.h
> +  DxePhatAcpiLib|Include/Library/DxePhatAcpiLib.h
> 
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
> 
> diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> index 4b295babf..f9227e014 100644
> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> @@ -64,7 +64,7 @@
> 
> PciSegmentInfoLib|MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSeg
> mentInfoLibSimple.inf
> 
> PlatformBootManagerLib|MinPlatformPkg/Bds/Library/DxePlatformBootManager
> Lib/DxePlatformBootManagerLib.inf
> 
> 

Re: [edk2-devel] [PATCH v3 5/6] OvmfPkg/ResetVector: add 5-level paging support

2024-02-20 Thread Lendacky, Thomas via groups.io

On 2/20/24 03:06, Gerd Hoffmann wrote:

Compile the OVMF ResetVector with 5-level paging support in case
PcdUse5LevelPageTable is TRUE.

When enabled the ResetVector will check at runtime whenever support for
5-level paging and gigabyte pages is available.  In case both features
are supported it will run OVMF in 5-level paging mode, otherwise
fallback to 4-level paging.

Gigabyte pages are required to make sure we can fit the page tables into
the available space.  We have six pages available, four of them are
used.  The first gibabyte is mapped with 2M pages, the 1GB -> 4GB range
uses gigabyte pages.  See the source code comment for the exact layout.

In case TDX is used the TDX_WORK_AREA_PGTBL_READY will carry the
information whenever 5-level paging is used (2) or not (1), so the
APs can pick the correct paging mode.

Signed-off-by: Gerd Hoffmann 
---
  OvmfPkg/ResetVector/ResetVector.inf   |   1 +
  OvmfPkg/ResetVector/Ia32/IntelTdx.asm |  17 ++-
  OvmfPkg/ResetVector/Ia32/PageTables64.asm | 131 +-
  OvmfPkg/ResetVector/ResetVector.nasmb |   1 +
  4 files changed, 145 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/ResetVector/ResetVector.inf 
b/OvmfPkg/ResetVector/ResetVector.inf
index a4154ca90c28..65f71b05a02e 100644
--- a/OvmfPkg/ResetVector/ResetVector.inf
+++ b/OvmfPkg/ResetVector/ResetVector.inf
@@ -64,3 +64,4 @@ [FixedPcd]
gUefiOvmfPkgTokenSpaceGuid.PcdQemuHashTableSize
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable
diff --git a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm 
b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
index 06794baef81d..3e50ca76aacf 100644
--- a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
+++ b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
@@ -179,7 +179,7 @@ InitTdx:
  ;
  ; Modified:  EAX, EDX
  ;
-; 0-NonTdx, 1-TdxBsp, 2-TdxAps
+; 0-NonTdx, 1-TdxBsp, 2-TdxAps, 3-TdxApsLa57
  ;
  CheckTdxFeaturesBeforeBuildPagetables:
  xor eax, eax
@@ -204,6 +204,21 @@ TdxPostBuildPageTables:
  ExitTdxPostBuildPageTables:
  OneTimeCallRet TdxPostBuildPageTables
  
+%if PG_5_LEVEL

+
+;
+; Set byte[TDX_WORK_AREA_PGTBL_READY] to 2
+;
+TdxPostBuildPageTablesLa57:
+cmp byte[WORK_AREA_GUEST_TYPE], VM_GUEST_TDX
+jne ExitTdxPostBuildPageTablesLa57
+mov byte[TDX_WORK_AREA_PGTBL_READY], 2
+
+ExitTdxPostBuildPageTablesLa57:
+OneTimeCallRet TdxPostBuildPageTablesLa57
+
+%endif
+
  ;
  ; Check if TDX is enabled
  ;
diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm 
b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
index 6fec6f2beeea..21de75a40097 100644
--- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
+++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
@@ -42,8 +42,10 @@ BITS32
   PAGE_READ_WRITE + \
   PAGE_PRESENT)
  
+%define NOT_TDX 0

  %define TDX_BSP 1
  %define TDX_AP  2
+%define TDX_AP_LA57 3
  
  ;

  ; Modified:  EAX, EBX, ECX, EDX
@@ -55,11 +57,21 @@ SetCr3ForPageTables64:
  ; the page tables. APs will spin on until byte[TDX_WORK_AREA_PGTBL_READY]
  ; is set.
  OneTimeCall   CheckTdxFeaturesBeforeBuildPagetables
+cmp   eax, NOT_TDX
+jeCheckSev
  cmp   eax, TDX_BSP
  jeClearOvmfPageTables
+%if PG_5_LEVEL
  cmp   eax, TDX_AP
  jeSetCr3
+; TDX_AP_LA57 -> set cr4.la57
+mov   eax, cr4
+bts   eax, 12
+mov   cr4, eax
+%endif
+jmp   SetCr3
  
+CheckSev:

  ; Check whether the SEV is active and populate the SevEsWorkArea
  OneTimeCall   CheckSevFeatures
  
@@ -86,6 +98,105 @@ clearPageTablesMemoryLoop:

  mov dword[ecx * 4 + PT_ADDR (0) - 4], eax
  loopclearPageTablesMemoryLoop
  
+%if PG_5_LEVEL

+
+; save GetSevCBitMaskAbove31 result (cpuid changes edx)
+mov edi, edx
+
+; check for cpuid leaf 0x07
+mov eax, 0x00
+cpuid
+cmp eax, 0x07
+jb  Paging4Lvl
+
+; check for la57 (aka 5-level paging)
+mov eax, 0x07
+mov ecx, 0x00
+cpuid
+bt  ecx, 16
+jnc Paging4Lvl
+
+; check for cpuid leaf 0x8001
+mov eax, 0x8000
+cpuid
+cmp eax, 0x8001
+jb  Paging4Lvl
+
+; check for 1g pages
+mov eax, 0x8001
+cpuid
+bt  edx, 26
+jnc Paging4Lvl
+
+;
+; Use 5-level paging with gigabyte pages.
+;
+; We have 6 pages available for the early page tables,
+; we use four of them:
+;PT_ADDR(0)  - level 5 directory
+;PT_ADDR(0x1000) - level 4 directory
+;PT_ADDR(0x2000) - level 2 directory (0 -> 1GB)
+;PT_ADDR(0x3000) - level 3 directory
+;
+; The level 2 directory for the first gigabyte has the same
+; physical address in both 4-level and 5-level paging mode,
+; SevClearPageEncMaskForGhcbPage depends on this.
+;

Re: [edk2-devel] [Patch 3/4] BaseTools/Scripts/PatchCheck: Error if no Cc tags are present

2024-02-20 Thread Michael D Kinney
Hi Ard,

I suspected this one BZ/patch would get some discussion.

This is an attempt to address the fundamental issue that we do not
get timely reviews of patches.  When I look at the ones that are
delayed, in many cases, there are no Cc lines in the commit message
and no Cc in the email.

There are many times I have seen extra emails reminding the author
to Cc the maintainers/reviewers.

I agree that doing this in CI is not best location.

If a submitter does open a PR to use EDK II CI to test their
changes before sending email reviews, then it would help. If the
changes are sent for email review first, then it would not help.

Best regards,

Mike

> -Original Message-
> From: Ard Biesheuvel 
> Sent: Tuesday, February 20, 2024 6:49 AM
> To: devel@edk2.groups.io; Kinney, Michael D
> 
> Cc: Rebecca Cran ; Liming Gao
> ; Feng, Bob C ; Chen,
> Christine ; Michael Kubacki
> 
> Subject: Re: [edk2-devel] [Patch 3/4] BaseTools/Scripts/PatchCheck:
> Error if no Cc tags are present
> 
> Hello Mike,
> 
> I understand the desire to be pedantic about cc'ing the right
> maintainers, but I'm not convinced this is the way.
> 
> - the presence of a cc: tag does not guarantee that the person was
> cc'ed - only git send-email will take CC:s in the message body into
> account by default (but this can also be disabled), but generally, the
> sender has to ensure the cc list is copied into the cc: field
> - the absence of a cc: tag does not imply that the person was not
> cc'ed,
> 
> - in Linux, the cc: tag has slightly different semantics from the ones
> we appear to be assuming here: a cc tag in patch going into the
> repository is a statement by the maintainer that the person in
> question has been cc'ed, may have some 'jurisdiction' over the area,
> but hasn't bothered to respond. IOW, it is to record the fact that
> this person has been given the opportunity to respond.
> 
> Then there is the matter of a maintainer that has reviewed the patch
> themselves. I usually remove the cc lines listing people that have
> reviewed/acked/tested the patch, as those tags already convey that the
> person is aware of it cc'ed or not.
> 
> So perhaps it would be better to make this check part of the
> contributor workflow but not the GitHub PR/CI workflow?
> 
> 
> On Sun, 18 Feb 2024 at 22:00, Michael D Kinney
>  wrote:
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4694
> >
> > If no Cc tags are detected in a commit message, then generate an
> > error. All patches sent for review are required to provide the set
> > of maintainers and reviewers responsible for the directories/files
> > modified. The set of maintainers and reviewers are documented in
> > Maintainers.txt and can be retrieved using the script
> > BaseTools/Scripts/GetMaintainer.py.
> >
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Cc: Yuwei Chen 
> > Cc: Michael Kubacki 
> > Signed-off-by: Michael D Kinney 
> > ---
> >  BaseTools/Scripts/PatchCheck.py | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/BaseTools/Scripts/PatchCheck.py
> b/BaseTools/Scripts/PatchCheck.py
> > index 158a2b30a5ce..415198e3824e 100755
> > --- a/BaseTools/Scripts/PatchCheck.py
> > +++ b/BaseTools/Scripts/PatchCheck.py
> > @@ -229,8 +229,10 @@ class CommitMessageCheck:
> >  )
> >
> >  def check_misc_signatures(self):
> > -for sig in self.sig_types:
> > -self.find_signatures(sig)
> > +for sigtype in self.sig_types:
> > +sigs = self.find_signatures(sigtype)
> > +if sigtype == 'Cc' and len(sigs) == 0:
> > +self.error('No Cc: tags for maintainers/reviewers
> found!')
> >
> >  cve_re = re.compile('CVE-[0-9]{4}-[0-9]{5}[^0-9]')
> >
> > --
> > 2.40.1.windows.1
> >
> >
> >
> > 
> >
> >


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




[edk2-devel] [PATCH] MinPlatformPkg/DxePhatLib: Add to CoreCommon dsc

2024-02-20 Thread Clark-williams, Zachary
From: Zachary Clark-Williams 

PhatAcpiLib update to match all file names to DxePhatAcpiLib
and add the library to CoreCommonPkg for use.

Change-Id: I6e18ecf5acfdbc2053cf60b9a151b891e4e0fdfe
Hsd-es-id: 22019504949
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Zachary Clark-Williams 
---
 .../Library/{PhatAcpiLib => DxePhatAcpiLib}/DxePhatAcpiLib.c| 2 +-
 .../Library/{PhatAcpiLib => DxePhatAcpiLib}/DxePhatAcpiLib.inf  | 0
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
 .../Include/Library/{PhatAcpiLib.h => DxePhatAcpiLib.h} | 0
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec| 2 +-
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc| 2 +-
 6 files changed, 4 insertions(+), 3 deletions(-)
 rename Platform/Intel/MinPlatformPkg/Acpi/Library/{PhatAcpiLib => 
DxePhatAcpiLib}/DxePhatAcpiLib.c (96%)
 rename Platform/Intel/MinPlatformPkg/Acpi/Library/{PhatAcpiLib => 
DxePhatAcpiLib}/DxePhatAcpiLib.inf (100%)
 rename Platform/Intel/MinPlatformPkg/Include/Library/{PhatAcpiLib.h => 
DxePhatAcpiLib.h} (100%)

diff --git 
a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.c 
b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.c
similarity index 96%
rename from 
Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.c
rename to 
Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.c
index e0e502cf0..ebfc542a3 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.c
@@ -6,7 +6,7 @@
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
-#include 
+#include 
 
 #include 
 #include 
diff --git 
a/Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf 
b/Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.inf
similarity index 100%
rename from 
Platform/Intel/MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf
rename to 
Platform/Intel/MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.inf
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc 
b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
index 790fccf40..657a9decc 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
@@ -150,6 +150,7 @@
   
LargeVariableReadLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.inf
   
LargeVariableWriteLib|MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
   CompressLib|MinPlatformPkg/Library/CompressLib/CompressLib.inf
+  DxePhatAcpiLib|MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.inf
 
   #
   # CryptLib
diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/PhatAcpiLib.h 
b/Platform/Intel/MinPlatformPkg/Include/Library/DxePhatAcpiLib.h
similarity index 100%
rename from Platform/Intel/MinPlatformPkg/Include/Library/PhatAcpiLib.h
rename to Platform/Intel/MinPlatformPkg/Include/Library/DxePhatAcpiLib.h
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 09312d329..d006d7117 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -88,7 +88,7 @@
   LargeVariableReadLib|Include/Library/LargeVariableReadLib.h
   LargeVariableWriteLib|Include/Library/LargeVariableWriteLib.h
 
-  PhatAcpiLib|Include/Library/PhatAcpiLib.h
+  DxePhatAcpiLib|Include/Library/DxePhatAcpiLib.h
 
 [PcdsFixedAtBuild, PcdsPatchableInModule]
 
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 4b295babf..f9227e014 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -64,7 +64,7 @@
   
PciSegmentInfoLib|MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf
   
PlatformBootManagerLib|MinPlatformPkg/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   AslUpdateLib|MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf
-  PhatAcpiLib|MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.inf
+  DxePhatAcpiLib|MinPlatformPkg/Acpi/Library/DxePhatAcpiLib/DxePhatAcpiLib.inf
 
   #
   # Misc
-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH v3 4/6] OvmfPkg/ResetVector: SEV: keep #vc handler installed longer

2024-02-20 Thread Lendacky, Thomas via groups.io

On 2/20/24 03:06, Gerd Hoffmann wrote:

When running in SEV mode do not uninstall the #vc handler in
CheckSevFeatures.   Keep it active and uninstall it later in
SevClearPageEncMaskForGhcbPage.

This allows using the cpuid instruction in SetCr3ForPageTables64,
which is needed to check for la57 & 1G page support.

Signed-off-by: Gerd Hoffmann 


I think a comment should be added above where the #VC handler is 
established to document that the #VC handler is removed at the end of this 
function if SEV is not active or that it remains installed to support 
CPUID calls, e.g. to check for 5-level paging support, and is removed 
later in SevClearPageEncMaskForGhcbPage().


With that,

Reviewed-by: Tom Lendacky 


---
  OvmfPkg/ResetVector/Ia32/AmdSev.asm | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm 
b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
index 043c88a7abbe..02f287f1d934 100644
--- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm
+++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
@@ -158,6 +158,11 @@ SevClearPageEncMaskForGhcbPage:
  cmp   byte[WORK_AREA_GUEST_TYPE], 1
  jnz   SevClearPageEncMaskForGhcbPageExit
  
+; Clear exception handlers and stack

+mov   eax, ADDR_OF(IdtrClear)
+lidt  [cs:eax]
+mov   esp, 0
+
  ; Check if SEV-ES is enabled
  mov   ecx, 1
  bt[SEV_ES_WORK_AREA_STATUS_MSR], ecx
@@ -332,7 +337,6 @@ NoSevEsVcHlt:
  NoSevPass:
  xor   eax, eax
  
-SevExit:

  ;
  ; Clear exception handlers and stack
  ;
@@ -342,6 +346,7 @@ SevExit:
  pop   eax
  mov   esp, 0
  
+SevExit:

  OneTimeCallRet CheckSevFeatures
  
  ; Start of #VC exception handling routines



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




Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

2024-02-20 Thread Hsueh, Hong-Chih (Neo) via groups.io
[AMD Official Use Only - General]

Hi Feng & Laszlo,

Thank you for the feedback, I have changed the title of this email and the 
title of the commit message of this patch.
The new patch as attached. If this patch looks good to you, could you please 
help to add reviewed-by?

Thanks!

Regards,
Neo


From: Ding, Feng (Sunnyvale) 
Sent: Thursday, February 8, 2024 5:09 PM
To: Laszlo Ersek ; devel@edk2.groups.io 
; Hsueh, Hong-Chih (Neo) 
Cc: He, Jiangang ; Chang, Abner ; 
ray...@intel.com ; gaolim...@byosoft.com.cn 
; Gopal, Pradeep 
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug 
functionality for USB4 bridge

[AMD Official Use Only - General]

Hi Laszlo,

" MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug " 
is perfect description for the issue.
"a root bridge" is "a (PCIe Hotplug) bridge", locating anywhere.

Thanks
feng

-Original Message-
From: Laszlo Ersek 
Sent: Wednesday, February 7, 2024 12:51 PM
To: devel@edk2.groups.io; Hsueh, Hong-Chih (Neo) 
Cc: Ding, Feng (Sunnyvale) ; He, Jiangang 
; Chang, Abner ; ray...@intel.com; 
gaolim...@byosoft.com.cn
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Fix hotplug 
functionality for USB4 bridge

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


On 2/6/24 23:34, Hsueh, Hong-Chih (Neo) via groups.io wrote:
> A USB4 or TBT bridge can be plugged or unplugged on USB4 port. The actions 
> require PciHotPlugRequestNotify to add a root bridge or remove a root bridge 
> completely.
> In the plug-unplug-plug scenerio, PciHotPlugRequestNotify will return with 
> no-action on second plug because bridge tree shows configured.
> Destroy Pci Device Tree in function PciHotPlugRequestNotify for unplug event 
> to fix this issue.
>
> Cc: Feng Ding 
> Cc: Jiangang He 
> Signed-off-by: Neo Hsueh 
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c 
> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> index 3f8c6e6da7..2b7af60e0a 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
> @@ -2103,6 +2103,8 @@ PciHotPlugRequestNotify (
>}
>  }
>
> +DestroyPciDeviceTree (Bridge);
> +
>  //
>  // End for
>  //

I think the subject line is too specific. This patch appears to fix a general 
resource leak in the PCI hot-unplug functionality. Writing up the USB4 angle in 
the commit message is welcome in my opinion, but the subject should state 
something like:

MdeModulePkg/PciBusDxe: plug device hierarchy leak upon bridge hot-unplug

(And I think the bridge doesn't even have to be a *root* bridge for the leak to 
occur; is that right?)

Laszlo



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




0001-MdeModulePkg-PciBusDxe-plug-device-hierarchy-leak-up.patch
Description:  0001-MdeModulePkg-PciBusDxe-plug-device-hierarchy-leak-up.patch


Re: [edk2-devel] [PATCH 2/2] Update Maintainers for Intel packages

2024-02-20 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Haller, Nathaniel D 
> Sent: Friday, February 16, 2024 5:48 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Chiu, Chasel
> 
> Subject: [PATCH 2/2] Update Maintainers for Intel packages
> 
> Update PurleySiliconBinPkg, WhitleyOpenBoardBinPkg, and WhitleySiliconBinPkg
> maintainers.
> 
> Cc: Nate DeSimone 
> Cc: Chasel Chiu 
> Signed-off-by: Nathaniel Haller 
> ---
>  Maintainers.txt | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt index 66ac96d..eaf13fd 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -46,9 +46,9 @@ M: Chasel Chiu 
>  M: Nate DeSimone 
> 
>  Platform/Intel/WhitleyOpenBoardBinPkg
> -M: Isaac Oram 
>  M: Nate DeSimone 
>  M: Chasel Chiu 
> +M: Nathaniel Haller 
> 
>  Platform/Intel/EaglestreamOpenBoardBinPkg
>  M: Nate DeSimone  @@ -87,11 +87,12 @@
> M: Sai Chaganty 
> 
>  Silicon/Intel/PurleySiliconBinPkg
>  M: Nate DeSimone 
> -M: Isaac W Oram 
> +M: Chasel Chiu 
> 
>  Silicon/Intel/WhitleySiliconBinPkg
>  M: Nate DeSimone 
> -M: Isaac W Oram 
> +M: Chasel Chiu 
> +M: Nathaniel Haller 
> 
>  Silicon/Intel/EaglestreamSiliconBinPkg
>  M: Nate DeSimone 
> --
> 2.43.0.windows.1



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




Re: [edk2-devel] [PATCH 1/2] Add maintainers for EaglestreamSiliconBinPkg and EaglestreamOpenBoardBinPkg

2024-02-20 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Haller, Nathaniel D 
> Sent: Friday, February 16, 2024 5:47 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Chiu, Chasel
> 
> Subject: [PATCH 1/2] Add maintainers for EaglestreamSiliconBinPkg and
> EaglestreamOpenBoardBinPkg
> 
> Cc: Nate DeSimone 
> Cc: Chasel Chiu 
> Signed-off-by: Nathaniel Haller 
> ---
>  Maintainers.txt | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt index 1d5dacb..66ac96d 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -50,6 +50,11 @@ M: Isaac Oram 
>  M: Nate DeSimone 
>  M: Chasel Chiu 
> 
> +Platform/Intel/EaglestreamOpenBoardBinPkg
> +M: Nate DeSimone 
> +M: Chasel Chiu 
> +M: Nathaniel Haller 
> +
>  Platform/Intel/CoffeelakeSiliconBinPkg
>  M: Chasel Chiu 
>  M: Sai Chaganty  @@ -88,6 +93,11 @@
> Silicon/Intel/WhitleySiliconBinPkg
>  M: Nate DeSimone 
>  M: Isaac W Oram 
> 
> +Silicon/Intel/EaglestreamSiliconBinPkg
> +M: Nate DeSimone 
> +M: Chasel Chiu 
> +M: Nathaniel Haller 
> +
>  Silicon/Intel/QuarkSocBinPkg
>  M: Michael D Kinney 
>  M: Kelly Steele 
> --
> 2.43.0.windows.1



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




Re: [edk2-devel] [PATCH 2/2] Update Maintainers for Intel packages

2024-02-20 Thread Nate DeSimone
As mentioned by Mike K, please add [edk2-non-osi] to the subject line in the 
future.

Reviewed-by: Nate DeSimone 

> -Original Message-
> From: Haller, Nathaniel D 
> Sent: Friday, February 16, 2024 5:48 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Chiu, Chasel
> 
> Subject: [PATCH 2/2] Update Maintainers for Intel packages
> 
> Update PurleySiliconBinPkg, WhitleyOpenBoardBinPkg, and
> WhitleySiliconBinPkg maintainers.
> 
> Cc: Nate DeSimone 
> Cc: Chasel Chiu 
> Signed-off-by: Nathaniel Haller 
> ---
>  Maintainers.txt | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt index 66ac96d..eaf13fd 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -46,9 +46,9 @@ M: Chasel Chiu 
>  M: Nate DeSimone 
> 
>  Platform/Intel/WhitleyOpenBoardBinPkg
> -M: Isaac Oram 
>  M: Nate DeSimone 
>  M: Chasel Chiu 
> +M: Nathaniel Haller 
> 
>  Platform/Intel/EaglestreamOpenBoardBinPkg
>  M: Nate DeSimone  @@ -87,11 +87,12
> @@ M: Sai Chaganty 
> 
>  Silicon/Intel/PurleySiliconBinPkg
>  M: Nate DeSimone 
> -M: Isaac W Oram 
> +M: Chasel Chiu 
> 
>  Silicon/Intel/WhitleySiliconBinPkg
>  M: Nate DeSimone 
> -M: Isaac W Oram 
> +M: Chasel Chiu 
> +M: Nathaniel Haller 
> 
>  Silicon/Intel/EaglestreamSiliconBinPkg
>  M: Nate DeSimone 
> --
> 2.43.0.windows.1



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




Re: [edk2-devel] [PATCH 1/2] Add maintainers for EaglestreamSiliconBinPkg and EaglestreamOpenBoardBinPkg

2024-02-20 Thread Nate DeSimone
As mentioned by Mike K, please add [edk2-non-osi] to the subject line in the 
future.

Reviewed-by: Nate DeSimone 

> -Original Message-
> From: Haller, Nathaniel D 
> Sent: Friday, February 16, 2024 5:47 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Chiu, Chasel
> 
> Subject: [PATCH 1/2] Add maintainers for EaglestreamSiliconBinPkg and
> EaglestreamOpenBoardBinPkg
> 
> Cc: Nate DeSimone 
> Cc: Chasel Chiu 
> Signed-off-by: Nathaniel Haller 
> ---
>  Maintainers.txt | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt index 1d5dacb..66ac96d 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -50,6 +50,11 @@ M: Isaac Oram 
>  M: Nate DeSimone 
>  M: Chasel Chiu 
> 
> +Platform/Intel/EaglestreamOpenBoardBinPkg
> +M: Nate DeSimone 
> +M: Chasel Chiu 
> +M: Nathaniel Haller 
> +
>  Platform/Intel/CoffeelakeSiliconBinPkg
>  M: Chasel Chiu 
>  M: Sai Chaganty  @@ -88,6 +93,11 @@
> Silicon/Intel/WhitleySiliconBinPkg
>  M: Nate DeSimone 
>  M: Isaac W Oram 
> 
> +Silicon/Intel/EaglestreamSiliconBinPkg
> +M: Nate DeSimone 
> +M: Chasel Chiu 
> +M: Nathaniel Haller 
> +
>  Silicon/Intel/QuarkSocBinPkg
>  M: Michael D Kinney 
>  M: Kelly Steele 
> --
> 2.43.0.windows.1



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




Re: [edk2-devel] [PATCH v3 5/6] OvmfPkg/ResetVector: add 5-level paging support

2024-02-20 Thread Laszlo Ersek
On 2/20/24 18:45, Laszlo Ersek wrote:

> (I'm using quotes around "subroutines" and "call" because we don't have
> a stack at this point yet, IIUC, so all our "one time calls" are
> actually just normal jumps, with some NASM macro magic. That's fine,
> we're only talking a handful of assembly instructions here, so
> readability definitely trumps code path reuse. SECFV only contains
> SecMain and ResetVector, and it's only 26% full -- 56K used, 152K free,
> out of 208K total.)

Sorry, those numbers were for IA32X64, which is not right for this
discussion -- we need to look at X64.

NOOPT GCC5 X64 is:

SECFV [49%Full] 212992 (0x34000) total, 106000 (0x19e10) used, 106992
(0x1a1f0) free

That should still be plenty roomy for disentangling all three code paths
here.

Laszlo



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




[edk2-devel] [PATCH v2 5/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SaveCpuMpData()

2024-02-20 Thread Gerd Hoffmann
Add support for splitting Hand-Off data into multiple HOBs.  This is
required for VMs with thousands of CPUs.  The actual CPU count per HOB
is much smaller (128) for better test coverage.

Signed-off-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 44 +++--
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c 
b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
index f80e00edcff3..8a916a218016 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
@@ -126,35 +126,45 @@ SaveCpuMpData (
   IN CPU_MP_DATA  *CpuMpData
   )
 {
+  UINT32   MaxCpusPerHob, CpusInHob;
   UINT64   Data64;
-  UINTNIndex;
+  UINT32   Index, HobBase;
   CPU_INFO_IN_HOB  *CpuInfoInHob;
   MP_HAND_OFF  *MpHandOff;
   UINTNMpHandOffSize;
 
+  MaxCpusPerHob = (MAX_UINT16 - sizeof (EFI_HOB_GUID_TYPE) - sizeof 
(MP_HAND_OFF)) / sizeof (PROCESSOR_HAND_OFF);
+
   //
   // When APs are in a state that can be waken up by a store operation to a 
memory address,
   // report the MP_HAND_OFF data for DXE to use.
   //
-  CpuInfoInHob  = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
-  MpHandOffSize = sizeof (MP_HAND_OFF) + sizeof (PROCESSOR_HAND_OFF) * 
CpuMpData->CpuCount;
-  MpHandOff = (MP_HAND_OFF *)BuildGuidHob (, MpHandOffSize);
-  ASSERT (MpHandOff != NULL);
-  ZeroMem (MpHandOff, MpHandOffSize);
-  MpHandOff->ProcessorIndex = 0;
+  CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
 
-  MpHandOff->CpuCount = CpuMpData->CpuCount;
-  if (CpuMpData->ApLoopMode != ApInHltLoop) {
-MpHandOff->StartupSignalValue= MP_HAND_OFF_SIGNAL;
-MpHandOff->WaitLoopExecutionMode = sizeof (VOID *);
-  }
+  for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
+if (Index % MaxCpusPerHob == 0) {
+  HobBase   = Index;
+  CpusInHob = MIN (CpuMpData->CpuCount - HobBase, MaxCpusPerHob);
 
-  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
-MpHandOff->Info[Index].ApicId = CpuInfoInHob[Index].ApicId;
-MpHandOff->Info[Index].Health = CpuInfoInHob[Index].Health;
+  MpHandOffSize = sizeof (MP_HAND_OFF) + sizeof (PROCESSOR_HAND_OFF) * 
CpusInHob;
+  MpHandOff = (MP_HAND_OFF *)BuildGuidHob (, 
MpHandOffSize);
+  ASSERT (MpHandOff != NULL);
+  ZeroMem (MpHandOff, MpHandOffSize);
+
+  MpHandOff->ProcessorIndex = HobBase;
+  MpHandOff->CpuCount   = CpusInHob;
+
+  if (CpuMpData->ApLoopMode != ApInHltLoop) {
+MpHandOff->StartupSignalValue= MP_HAND_OFF_SIGNAL;
+MpHandOff->WaitLoopExecutionMode = sizeof (VOID *);
+  }
+}
+
+MpHandOff->Info[Index-HobBase].ApicId = CpuInfoInHob[Index].ApicId;
+MpHandOff->Info[Index-HobBase].Health = CpuInfoInHob[Index].Health;
 if (CpuMpData->ApLoopMode != ApInHltLoop) {
-  MpHandOff->Info[Index].StartupSignalAddress= 
(UINT64)(UINTN)CpuMpData->CpuData[Index].StartupApSignal;
-  MpHandOff->Info[Index].StartupProcedureAddress = 
(UINT64)(UINTN)>CpuData[Index].ApFunction;
+  MpHandOff->Info[Index-HobBase].StartupSignalAddress= 
(UINT64)(UINTN)CpuMpData->CpuData[Index].StartupApSignal;
+  MpHandOff->Info[Index-HobBase].StartupProcedureAddress = 
(UINT64)(UINTN)>CpuData[Index].ApFunction;
 }
   }
 
-- 
2.43.2



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




[edk2-devel] [PATCH v2 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber()

2024-02-20 Thread Gerd Hoffmann
Rename the MpHandOff parameter to FirstMpHandOff.  Add a loop so the
function inspects all HOBs present in the system.

Signed-off-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index e764bc9e4228..8f198ff6d817 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1894,26 +1894,33 @@ CheckAllAPs (
 /**
   This function Get BspNumber.
 
-  @param[in] MpHandOffPointer to MpHandOff
+  @param[in] FirstMpHandOff   Pointer to first MpHandOff HOB.
   @return BspNumber
 **/
 UINT32
 GetBspNumber (
-  IN CONST MP_HAND_OFF  *MpHandOff
+  IN CONST MP_HAND_OFF  *FirstMpHandOff
   )
 {
-  UINT32  ApicId;
-  UINT32  BspNumber;
-  UINT32  Index;
+  UINT32 ApicId;
+  UINT32 BspNumber;
+  UINT32 Index;
+  CONST MP_HAND_OFF  *MpHandOff;
 
   //
   // Get the processor number for the BSP
   //
   BspNumber = MAX_UINT32;
   ApicId= GetInitialApicId ();
-  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
-if (MpHandOff->Info[Index].ApicId == ApicId) {
-  BspNumber = Index;
+
+  for (MpHandOff = FirstMpHandOff;
+   MpHandOff != NULL;
+   MpHandOff = GetNextMpHandOffHob (MpHandOff))
+  {
+for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
+  if (MpHandOff->Info[Index].ApicId == ApicId) {
+BspNumber = MpHandOff->ProcessorIndex + Index;
+  }
 }
   }
 
-- 
2.43.2



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




[edk2-devel] [PATCH v2 4/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to MpInitLibInitialize

2024-02-20 Thread Gerd Hoffmann
Loop over all MP_HAND_OFF HOBs instead of expecting a single HOB
covering all CPUs in the system.

Add a new HaveMpHandOff variable to track whenever MP_HAND_OFF HOBs are
present, using the MpHandOff pointer for that does not work because the
variable will be NULL after looping over all HOBs.

Signed-off-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 68 +++-
 1 file changed, 47 insertions(+), 21 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index c13de34e5769..80585f676b1d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -2025,6 +2025,7 @@ MpInitLibInitialize (
   VOID
   )
 {
+  MP_HAND_OFF  *FirstMpHandOff;
   MP_HAND_OFF  *MpHandOff;
   CPU_INFO_IN_HOB  *CpuInfoInHob;
   UINT32   MaxLogicalProcessorNumber;
@@ -2038,17 +2039,31 @@ MpInitLibInitialize (
   CPU_MP_DATA  *CpuMpData;
   UINT8ApLoopMode;
   UINT8*MonitorBuffer;
-  UINTNIndex;
+  UINT32   Index, HobIndex;
   UINTNApResetVectorSizeBelow1Mb;
   UINTNApResetVectorSizeAbove1Mb;
   UINTNBackupBufferAddr;
   UINTNApIdtBase;
 
-  MpHandOff = GetNextMpHandOffHob (NULL);
-  if (MpHandOff == NULL) {
+  FirstMpHandOff = GetNextMpHandOffHob (NULL);
+  if (FirstMpHandOff != NULL) {
+MaxLogicalProcessorNumber = 0;
+for (MpHandOff = FirstMpHandOff;
+ MpHandOff != NULL;
+ MpHandOff = GetNextMpHandOffHob (MpHandOff))
+{
+  DEBUG ((
+DEBUG_INFO,
+"%a: ProcessorIndex=%u CpuCount=%u\n",
+__func__,
+MpHandOff->ProcessorIndex,
+MpHandOff->CpuCount
+));
+  ASSERT (MaxLogicalProcessorNumber == MpHandOff->ProcessorIndex);
+  MaxLogicalProcessorNumber += MpHandOff->CpuCount;
+}
+  } else {
 MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
-  } else {
-MaxLogicalProcessorNumber = MpHandOff->CpuCount;
   }
 
   ASSERT (MaxLogicalProcessorNumber != 0);
@@ -2192,7 +2207,7 @@ MpInitLibInitialize (
   //
   ProgramVirtualWireMode ();
 
-  if (MpHandOff == NULL) {
+  if (FirstMpHandOff == NULL) {
 if (MaxLogicalProcessorNumber > 1) {
   //
   // Wakeup all APs and calculate the processor count in system
@@ -2208,21 +2223,32 @@ MpInitLibInitialize (
   AmdSevUpdateCpuMpData (CpuMpData);
 }
 
-CpuMpData->CpuCount  = MpHandOff->CpuCount;
-CpuMpData->BspNumber = GetBspNumber (MpHandOff);
+CpuMpData->CpuCount  = MaxLogicalProcessorNumber;
+CpuMpData->BspNumber = GetBspNumber (FirstMpHandOff);
 CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
-for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
-  InitializeSpinLock (>CpuData[Index].ApLock);
-  CpuMpData->CpuData[Index].CpuHealthy = (MpHandOff->Info[Index].Health == 
0) ? TRUE : FALSE;
-  CpuMpData->CpuData[Index].ApFunction = 0;
-  CpuInfoInHob[Index].InitialApicId= MpHandOff->Info[Index].ApicId;
-  CpuInfoInHob[Index].ApTopOfStack = CpuMpData->Buffer + (Index + 1) * 
CpuMpData->CpuApStackSize;
-  CpuInfoInHob[Index].ApicId   = MpHandOff->Info[Index].ApicId;
-  CpuInfoInHob[Index].Health   = MpHandOff->Info[Index].Health;
+for (MpHandOff = FirstMpHandOff;
+ MpHandOff != NULL;
+ MpHandOff = GetNextMpHandOffHob (MpHandOff))
+{
+  for (HobIndex = 0; HobIndex < MpHandOff->CpuCount; HobIndex++) {
+Index = MpHandOff->ProcessorIndex + HobIndex;
+InitializeSpinLock (>CpuData[Index].ApLock);
+CpuMpData->CpuData[Index].CpuHealthy = 
(MpHandOff->Info[HobIndex].Health == 0) ? TRUE : FALSE;
+CpuMpData->CpuData[Index].ApFunction = 0;
+CpuInfoInHob[Index].InitialApicId= 
MpHandOff->Info[HobIndex].ApicId;
+CpuInfoInHob[Index].ApTopOfStack = CpuMpData->Buffer + (Index + 1) 
* CpuMpData->CpuApStackSize;
+CpuInfoInHob[Index].ApicId   = 
MpHandOff->Info[HobIndex].ApicId;
+CpuInfoInHob[Index].Health   = 
MpHandOff->Info[HobIndex].Health;
+  }
 }
 
-DEBUG ((DEBUG_INFO, "MpHandOff->WaitLoopExecutionMode: %04d, sizeof (VOID 
*): %04d\n", MpHandOff->WaitLoopExecutionMode, sizeof (VOID *)));
-if (MpHandOff->WaitLoopExecutionMode == sizeof (VOID *)) {
+DEBUG ((
+  DEBUG_INFO,
+  "FirstMpHandOff->WaitLoopExecutionMode: %04d, sizeof (VOID *): %04d\n",
+  FirstMpHandOff->WaitLoopExecutionMode,
+  sizeof (VOID *)
+  ));
+if (FirstMpHandOff->WaitLoopExecutionMode == sizeof (VOID *)) {
   ASSERT (CpuMpData->ApLoopMode != ApInHltLoop);
 
   CpuMpData->FinishedCount= 0;
@@ -2238,7 +2264,7 @@ MpInitLibInitialize (
   // enables the APs to switch to a different memory section 

[edk2-devel] [PATCH v2 1/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetMpHandOffHob

2024-02-20 Thread Gerd Hoffmann
Rename the function to GetNextMpHandOffHob(), add MP_HAND_OFF parameter.
When called with NULL pointer return the first HOB, otherwise return the
next in the chain.

Also add the function prototype to the MpLib.h header file.

Signed-off-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.h | 12 
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 26 --
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index a96a6389c17d..bc2a0232291d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -485,6 +485,18 @@ SwitchApContext (
   IN MP_HAND_OFF  *MpHandOff
   );
 
+/**
+  Get pointer to next MP_HAND_OFF GUIDed HOB.
+
+  @param[in] MpHandOff  Previous HOB.  Pass NULL to get the first HOB.
+
+  @return  The pointer to MP_HAND_OFF structure.
+**/
+MP_HAND_OFF *
+GetNextMpHandOffHob (
+  IN CONST MP_HAND_OFF  *MpHandOff
+  );
+
 /**
   Get available EfiBootServicesCode memory below 4GB by specified size.
 
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index cdfb570e61a0..e764bc9e4228 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1961,25 +1961,31 @@ SwitchApContext (
 }
 
 /**
-  Get pointer to MP_HAND_OFF GUIDed HOB.
+  Get pointer to next MP_HAND_OFF GUIDed HOB.
+
+  @param[in] MpHandOff  Previous HOB.  Pass NULL to get the first HOB.
 
   @return  The pointer to MP_HAND_OFF structure.
 **/
 MP_HAND_OFF *
-GetMpHandOffHob (
-  VOID
+GetNextMpHandOffHob (
+  IN CONST MP_HAND_OFF  *MpHandOff
   )
 {
   EFI_HOB_GUID_TYPE  *GuidHob;
-  MP_HAND_OFF*MpHandOff;
 
-  MpHandOff = NULL;
-  GuidHob   = GetFirstGuidHob ();
-  if (GuidHob != NULL) {
-MpHandOff = (MP_HAND_OFF *)GET_GUID_HOB_DATA (GuidHob);
+  if (MpHandOff == NULL) {
+GuidHob = GetFirstGuidHob ();
+  } else {
+GuidHob = (VOID *)(((UINT8 *)MpHandOff) - sizeof (EFI_HOB_GUID_TYPE));
+GuidHob = GetNextGuidHob (, GET_NEXT_HOB (GuidHob));
   }
 
-  return MpHandOff;
+  if (GuidHob == NULL) {
+return NULL;
+  }
+
+  return (MP_HAND_OFF *)GET_GUID_HOB_DATA (GuidHob);
 }
 
 /**
@@ -2020,7 +2026,7 @@ MpInitLibInitialize (
   UINTNBackupBufferAddr;
   UINTNApIdtBase;
 
-  MpHandOff = GetMpHandOffHob ();
+  MpHandOff = GetNextMpHandOffHob (NULL);
   if (MpHandOff == NULL) {
 MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
   } else {
-- 
2.43.2



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




[edk2-devel] [PATCH v2 0/5] UefiCpuPkg/MpInitLib: Add support for multiple MP_HAND_OFF HOBs

2024-02-20 Thread Gerd Hoffmann
Needed to boot guests with thousands of vcpus.

v2:
 - rework HOB loops for better performance: O(n) instead of O(n^2).

Gerd Hoffmann (5):
  UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetMpHandOffHob
  UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber()
  UefiCpuPkg/MpInitLib: Add support for multiple HOBs to
SwitchApContext()
  UefiCpuPkg/MpInitLib: Add support for multiple HOBs to
MpInitLibInitialize
  UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SaveCpuMpData()

 UefiCpuPkg/Library/MpInitLib/MpLib.h|  14 ++-
 UefiCpuPkg/Library/MpInitLib/MpLib.c| 150 
 UefiCpuPkg/Library/MpInitLib/PeiMpLib.c |  44 ---
 3 files changed, 140 insertions(+), 68 deletions(-)

-- 
2.43.2



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




[edk2-devel] [PATCH v2 3/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SwitchApContext()

2024-02-20 Thread Gerd Hoffmann
Rename the MpHandOff parameter to FirstMpHandOff.  Add loops so the
function inspects all HOBs present in the system.

Signed-off-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.h |  2 +-
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 35 ++--
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index bc2a0232291d..b5214b904b41 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -482,7 +482,7 @@ GetWakeupBuffer (
 **/
 VOID
 SwitchApContext (
-  IN MP_HAND_OFF  *MpHandOff
+  IN CONST MP_HAND_OFF  *FirstMpHandOff
   );
 
 /**
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 8f198ff6d817..c13de34e5769 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1938,31 +1938,42 @@ GetBspNumber (
   This procedure allows the AP to switch to another section of
   memory and continue its loop there.
 
-  @param[in] MpHandOff  Pointer to MP hand-off data structure.
+  @param[in] FirstMpHandOff  Pointer to first MP hand-off HOB.
 **/
 VOID
 SwitchApContext (
-  IN MP_HAND_OFF  *MpHandOff
+  IN CONST MP_HAND_OFF  *FirstMpHandOff
   )
 {
-  UINTN   Index;
-  UINT32  BspNumber;
+  UINTN  Index;
+  UINT32 BspNumber;
+  CONST MP_HAND_OFF  *MpHandOff;
 
-  BspNumber = GetBspNumber (MpHandOff);
+  BspNumber = GetBspNumber (FirstMpHandOff);
 
-  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
-if (Index != BspNumber) {
-  *(UINTN *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress = 
(UINTN)SwitchContextPerAp;
-  *(UINT32 *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress   = 
MpHandOff->StartupSignalValue;
+  for (MpHandOff = FirstMpHandOff;
+   MpHandOff != NULL;
+   MpHandOff = GetNextMpHandOffHob (MpHandOff))
+  {
+for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
+  if (MpHandOff->ProcessorIndex + Index != BspNumber) {
+*(UINTN *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress = 
(UINTN)SwitchContextPerAp;
+*(UINT32 *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress   = 
MpHandOff->StartupSignalValue;
+  }
 }
   }
 
   //
   // Wait all APs waken up if this is not the 1st broadcast of SIPI
   //
-  for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
-if (Index != BspNumber) {
-  WaitApWakeup ((UINT32 
*)(UINTN)(MpHandOff->Info[Index].StartupSignalAddress));
+  for (MpHandOff = FirstMpHandOff;
+   MpHandOff != NULL;
+   MpHandOff = GetNextMpHandOffHob (MpHandOff))
+  {
+for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
+  if (MpHandOff->ProcessorIndex + Index != BspNumber) {
+WaitApWakeup ((UINT32 
*)(UINTN)(MpHandOff->Info[Index].StartupSignalAddress));
+  }
 }
   }
 }
-- 
2.43.2



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




Re: [edk2-devel] [PATCH v3 5/6] OvmfPkg/ResetVector: add 5-level paging support

2024-02-20 Thread Laszlo Ersek
On 2/20/24 10:06, Gerd Hoffmann wrote:
> Compile the OVMF ResetVector with 5-level paging support in case
> PcdUse5LevelPageTable is TRUE.
> 
> When enabled the ResetVector will check at runtime whenever support for
> 5-level paging and gigabyte pages is available.  In case both features
> are supported it will run OVMF in 5-level paging mode, otherwise
> fallback to 4-level paging.
> 
> Gigabyte pages are required to make sure we can fit the page tables into
> the available space.  We have six pages available, four of them are
> used.  The first gibabyte is mapped with 2M pages, the 1GB -> 4GB range
> uses gigabyte pages.  See the source code comment for the exact layout.
> 
> In case TDX is used the TDX_WORK_AREA_PGTBL_READY will carry the
> information whenever 5-level paging is used (2) or not (1), so the
> APs can pick the correct paging mode.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  OvmfPkg/ResetVector/ResetVector.inf   |   1 +
>  OvmfPkg/ResetVector/Ia32/IntelTdx.asm |  17 ++-
>  OvmfPkg/ResetVector/Ia32/PageTables64.asm | 131 +-
>  OvmfPkg/ResetVector/ResetVector.nasmb |   1 +
>  4 files changed, 145 insertions(+), 5 deletions(-)

I'm sorry, but this is awful. The stuff in "PageTables64.asm" is now the
definition of spaghetti code. I find it nearly impossible to follow the
code through the forest of jumps.

For example, we have a label called "PageTablesReady", but nothing jumps
to it.

At this point I'd much prefer if we *didn't* try to reuse common page
table building code in this fashion, between TDX, SEV, and no-CC. IMO it
would be better to factor the common code out to a new "subroutine", in
a separate file, and then create a minimal and succinct high-level file
that deals with nothing but control flow / feature detection between
TDX, SEV, and neither. The current code mixes that kind of feature
checking, 5-level paging macro checking, and actual page table building
/ CR configuration.

Basically I'm proposing to implement a high-level assembly file that
reads like the following C pseudo-code:

  Val = CheckTdx ();
  if (!Val) {
goto Sev;
  }
  SetupTdx ();
  goto Done;

Sev:
  Val = CheckSev ();
  if (!Val) {
goto NoCC;
  }
  SetupSev ();
  goto Done;

NoCC:
  SetupNoCc ();

Done:
  ...

And then CheckTdx() and CheckSev() would be standalone, separate
"subroutines", and SetupTdx(), SetupSev(), SetupNoCc() *too* would be
standalone, separate "subroutines". If the latter three would like to do
some stuff commonly, then they should "call" common "sub-subroutines",
or if that's not possible, then -- for all I care -- even *triplicate*
the common code, using NASM macros!

(I'm using quotes around "subroutines" and "call" because we don't have
a stack at this point yet, IIUC, so all our "one time calls" are
actually just normal jumps, with some NASM macro magic. That's fine,
we're only talking a handful of assembly instructions here, so
readability definitely trumps code path reuse. SECFV only contains
SecMain and ResetVector, and it's only 26% full -- 56K used, 152K free,
out of 208K total.)

The prime candidates for those "sub-subroutines" (or macros) are
"ClearOvmfPageTables", the 5-level page tree population, and the 4-level
page tree population.

Because, again, this level of code reuse, while I'm sure is brilliant,
functionally correct, and frugal with reset vector footprint, is also
super hard to read and maintain.

That's my opinion anyway.
Laszlo

> 
> diff --git a/OvmfPkg/ResetVector/ResetVector.inf 
> b/OvmfPkg/ResetVector/ResetVector.inf
> index a4154ca90c28..65f71b05a02e 100644
> --- a/OvmfPkg/ResetVector/ResetVector.inf
> +++ b/OvmfPkg/ResetVector/ResetVector.inf
> @@ -64,3 +64,4 @@ [FixedPcd]
>gUefiOvmfPkgTokenSpaceGuid.PcdQemuHashTableSize
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable
> diff --git a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm 
> b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
> index 06794baef81d..3e50ca76aacf 100644
> --- a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
> +++ b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
> @@ -179,7 +179,7 @@ InitTdx:
>  ;
>  ; Modified:  EAX, EDX
>  ;
> -; 0-NonTdx, 1-TdxBsp, 2-TdxAps
> +; 0-NonTdx, 1-TdxBsp, 2-TdxAps, 3-TdxApsLa57
>  ;
>  CheckTdxFeaturesBeforeBuildPagetables:
>  xor eax, eax
> @@ -204,6 +204,21 @@ TdxPostBuildPageTables:
>  ExitTdxPostBuildPageTables:
>  OneTimeCallRet TdxPostBuildPageTables
>  
> +%if PG_5_LEVEL
> +
> +;
> +; Set byte[TDX_WORK_AREA_PGTBL_READY] to 2
> +;
> +TdxPostBuildPageTablesLa57:
> +cmp byte[WORK_AREA_GUEST_TYPE], VM_GUEST_TDX
> +jne ExitTdxPostBuildPageTablesLa57
> +mov byte[TDX_WORK_AREA_PGTBL_READY], 2
> +
> +ExitTdxPostBuildPageTablesLa57:
> +OneTimeCallRet TdxPostBuildPageTablesLa57
> +
> +%endif
> +
>  ;
>  ; Check if TDX is enabled
>  ;
> diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm 
> 

Re: [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver earlier in DXE

2024-02-20 Thread Michael D Kinney
This is a UEFI Driver that depends on the Driver Binding Protocol
and use of ConnectController(). These drivers cannot be used
until the BDS phase when the active consoles and boot devices
are evaluated and the smallest set of drivers required to boot
are connected.

It does not make sense to have a UEFI Driver active in early 
DXE because it will not be connected yet and has dependencies on
other UEFI drivers that will not be connected yet.

Did you consider the use of the SerialPortLib for early DXE that 
can use PCI serial devices with PcdSerialPciDeviceInfo that can
be used for DEBUG() messages.

The other option is to map the PCI UART into Report Status Code.

Best regards,

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> Borzeszkowski, Alan
> Sent: Tuesday, February 20, 2024 4:11 AM
> To: devel@edk2.groups.io
> Cc: Albecki, Mateusz ; Gao, Zhichao
> ; Ni, Ray ; Borzeszkowski,
> Alan 
> Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver
> earlier in DXE
> 
> For the purpose of UEFI debug prints enablement in DXE phase,
> Serial driver should load earlier. Separate .inf file is created
> in order to make minimal changes to current implementation.
> 
> Signed-off-by: Alan Borzeszkowski 
> ---
>  .../PciSioSerialDxe/PciSioSerialDxeEarly.inf  | 80 +++
>  1 file changed, 80 insertions(+)
>  create mode 100644
> MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> 
> diff --git
> a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> new file mode 100644
> index 00..2ead654898
> --- /dev/null
> +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> @@ -0,0 +1,80 @@
> +## @file
> +# Serial driver for standard UARTS on a SIO chip or PCI/PCIE card.
> +#
> +# Produces the Serial I/O protocol for standard UARTS using Super I/O
> or PCI I/O.
> +# This version is used shortly after DXE Core is invoked
> +#
> +# Copyright (c) 2007 - 2018, Intel Corporation. All rights
> reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = PciSioSerialDxeEarly
> +  MODULE_UNI_FILE= PciSioSerialDxe.uni
> +  FILE_GUID  = 8BCC425E-585F-4E66-ADA5-
> FEA9A635F911
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= InitializePciSioSerial
> +
> +#
> +# The following information is for reference only and not required by
> the build tools.
> +#
> +#  VALID_ARCHITECTURES   = IA32 X64 EBC
> +#
> +#  DRIVER_BINDING=  gSerialControllerDriver
> +#  COMPONENT_NAME=  gPciSioSerialComponentName
> +#  COMPONENT_NAME2   =  gPciSioSerialComponentName2
> +#
> +
> +[Sources]
> +  ComponentName.c
> +  SerialIo.c
> +  SerialIoCommon.c
> +  Serial.h
> +  Serial.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +
> +[LibraryClasses]
> +  PcdLib
> +  ReportStatusCodeLib
> +  UefiBootServicesTableLib
> +  MemoryAllocationLib
> +  BaseMemoryLib
> +  DevicePathLib
> +  UefiLib
> +  UefiDriverEntryPoint
> +  DebugLib
> +  IoLib
> +
> +[Guids]
> +  gEfiUartDevicePathGuid## SOMETIMES_CONSUMES
> ## GUID
> +
> +[Protocols]
> +  gEfiSioProtocolGuid   ## TO_START
> +  gEfiDevicePathProtocolGuid## TO_START
> +  gEfiPciIoProtocolGuid ## TO_START
> +  gEfiSerialIoProtocolGuid  ## BY_START
> +  gEfiDevicePathProtocolGuid## BY_START
> +
> +[FeaturePcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHalfHandshake|FALSE   ##
> CONSUMES
> +
> +[Pcd]
> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200##
> CONSUMES
> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8 ##
> CONSUMES
> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1   ##
> CONSUMES
> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1 ##
> CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1843200 ##
> CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciSerialParameters ##
> CONSUMES
> +
> +[UserExtensions.TianoCore."ExtraFiles"]
> +  PciSioSerialDxeExtra.uni
> +
> +[Depex]
> +  TRUE
> --
> 2.34.1
> 
> -
> Intel Technology Poland sp. z o.o.
> ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII
> Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-
> 07-52-316 | Kapital zakladowy 200.000 PLN.
> Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu
> ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom
> w transakcjach handlowych.
> 
> Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego
> 

Re: [edk2-devel] [PATCH v3 4/6] OvmfPkg/ResetVector: SEV: keep #vc handler installed longer

2024-02-20 Thread Laszlo Ersek
On 2/20/24 10:06, Gerd Hoffmann wrote:
> When running in SEV mode do not uninstall the #vc handler in
> CheckSevFeatures.   Keep it active and uninstall it later in
> SevClearPageEncMaskForGhcbPage.
> 
> This allows using the cpuid instruction in SetCr3ForPageTables64,
> which is needed to check for la57 & 1G page support.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  OvmfPkg/ResetVector/Ia32/AmdSev.asm | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

I'll let Tom review this :)

Acked-by: Laszlo Ersek 


> 
> diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm 
> b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
> index 043c88a7abbe..02f287f1d934 100644
> --- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm
> +++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
> @@ -158,6 +158,11 @@ SevClearPageEncMaskForGhcbPage:
>  cmp   byte[WORK_AREA_GUEST_TYPE], 1
>  jnz   SevClearPageEncMaskForGhcbPageExit
>  
> +; Clear exception handlers and stack
> +mov   eax, ADDR_OF(IdtrClear)
> +lidt  [cs:eax]
> +mov   esp, 0
> +
>  ; Check if SEV-ES is enabled
>  mov   ecx, 1
>  bt[SEV_ES_WORK_AREA_STATUS_MSR], ecx
> @@ -332,7 +337,6 @@ NoSevEsVcHlt:
>  NoSevPass:
>  xor   eax, eax
>  
> -SevExit:
>  ;
>  ; Clear exception handlers and stack
>  ;
> @@ -342,6 +346,7 @@ SevExit:
>  pop   eax
>  mov   esp, 0
>  
> +SevExit:
>  OneTimeCallRet CheckSevFeatures
>  
>  ; Start of #VC exception handling routines



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




Re: [edk2-devel] [edk2-test][PATCH v1 0/4] uefi-sct/SctPkg: Add SCT Documents

2024-02-20 Thread G Edhaya Chandran
Thank you Samer.

The test case spec is consolidated and upstreamed by: 
https://github.com/tianocore/edk2-test/commit/f999690054b56780f5efbe0999507d7176bd87f6


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115661): https://edk2.groups.io/g/devel/message/115661
Mute This Topic: https://groups.io/mt/76416700/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 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Check BspIndex first before lock cmpxchg

2024-02-20 Thread Laszlo Ersek
On 2/20/24 04:41, Wu, Jiaxin wrote:
>> From C11 "5.1.2.4 Multi-threaded executions and data races":
>>
>> - paragraph 4: "Two expression evaluations conflict if one of them
>> modifies a memory location and the other one reads or modifies the same
>> memory location."
>>
>> - paragraph 25: "The execution of a program contains a data race if it
>> contains two conflicting actions in different threads, at least one of
>> which is not atomic, and neither happens before the other. Any such data
>> race results in undefined behavior."
>>
>> In this case, the outer condition (which reads the volatile UINT32
>> object "mSmmMpSyncData->BspIndex") is one access. It is a read access,
>> and it is not atomic. The other access is the
>> InterlockedCompareExchange32(). It is a read-write access, and it is
>> atomic. There is no "happens before" relationship enforced between both
>> accesses.
>>
>> Therefore, this is a data race: the pre-check on one CPU conflicts with
>> the InterlockedCompareExchange32() on another CPU, the pre-check is not
>> atomic, and there is no happens-before between them.
>>
>> A data race means undefined behavior. In particular, if there is a data
>> race, then there are no guarantees of sequential consistency, so the
>> observable values in the object could be totally inexplicable.
>>
> 
> I think here data race won't cause the undefined behavior:
> 
> The read operation in one processor might see the 1) old value (MAX_UINT32) 
> or 2) the new value (CpuIndex), but both behaviors are explicable:
> 
> If case 1, that's ok continue do the lock comxchg since BspIndex hasn't been 
> elected.
> If case 2, which means another processor has already atomic invalid or write 
> the BspIndex, then existing processor absolutely can skip the lock comxchg.
> 
> if (mSmmMpSyncData->BspIndex == MAX_UINT32) {
>   InterlockedCompareExchange32 (
> (UINT32 *)>BspIndex,
> MAX_UINT32,
> (UINT32)CpuIndex
> );
> }
> 
>> If you consider PiSmmCpuDxeSmm's usage of "volatile" to be "atomic",
>> then that would remove the data race; but volatile is not necessarily
>> atomic.
>>
> 
> I *never* do the assumption: "volatile" is "atomic".
> BspIndex is volatile, I think it only can ensure the compiler behavior, not 
> processor itself:
> 1. Compiler will not optimize this variable. All reads and writes to this 
> variable will be done directly to memory, not using cached values in 
> registers. But it doesn't prevent the CPU from caching that variable in its 
> own internal caches.
> 2. "volatile" can prevent the compiler from optimizing and reordering 
> instructions, it can't prevent the processor from reordering instructions, 
> and can't guarantee the atomicity of operations. 
> 
> For processor reordering, I think Ray explained that reordering won't happen. 
> 
>> Since you linked a wikipedia article, I'll link three articles that
>> describe a similar (nearly the same) technique called "double-checked
>> locking". In the general case, that technique is broken.
>>
>> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.
>> html
>> https://en.wikipedia.org/wiki/Double-checked_locking
>> https://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/
>>
>> It can be made work in bare-bones C, but it requires explicit fences /
>> memory barriers.
> 
> Here, the case is different to the above three "Double-checked locking".  
> Cache coherency can make sure the read value for check is only 2 cases as I 
> explained above.
> The only possible impact is the AP behavior: AP won't pending on lock 
> comxchg, while it will continue do the following code logic after if check: 
> for example performs the APHandler. But it won't has the negative-impact 
> since it has the timeout BSP check in APHandler. And even failure of that, we 
> still has the error handling to sync out the existing AP due to don't know 
> the BSP:
> 
>   SmmCpuSyncCheckOutCpu (mSmmMpSyncData->SyncContext, CpuIndex);
>   return;

I don't have other objections; feel free to proceed.

Thanks
Laszlo



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




[edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver earlier in DXE

2024-02-20 Thread Borzeszkowski, Alan
For the purpose of UEFI debug prints enablement in DXE phase,
Serial driver should load earlier. Separate .inf file is created
in order to make minimal changes to current implementation.

Signed-off-by: Alan Borzeszkowski 
---
 .../PciSioSerialDxe/PciSioSerialDxeEarly.inf  | 80 +++
 1 file changed, 80 insertions(+)
 create mode 100644 
MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf

diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf 
b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
new file mode 100644
index 00..2ead654898
--- /dev/null
+++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
@@ -0,0 +1,80 @@
+## @file
+# Serial driver for standard UARTS on a SIO chip or PCI/PCIE card.
+#
+# Produces the Serial I/O protocol for standard UARTS using Super I/O or PCI 
I/O.
+# This version is used shortly after DXE Core is invoked
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = PciSioSerialDxeEarly
+  MODULE_UNI_FILE= PciSioSerialDxe.uni
+  FILE_GUID  = 8BCC425E-585F-4E66-ADA5-FEA9A635F911
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= InitializePciSioSerial
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64 EBC
+#
+#  DRIVER_BINDING=  gSerialControllerDriver
+#  COMPONENT_NAME=  gPciSioSerialComponentName
+#  COMPONENT_NAME2   =  gPciSioSerialComponentName2
+#
+
+[Sources]
+  ComponentName.c
+  SerialIo.c
+  SerialIoCommon.c
+  Serial.h
+  Serial.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+  PcdLib
+  ReportStatusCodeLib
+  UefiBootServicesTableLib
+  MemoryAllocationLib
+  BaseMemoryLib
+  DevicePathLib
+  UefiLib
+  UefiDriverEntryPoint
+  DebugLib
+  IoLib
+
+[Guids]
+  gEfiUartDevicePathGuid## SOMETIMES_CONSUMES   ## GUID
+
+[Protocols]
+  gEfiSioProtocolGuid   ## TO_START
+  gEfiDevicePathProtocolGuid## TO_START
+  gEfiPciIoProtocolGuid ## TO_START
+  gEfiSerialIoProtocolGuid  ## BY_START
+  gEfiDevicePathProtocolGuid## BY_START
+
+[FeaturePcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHalfHandshake|FALSE   ## CONSUMES
+
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8 ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1   ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1 ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1843200 ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciSerialParameters ## CONSUMES
+
+[UserExtensions.TianoCore."ExtraFiles"]
+  PciSioSerialDxeExtra.uni
+
+[Depex]
+  TRUE
-- 
2.34.1

-
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z 
dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach 
handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by others 
is strictly prohibited.



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




[edk2-devel] [PATCH 0/1] EDK2 Serial driver UART debug print enablement

2024-02-20 Thread Borzeszkowski, Alan
On Intel platforms, we use LPSS UART for debug prints in DXE phase. Current 
implementation involves using custom driver.
In order to reduce code maintenance cost and flash usage, we want to switch to 
EDK2 Serial driver.
To achieve that, we need to load Serial driver shortly after DXE Core is 
invoked. Otherwise, this driver
will load at BDS which omits the purpose of debug prints in DXE. Separate .inf 
file is created
to introduce minimal changes to current implementation.
Change was tested on Intel platform, debug prints appeared shortly after DXE 
phase begun and console
redirection works.
https://github.com/tianocore/edk2/pull/5386

Alan Borzeszkowski (1):
  MdeModulePkg: Load Serial driver earlier in DXE

 .../PciSioSerialDxe/PciSioSerialDxeEarly.inf  | 80 +++
 1 file changed, 80 insertions(+)
 create mode 100644 
MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf

-- 
2.34.1

-
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z 
dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach 
handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by others 
is strictly prohibited.



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




[edk2-devel] [PATCH] MdePkg-SerialPortConsoleRedirectionTable_h-SPCRTable-Upgrade-Rev-4

2024-02-20 Thread Praveen Sankar N via groups.io
 Since ACPI SPCR table has been upgraded with new revision Rev-4,
 SerialPortConsoleRedirectionTable.h file should be added with
 new field members which are added in Rev-4.
 Signed-off-by: Praveen Sankar N praveensank...@ami.com
To: praveensank...@ami.com

---
 .../IndustryStandard/SerialPortConsoleRedirectionTable.h   | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h 
b/MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h
index eb5ae28390..c432db4319 100644
--- a/MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h
+++ b/MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h
@@ -47,7 +47,12 @@ typedef struct {
   UINT8 PciFunctionNumber;

   UINT32PciFlags;

   UINT8 PciSegment;

-  UINT32Reserved3;

+  // Version 4 Fields

+  UINT32UartClockFrequency;

+  UINT32PreciseBaudRate;

+  UINT16NameSpaceStrLength;

+  UINT16NameSpaceStrOffset;

+  CHAR8 NameSpaceString[0];

 } EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE;



 #pragma pack()

--
2.38.1.windows.1
-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 (#115657): https://edk2.groups.io/g/devel/message/115657
Mute This Topic: https://groups.io/mt/104469273/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] MdeModulePkg/TraceHubDebugSysTLib: Use wider type for loop comparisons

2024-02-20 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: mikub...@linux.microsoft.com  
Sent: Tuesday, February 20, 2024 11:26 PM
To: devel@edk2.groups.io
Cc: Liming Gao ; Guo, Gua ; 
Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 

Subject: [PATCH v1 1/1] MdeModulePkg/TraceHubDebugSysTLib: Use wider type for 
loop comparisons

From: Michael Kubacki 

Resolves a new CodeQL error due to the value being incremented in the loop 
being a narrower type than the variable it is being compared against.

The variable is changed to a UINT32 type so it has the same width as the type 
it is being compared against.

Issue explanation: In a loop condition, comparison of a value of a narrow type 
with a value of a wide type may result in unexpected behavior if the wider 
value is sufficiently large (or small). This is because the narrower value may 
overflow. This can lead to an infinite loop.

Cc: Liming Gao 
Cc: Gua Guo 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Michael Kubacki 
---
 MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c   | 4 ++--
 MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c | 2 +-
 MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c| 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
index 45dfd3127a4c..050210cb958b 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib
+++ .c
@@ -41,7 +41,7 @@ TraceHubSysTDebugWrite (
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
   UINT32DbgInstCount;
-  UINT16Index;
+  UINT32Index;
 
   if (NumberOfBytes == 0) {
 //
@@ -109,7 +109,7 @@ TraceHubSysTWriteCataLog64StatusCode (
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
   UINT32DbgInstCount;
-  UINT16Index;
+  UINT32Index;
 
   if (Guid == NULL) {
 return RETURN_INVALID_PARAMETER;
diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
index 35c239b5feae..6001f4dfd93d 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTL
+++ ib.c
@@ -45,7 +45,7 @@ TraceHubSysTDebugWrite (
   MIPI_SYST_HANDLE  MipiSystHandle;
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
-  UINT16Index;
+  UINT32Index;
 
   if ((mDbgInstCount == 0) || (mThDebugInstArray == NULL)) {
 return RETURN_ABORTED;
diff --git a/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
index fe946fe60c7d..035618faece5 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
@@ -56,7 +56,7 @@ PackThDebugInstance (
   )
 {
   UINT8   *DbgContext;
-  UINT16  Index;
+  UINT32  Index;
 
   DbgContext = GetFirstGuidHob ();
   if (DbgContext != NULL) {
--
2.40.1.vfs.0.0



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




[edk2-devel] [PATCH v1 1/1] MdeModulePkg/TraceHubDebugSysTLib: Use wider type for loop comparisons

2024-02-20 Thread Michael Kubacki
From: Michael Kubacki 

Resolves a new CodeQL error due to the value being incremented in the
loop being a narrower type than the variable it is being compared
against.

The variable is changed to a UINT32 type so it has the same width as
the type it is being compared against.

Issue explanation: In a loop condition, comparison of a value of a
narrow type with a value of a wide type may result in unexpected
behavior if the wider value is sufficiently large (or small). This
is because the narrower value may overflow. This can lead to an
infinite loop.

Cc: Liming Gao 
Cc: Gua Guo 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Michael Kubacki 
---
 MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c   | 4 ++--
 MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c | 2 +-
 MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c| 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
index 45dfd3127a4c..050210cb958b 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
@@ -41,7 +41,7 @@ TraceHubSysTDebugWrite (
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
   UINT32DbgInstCount;
-  UINT16Index;
+  UINT32Index;
 
   if (NumberOfBytes == 0) {
 //
@@ -109,7 +109,7 @@ TraceHubSysTWriteCataLog64StatusCode (
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
   UINT32DbgInstCount;
-  UINT16Index;
+  UINT32Index;
 
   if (Guid == NULL) {
 return RETURN_INVALID_PARAMETER;
diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
index 35c239b5feae..6001f4dfd93d 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
@@ -45,7 +45,7 @@ TraceHubSysTDebugWrite (
   MIPI_SYST_HANDLE  MipiSystHandle;
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
-  UINT16Index;
+  UINT32Index;
 
   if ((mDbgInstCount == 0) || (mThDebugInstArray == NULL)) {
 return RETURN_ABORTED;
diff --git a/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
index fe946fe60c7d..035618faece5 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
@@ -56,7 +56,7 @@ PackThDebugInstance (
   )
 {
   UINT8   *DbgContext;
-  UINT16  Index;
+  UINT32  Index;
 
   DbgContext = GetFirstGuidHob ();
   if (DbgContext != NULL) {
-- 
2.40.1.vfs.0.0



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




[edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access

2024-02-20 Thread Michael Kubacki
From: Michael Kubacki 

Checks that an offset used to access array elements is within the
expected range before accessing the array item.

Cc: Liming Gao 
Cc: Ray Ni 
Cc: Rebecca Cran 
Cc: Richard Ho 
Signed-off-by: Michael Kubacki 
---
 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c  | 2 +-
 MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c  | 2 +-
 MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c 
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
index 29f4508a38ce..0c1f252b85df 100644
--- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c
@@ -769,7 +769,7 @@ ConvertFilter (
 
   Count = sizeof (gTable)/sizeof (gTable[0]);
 
-  for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
+  for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
 if (gTable[Index].Src & Value) {
   *CdcFilter |= gTable[Index].Dst;
 }
diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c 
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
index baa2225bf8a8..ef01a6f5458c 100644
--- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c
@@ -855,7 +855,7 @@ ConvertFilter (
 
   Count = sizeof (gTable)/sizeof (gTable[0]);
 
-  for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
+  for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
 if (gTable[Index].Src & Value) {
   *CdcFilter |= gTable[Index].Dst;
 }
diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c 
b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
index 2c0dcae4cf96..6d45a1b775ba 100644
--- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
+++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c
@@ -803,7 +803,7 @@ ConvertFilter (
 
   Count = sizeof (gTable)/sizeof (gTable[0]);
 
-  for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) {
+  for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) {
 if (gTable[Index].Src & Value) {
   *CdcFilter |= gTable[Index].Dst;
 }
-- 
2.40.1.vfs.0.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115654): https://edk2.groups.io/g/devel/message/115654
Mute This Topic: https://groups.io/mt/104469090/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/4] BaseTools/Scripts/PatchCheck: Error if no Cc tags are present

2024-02-20 Thread Ard Biesheuvel
Hello Mike,

I understand the desire to be pedantic about cc'ing the right
maintainers, but I'm not convinced this is the way.

- the presence of a cc: tag does not guarantee that the person was
cc'ed - only git send-email will take CC:s in the message body into
account by default (but this can also be disabled), but generally, the
sender has to ensure the cc list is copied into the cc: field
- the absence of a cc: tag does not imply that the person was not cc'ed,

- in Linux, the cc: tag has slightly different semantics from the ones
we appear to be assuming here: a cc tag in patch going into the
repository is a statement by the maintainer that the person in
question has been cc'ed, may have some 'jurisdiction' over the area,
but hasn't bothered to respond. IOW, it is to record the fact that
this person has been given the opportunity to respond.

Then there is the matter of a maintainer that has reviewed the patch
themselves. I usually remove the cc lines listing people that have
reviewed/acked/tested the patch, as those tags already convey that the
person is aware of it cc'ed or not.

So perhaps it would be better to make this check part of the
contributor workflow but not the GitHub PR/CI workflow?


On Sun, 18 Feb 2024 at 22:00, Michael D Kinney
 wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4694
>
> If no Cc tags are detected in a commit message, then generate an
> error. All patches sent for review are required to provide the set
> of maintainers and reviewers responsible for the directories/files
> modified. The set of maintainers and reviewers are documented in
> Maintainers.txt and can be retrieved using the script
> BaseTools/Scripts/GetMaintainer.py.
>
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Yuwei Chen 
> Cc: Michael Kubacki 
> Signed-off-by: Michael D Kinney 
> ---
>  BaseTools/Scripts/PatchCheck.py | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
> index 158a2b30a5ce..415198e3824e 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -229,8 +229,10 @@ class CommitMessageCheck:
>  )
>
>  def check_misc_signatures(self):
> -for sig in self.sig_types:
> -self.find_signatures(sig)
> +for sigtype in self.sig_types:
> +sigs = self.find_signatures(sigtype)
> +if sigtype == 'Cc' and len(sigs) == 0:
> +self.error('No Cc: tags for maintainers/reviewers found!')
>
>  cve_re = re.compile('CVE-[0-9]{4}-[0-9]{5}[^0-9]')
>
> --
> 2.40.1.windows.1
>
>
>
> 
>
>


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




[edk2-devel] [PATCH V2] Pkg-Module: OptionRomPkg

2024-02-20 Thread Gahan
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4689

Bug 4689 - GetInfo() of Adapter Information Protocol
should have a provision for IHV to return no data for
UEFI Spec compliance 2.9 [mantis #1866]

Cc: Ray Ni 
Signed-off-by: Gahan Saraiya 
---
 Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h 
b/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h
index 31c55a8e11..45c1f41414 100644
--- a/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h
+++ b/Drivers/OptionRomPkg/UndiRuntimeDxe/Undi32.h
@@ -350,23 +350,24 @@ VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI 
*PxePtr);
 
   This function returns information of type InformationType from the adapter.
   If an adapter does not support the requested informational type, then
-  EFI_UNSUPPORTED is returned. 
+  EFI_UNSUPPORTED is returned.
 
   @param[in]  This   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
   @param[in]  InformationTypeA pointer to an EFI_GUID that defines the 
contents of InformationBlock.
-  @param[out] InforamtionBlock   The service returns a pointer to the 
buffer with the InformationBlock
+  @param[out] InformationBlock   The service returns a pointer to the 
buffer with the InformationBlock
  structure which contains details about 
the data specific to InformationType.
-  @param[out] InforamtionBlockSize   The driver returns the size of the 
InformationBlock in bytes.
+  @param[out] InformationBlockSize   The driver returns the size of the 
InformationBlock in bytes.
 
   @retval EFI_SUCCESSThe InformationType information was 
retrieved.
   @retval EFI_UNSUPPORTEDThe InformationType is not known.
+  @retval EFI_NOT_FOUND  Information is not available for the 
requested information type.
   @retval EFI_DEVICE_ERROR   The device reported an error.
   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to 
a lack of resources.
-  @retval EFI_INVALID_PARAMETER  This is NULL. 
-  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL. 
+  @retval EFI_INVALID_PARAMETER  This is NULL.
+  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
   @retval EFI_INVALID_PARAMETER  InformationBlockSize is NULL.
 
-**/  
+**/
 EFI_STATUS
 EFIAPI
 UndiAipGetInfo (
@@ -396,7 +397,7 @@ UndiAipGetInfo (
   @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
   @retval EFI_WRITE_PROTECTEDThe InformationType cannot be modified 
using EFI_ADAPTER_INFO_SET_INFO().
 
-**/
+**/
 EFI_STATUS
 EFIAPI
 UndiAipSetInfo (
@@ -427,7 +428,7 @@ UndiAipSetInfo (
   @retval EFI_INVALID_PARAMETER InfoTypesBufferCount is NULL.
   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store 
the results.
 
-**/
+**/
 EFI_STATUS
 EFIAPI
 UndiAipGetSupportedTypes (
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH V2] Pkg-Module: MinPlatformPkg

2024-02-20 Thread Gahan
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4689

Bug 4689 - GetInfo() of Adapter Information Protocol
should have a provision for IHV to return no data for
UEFI Spec compliance 2.9 [mantis #1866]

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Gahan Saraiya 
---
 .../Test/Library/TestPointLib/DxeTestPointAip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c
index a7fe9530cf..fcfef58175 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/DxeTestPointAip.c
@@ -12,7 +12,7 @@
 
   This function returns information of type InformationType from the adapter.
   If an adapter does not support the requested informational type, then
-  EFI_UNSUPPORTED is returned. 
+  EFI_UNSUPPORTED is returned.
 
   @param[in]  This   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
   @param[in]  InformationTypeA pointer to an EFI_GUID that defines the 
contents of InformationBlock.
@@ -24,8 +24,8 @@
   @retval EFI_UNSUPPORTEDThe InformationType is not known.
   @retval EFI_DEVICE_ERROR   The device reported an error.
   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to 
a lack of resources.
-  @retval EFI_INVALID_PARAMETER  This is NULL. 
-  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL. 
+  @retval EFI_INVALID_PARAMETER  This is NULL.
+  @retval EFI_INVALID_PARAMETER  InformationBlock is NULL.
   @retval EFI_INVALID_PARAMETER  InformationBlockSize is NULL.
 
 **/
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH V2] Pkg-Module: Silicon/Marvell

2024-02-20 Thread Gahan
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4689

Bug 4689 - GetInfo() of Adapter Information Protocol
should have a provision for IHV to return no data for
UEFI Spec compliance 2.9 [mantis #1866]

Cc: Marcin Wojtas 
Cc: Leif Lindholm 
Signed-off-by: Gahan Saraiya 
---
 Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c 
b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c
index 5e463ac932..517b21940d 100644
--- a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c
+++ b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c
@@ -1394,6 +1394,7 @@ Pp2DxeSnpInstall (
 
   @retval EFI_SUCCESSThe InformationType information was 
retrieved.
   @retval EFI_UNSUPPORTEDThe InformationType is not known.
+  @retval EFI_NOT_FOUND  Information is not available for the 
requested information type.
   @retval EFI_DEVICE_ERROR   The device reported an error.
   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to 
a lack of resources.
   @retval EFI_INVALID_PARAMETER  This is NULL.
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 6/6] OvmfPkg/PlatformInitLib: add 5-level paging support

2024-02-20 Thread Gerd Hoffmann
Adjust physical address space logic for la57 mode (5-level paging).
With a larger logical address space we can identity-map a larger
physical address space.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 57 ++---
 1 file changed, 38 insertions(+), 19 deletions(-)

diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c 
b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index f042517bb64a..0f9658fc34fa 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -628,11 +628,12 @@ PlatformAddressWidthFromCpuid (
   IN BOOLEANQemuQuirk
   )
 {
-  UINT32   RegEax, RegEbx, RegEcx, RegEdx, Max;
-  UINT8PhysBits;
-  CHAR8Signature[13];
-  BOOLEAN  Valid = FALSE;
-  BOOLEAN  Page1GSupport = FALSE;
+  UINT32RegEax, RegEbx, RegEcx, RegEdx, Max;
+  UINT8 PhysBits;
+  CHAR8 Signature[13];
+  IA32_CR4  Cr4;
+  BOOLEAN   Valid = FALSE;
+  BOOLEAN   Page1GSupport = FALSE;
 
   ZeroMem (Signature, sizeof (Signature));
 
@@ -670,30 +671,48 @@ PlatformAddressWidthFromCpuid (
 }
   }
 
+  Cr4.UintN = AsmReadCr4 ();
+
   DEBUG ((
 DEBUG_INFO,
-"%a: Signature: '%a', PhysBits: %d, QemuQuirk: %a, Valid: %a\n",
+"%a: Signature: '%a', PhysBits: %d, QemuQuirk: %a, la57: %a, Valid: %a\n",
 __func__,
 Signature,
 PhysBits,
 QemuQuirk ? "On" : "Off",
+Cr4.Bits.LA57 ? "On" : "Off",
 Valid ? "Yes" : "No"
 ));
 
   if (Valid) {
-if (PhysBits > 46) {
-  /*
-   * Avoid 5-level paging altogether for now, which limits
-   * PhysBits to 48.  Also avoid using address bit 48, due to sign
-   * extension we can't identity-map these addresses (and lots of
-   * places in edk2 assume we have everything identity-mapped).
-   * So the actual limit is 47.
-   *
-   * Also some older linux kernels apparently have problems handling
-   * phys-bits > 46 correctly, so use that as limit.
-   */
-  DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", 
__func__));
-  PhysBits = 46;
+/*
+ * Due to the sign extension we can use only the lower half of the
+ * virtual address space to identity-map physical address space,
+ * which gives us a 47 bit wide address space with 4 paging levels
+ * and a 56 bit wide address space with 5 paging levels.
+ */
+if (Cr4.Bits.LA57) {
+  if (PhysBits > 48) {
+/*
+ * Some Intel CPUs support 5-level paging, have more than 48
+ * phys-bits but support only 4-level EPT, which effectively
+ * limits guest phys-bits to 48.  Until we have some way to
+ * communicate that limitation from hypervisor to guest, limit
+ * phys-bits to 48 unconditionally.
+ */
+DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 48 (5-level paging)\n", 
__func__));
+PhysBits = 48;
+  }
+} else {
+  if (PhysBits > 46) {
+/*
+ * Some older linux kernels apparently have problems handling
+ * phys-bits > 46 correctly, so use that instead of 47 as
+ * limit.
+ */
+DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (4-level paging)\n", 
__func__));
+PhysBits = 46;
+  }
 }
 
 if (!Page1GSupport && (PhysBits > 40)) {
-- 
2.43.2



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




[edk2-devel] [PATCH v3 3/6] OvmfPkg/ResetVector: improve page table flag names

2024-02-20 Thread Gerd Hoffmann
Add comments, rename some of the PAGE_* flags and combined attributes.
Specifically use "LARGEPAGE" instead of "2M" because that bit is used
for both 2M and 1G large pages.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Laszlo Ersek 
---
 OvmfPkg/ResetVector/Ia32/PageTables64.asm | 39 +--
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm 
b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
index 317cad430f29..6fec6f2beeea 100644
--- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
+++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
@@ -10,6 +10,7 @@
 
 BITS32
 
+; common for all levels
 %define PAGE_PRESENT0x01
 %define PAGE_READ_WRITE 0x02
 %define PAGE_USER_SUPERVISOR0x04
@@ -17,25 +18,29 @@ BITS32
 %define PAGE_CACHE_DISABLE 0x010
 %define PAGE_ACCESSED  0x020
 %define PAGE_DIRTY 0x040
-%define PAGE_PAT   0x080
 %define PAGE_GLOBAL   0x0100
-%define PAGE_2M_MBO0x080
-%define PAGE_2M_PAT  0x01000
+
+; page table entries (level 1)
+%define PAGE_PTE_PAT   0x080
+
+; page directory entries (level 2+)
+%define PAGE_PDE_LARGEPAGE 0x080
+%define PAGE_PDE_PAT 0x01000
 
 %define PAGE_4K_PDE_ATTR (PAGE_ACCESSED + \
   PAGE_DIRTY + \
   PAGE_READ_WRITE + \
   PAGE_PRESENT)
 
-%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \
-  PAGE_ACCESSED + \
-  PAGE_DIRTY + \
-  PAGE_READ_WRITE + \
-  PAGE_PRESENT)
+%define PAGE_PDE_LARGEPAGE_ATTR (PAGE_PDE_LARGEPAGE + \
+ PAGE_ACCESSED + \
+ PAGE_DIRTY + \
+ PAGE_READ_WRITE + \
+ PAGE_PRESENT)
 
-%define PAGE_PDP_ATTR (PAGE_ACCESSED + \
-   PAGE_READ_WRITE + \
-   PAGE_PRESENT)
+%define PAGE_PDE_DIRECTORY_ATTR (PAGE_ACCESSED + \
+ PAGE_READ_WRITE + \
+ PAGE_PRESENT)
 
 %define TDX_BSP 1
 %define TDX_AP  2
@@ -84,19 +89,19 @@ clearPageTablesMemoryLoop:
 ;
 ; Top level Page Directory Pointers (1 * 512GB entry)
 ;
-mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDP_ATTR
+mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDE_DIRECTORY_ATTR
 mov dword[PT_ADDR (4)], edx
 
 ;
 ; Next level Page Directory Pointers (4 * 1GB entries => 4GB)
 ;
-mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDP_ATTR
+mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDE_DIRECTORY_ATTR
 mov dword[PT_ADDR (0x1004)], edx
-mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDP_ATTR
+mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDE_DIRECTORY_ATTR
 mov dword[PT_ADDR (0x100C)], edx
-mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDP_ATTR
+mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDE_DIRECTORY_ATTR
 mov dword[PT_ADDR (0x1014)], edx
-mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDP_ATTR
+mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDE_DIRECTORY_ATTR
 mov dword[PT_ADDR (0x101C)], edx
 
 ;
@@ -107,7 +112,7 @@ pageTableEntriesLoop:
 mov eax, ecx
 dec eax
 shl eax, 21
-add eax, PAGE_2M_PDE_ATTR
+add eax, PAGE_PDE_LARGEPAGE_ATTR
 mov [ecx * 8 + PT_ADDR (0x2000 - 8)], eax
 mov [(ecx * 8 + PT_ADDR (0x2000 - 8)) + 4], edx
 looppageTableEntriesLoop
-- 
2.43.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115647): https://edk2.groups.io/g/devel/message/115647
Mute This Topic: https://groups.io/mt/104464310/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/6] MdeModulePkg/DxeIplPeim: fix PcdUse5LevelPageTable assert

2024-02-20 Thread Gerd Hoffmann
PcdUse5LevelPageTable documentation says:

  Indicates if 5-Level Paging will be enabled in long mode. 5-Level
  Paging will not be enabled when the PCD is TRUE but CPU doesn't support
  5-Level Paging.

So running in 4-level paging mode with PcdUse5LevelPageTable=TRUE is
possible.  The only invalid combination is 5-level paging being active
with PcdUse5LevelPageTable=FALSE.

Fix the ASSERT accordingly.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Laszlo Ersek 
---
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c 
b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 980c2002d4f5..1d240e95966e 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -745,7 +745,9 @@ CreateIdentityMappingPageTables (
 //
 Cr4.UintN = AsmReadCr4 ();
 Page5LevelSupport = (Cr4.Bits.LA57 != 0);
-ASSERT (PcdGetBool (PcdUse5LevelPageTable) == Page5LevelSupport);
+if (Page5LevelSupport) {
+  ASSERT (PcdGetBool (PcdUse5LevelPageTable));
+}
   } else {
 //
 // If cpu runs in 32bit protected mode PEI, Page table Level in DXE is 
decided by PCD and feature capability.
-- 
2.43.2



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




[edk2-devel] [PATCH v3 5/6] OvmfPkg/ResetVector: add 5-level paging support

2024-02-20 Thread Gerd Hoffmann
Compile the OVMF ResetVector with 5-level paging support in case
PcdUse5LevelPageTable is TRUE.

When enabled the ResetVector will check at runtime whenever support for
5-level paging and gigabyte pages is available.  In case both features
are supported it will run OVMF in 5-level paging mode, otherwise
fallback to 4-level paging.

Gigabyte pages are required to make sure we can fit the page tables into
the available space.  We have six pages available, four of them are
used.  The first gibabyte is mapped with 2M pages, the 1GB -> 4GB range
uses gigabyte pages.  See the source code comment for the exact layout.

In case TDX is used the TDX_WORK_AREA_PGTBL_READY will carry the
information whenever 5-level paging is used (2) or not (1), so the
APs can pick the correct paging mode.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/ResetVector/ResetVector.inf   |   1 +
 OvmfPkg/ResetVector/Ia32/IntelTdx.asm |  17 ++-
 OvmfPkg/ResetVector/Ia32/PageTables64.asm | 131 +-
 OvmfPkg/ResetVector/ResetVector.nasmb |   1 +
 4 files changed, 145 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/ResetVector/ResetVector.inf 
b/OvmfPkg/ResetVector/ResetVector.inf
index a4154ca90c28..65f71b05a02e 100644
--- a/OvmfPkg/ResetVector/ResetVector.inf
+++ b/OvmfPkg/ResetVector/ResetVector.inf
@@ -64,3 +64,4 @@ [FixedPcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuHashTableSize
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable
diff --git a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm 
b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
index 06794baef81d..3e50ca76aacf 100644
--- a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
+++ b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
@@ -179,7 +179,7 @@ InitTdx:
 ;
 ; Modified:  EAX, EDX
 ;
-; 0-NonTdx, 1-TdxBsp, 2-TdxAps
+; 0-NonTdx, 1-TdxBsp, 2-TdxAps, 3-TdxApsLa57
 ;
 CheckTdxFeaturesBeforeBuildPagetables:
 xor eax, eax
@@ -204,6 +204,21 @@ TdxPostBuildPageTables:
 ExitTdxPostBuildPageTables:
 OneTimeCallRet TdxPostBuildPageTables
 
+%if PG_5_LEVEL
+
+;
+; Set byte[TDX_WORK_AREA_PGTBL_READY] to 2
+;
+TdxPostBuildPageTablesLa57:
+cmp byte[WORK_AREA_GUEST_TYPE], VM_GUEST_TDX
+jne ExitTdxPostBuildPageTablesLa57
+mov byte[TDX_WORK_AREA_PGTBL_READY], 2
+
+ExitTdxPostBuildPageTablesLa57:
+OneTimeCallRet TdxPostBuildPageTablesLa57
+
+%endif
+
 ;
 ; Check if TDX is enabled
 ;
diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm 
b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
index 6fec6f2beeea..21de75a40097 100644
--- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
+++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
@@ -42,8 +42,10 @@ BITS32
  PAGE_READ_WRITE + \
  PAGE_PRESENT)
 
+%define NOT_TDX 0
 %define TDX_BSP 1
 %define TDX_AP  2
+%define TDX_AP_LA57 3
 
 ;
 ; Modified:  EAX, EBX, ECX, EDX
@@ -55,11 +57,21 @@ SetCr3ForPageTables64:
 ; the page tables. APs will spin on until byte[TDX_WORK_AREA_PGTBL_READY]
 ; is set.
 OneTimeCall   CheckTdxFeaturesBeforeBuildPagetables
+cmp   eax, NOT_TDX
+jeCheckSev
 cmp   eax, TDX_BSP
 jeClearOvmfPageTables
+%if PG_5_LEVEL
 cmp   eax, TDX_AP
 jeSetCr3
+; TDX_AP_LA57 -> set cr4.la57
+mov   eax, cr4
+bts   eax, 12
+mov   cr4, eax
+%endif
+jmp   SetCr3
 
+CheckSev:
 ; Check whether the SEV is active and populate the SevEsWorkArea
 OneTimeCall   CheckSevFeatures
 
@@ -86,6 +98,105 @@ clearPageTablesMemoryLoop:
 mov dword[ecx * 4 + PT_ADDR (0) - 4], eax
 loopclearPageTablesMemoryLoop
 
+%if PG_5_LEVEL
+
+; save GetSevCBitMaskAbove31 result (cpuid changes edx)
+mov edi, edx
+
+; check for cpuid leaf 0x07
+mov eax, 0x00
+cpuid
+cmp eax, 0x07
+jb  Paging4Lvl
+
+; check for la57 (aka 5-level paging)
+mov eax, 0x07
+mov ecx, 0x00
+cpuid
+bt  ecx, 16
+jnc Paging4Lvl
+
+; check for cpuid leaf 0x8001
+mov eax, 0x8000
+cpuid
+cmp eax, 0x8001
+jb  Paging4Lvl
+
+; check for 1g pages
+mov eax, 0x8001
+cpuid
+bt  edx, 26
+jnc Paging4Lvl
+
+;
+; Use 5-level paging with gigabyte pages.
+;
+; We have 6 pages available for the early page tables,
+; we use four of them:
+;PT_ADDR(0)  - level 5 directory
+;PT_ADDR(0x1000) - level 4 directory
+;PT_ADDR(0x2000) - level 2 directory (0 -> 1GB)
+;PT_ADDR(0x3000) - level 3 directory
+;
+; The level 2 directory for the first gigabyte has the same
+; physical address in both 4-level and 5-level paging mode,
+; SevClearPageEncMaskForGhcbPage depends on this.
+;
+; The 1 GB -> 4 GB range is mapped using 1G pages in the
+; level 3 directory.
+ 

[edk2-devel] [PATCH v3 4/6] OvmfPkg/ResetVector: SEV: keep #vc handler installed longer

2024-02-20 Thread Gerd Hoffmann
When running in SEV mode do not uninstall the #vc handler in
CheckSevFeatures.   Keep it active and uninstall it later in
SevClearPageEncMaskForGhcbPage.

This allows using the cpuid instruction in SetCr3ForPageTables64,
which is needed to check for la57 & 1G page support.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/ResetVector/Ia32/AmdSev.asm | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm 
b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
index 043c88a7abbe..02f287f1d934 100644
--- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm
+++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
@@ -158,6 +158,11 @@ SevClearPageEncMaskForGhcbPage:
 cmp   byte[WORK_AREA_GUEST_TYPE], 1
 jnz   SevClearPageEncMaskForGhcbPageExit
 
+; Clear exception handlers and stack
+mov   eax, ADDR_OF(IdtrClear)
+lidt  [cs:eax]
+mov   esp, 0
+
 ; Check if SEV-ES is enabled
 mov   ecx, 1
 bt[SEV_ES_WORK_AREA_STATUS_MSR], ecx
@@ -332,7 +337,6 @@ NoSevEsVcHlt:
 NoSevPass:
 xor   eax, eax
 
-SevExit:
 ;
 ; Clear exception handlers and stack
 ;
@@ -342,6 +346,7 @@ SevExit:
 pop   eax
 mov   esp, 0
 
+SevExit:
 OneTimeCallRet CheckSevFeatures
 
 ; Start of #VC exception handling routines
-- 
2.43.2



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




[edk2-devel] [PATCH v3 2/6] MdeModulePkg/DxeIplPeim: rename variable

2024-02-20 Thread Gerd Hoffmann
Rename Page5LevelSupported to Page5LevelEnabled.

The variable is set to true in case 5-paging level is enabled (64-bit
PEI) or will be enabled (32-bit PEI), it does *not* tell whenever the
5-level paging is supported by the CPU.

Signed-off-by: Gerd Hoffmann 
Reviewed-by: Laszlo Ersek 
---
 .../Core/DxeIplPeim/X64/VirtualMemory.c   | 22 +--
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c 
b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 1d240e95966e..df6196a41cd5 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -696,7 +696,7 @@ CreateIdentityMappingPageTables (
   UINTNTotalPagesNum;
   UINTNBigPageAddress;
   VOID *Hob;
-  BOOLEAN  Page5LevelSupport;
+  BOOLEAN  Page5LevelEnabled;
   BOOLEAN  Page1GSupport;
   PAGE_TABLE_1G_ENTRY  *PageDirectory1GEntry;
   UINT64   AddressEncMask;
@@ -744,15 +744,15 @@ CreateIdentityMappingPageTables (
 // If cpu has already run in 64bit long mode PEI, Page table Level in DXE 
must align with previous level.
 //
 Cr4.UintN = AsmReadCr4 ();
-Page5LevelSupport = (Cr4.Bits.LA57 != 0);
-if (Page5LevelSupport) {
+Page5LevelEnabled = (Cr4.Bits.LA57 != 0);
+if (Page5LevelEnabled) {
   ASSERT (PcdGetBool (PcdUse5LevelPageTable));
 }
   } else {
 //
 // If cpu runs in 32bit protected mode PEI, Page table Level in DXE is 
decided by PCD and feature capability.
 //
-Page5LevelSupport = FALSE;
+Page5LevelEnabled = FALSE;
 if (PcdGetBool (PcdUse5LevelPageTable)) {
   AsmCpuidEx (
 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS,
@@ -763,12 +763,12 @@ CreateIdentityMappingPageTables (
 NULL
 );
   if (EcxFlags.Bits.FiveLevelPage != 0) {
-Page5LevelSupport = TRUE;
+Page5LevelEnabled = TRUE;
   }
 }
   }
 
-  DEBUG ((DEBUG_INFO, "AddressBits=%u 5LevelPaging=%u 1GPage=%u\n", 
PhysicalAddressBits, Page5LevelSupport, Page1GSupport));
+  DEBUG ((DEBUG_INFO, "AddressBits=%u 5LevelPaging=%u 1GPage=%u\n", 
PhysicalAddressBits, Page5LevelEnabled, Page1GSupport));
 
   //
   // IA-32e paging translates 48-bit linear addresses to 52-bit physical 
addresses
@@ -776,7 +776,7 @@ CreateIdentityMappingPageTables (
   //  due to either unsupported by HW, or disabled by PCD.
   //
   ASSERT (PhysicalAddressBits <= 52);
-  if (!Page5LevelSupport && (PhysicalAddressBits > 48)) {
+  if (!Page5LevelEnabled && (PhysicalAddressBits > 48)) {
 PhysicalAddressBits = 48;
   }
 
@@ -811,7 +811,7 @@ CreateIdentityMappingPageTables (
   //
   // Substract the one page occupied by PML5 entries if 5-Level Paging is 
disabled.
   //
-  if (!Page5LevelSupport) {
+  if (!Page5LevelEnabled) {
 TotalPagesNum--;
   }
 
@@ -831,7 +831,7 @@ CreateIdentityMappingPageTables (
   // By architecture only one PageMapLevel4 exists - so lets allocate storage 
for it.
   //
   PageMap = (VOID *)BigPageAddress;
-  if (Page5LevelSupport) {
+  if (Page5LevelEnabled) {
 //
 // By architecture only one PageMapLevel5 exists - so lets allocate 
storage for it.
 //
@@ -853,7 +853,7 @@ CreateIdentityMappingPageTables (
 PageMapLevel4Entry = (VOID *)BigPageAddress;
 BigPageAddress+= SIZE_4KB;
 
-if (Page5LevelSupport) {
+if (Page5LevelEnabled) {
   //
   // Make a PML5 Entry
   //
@@ -947,7 +947,7 @@ CreateIdentityMappingPageTables (
 ZeroMem (PageMapLevel4Entry, (512 - IndexOfPml4Entries) * sizeof 
(PAGE_MAP_AND_DIRECTORY_POINTER));
   }
 
-  if (Page5LevelSupport) {
+  if (Page5LevelEnabled) {
 Cr4.UintN = AsmReadCr4 ();
 Cr4.Bits.LA57 = 1;
 AsmWriteCr4 (Cr4.UintN);
-- 
2.43.2



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




[edk2-devel] [PATCH v3 0/6] OvmfPkg: Add support for 5-level paging

2024-02-20 Thread Gerd Hoffmann
Patch #1 + #2 fix MdeModulePkg/DxeIplPeim to not assert in case a
5-level enabled build runs in 4-level paging mode.

Patch #2 - #4 update OvmfPkg ResetVector, adding support for 5-level
paging (setup 5-level page tables in case both la57 and gigabyte pages
are supported by the vCPU).

Patch #5 updates PlatformInitLib for 5-level paging support (update
PhysBits calculation).

Known issues / limitations:
 - BaseMemEncryptSevLib must be updated to also support 5-level
   paging for full 5-level paging support in SEV mode.

The patch series does *not* enable 5-level paging by default.
Building with 5-level paging support can be done by compiling
OVMF with '--pcd PcdUse5LevelPageTable=TRUE'.

v3:
 - add resetvector fixes for sev and tdx
v2 changes:
 - fix sev/tdx handling with 5-level paging.
 - more comments for 5-level page table setup.
 - improve PAGE_* naming (new patch #3).
 - rename Page5LevelSupported to Page5LevelEnabled (new patch #2).
 - pick up some review tags.

Gerd Hoffmann (6):
  MdeModulePkg/DxeIplPeim: fix PcdUse5LevelPageTable assert
  MdeModulePkg/DxeIplPeim: rename variable
  OvmfPkg/ResetVector: improve page table flag names
  OvmfPkg/ResetVector: SEV: keep #vc handler installed longer
  OvmfPkg/ResetVector: add 5-level paging support
  OvmfPkg/PlatformInitLib: add 5-level paging support

 OvmfPkg/ResetVector/ResetVector.inf   |   1 +
 .../Core/DxeIplPeim/X64/VirtualMemory.c   |  24 +--
 OvmfPkg/Library/PlatformInitLib/MemDetect.c   |  57 --
 OvmfPkg/ResetVector/Ia32/AmdSev.asm   |   7 +-
 OvmfPkg/ResetVector/Ia32/IntelTdx.asm |  17 +-
 OvmfPkg/ResetVector/Ia32/PageTables64.asm | 170 +++---
 OvmfPkg/ResetVector/ResetVector.nasmb |   1 +
 7 files changed, 224 insertions(+), 53 deletions(-)

-- 
2.43.2



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




Re: [edk2-devel] [PATCH v3 1/4] OvmfPkg/Sec: Setup MTRR early in the boot process.

2024-02-20 Thread Gerd Hoffmann
On Tue, Feb 20, 2024 at 06:27:21AM +, Min Xu wrote:
> On Monday, February 12, 2024 11:22 PM, Gerd Hoffmann wrote:
> > On Thu, Feb 01, 2024 at 10:38:43AM +0100, Gerd Hoffmann wrote:
> > >   Hi,
> > >
> > > > > Can you confirm (a) this patch is OK for
> > > > > "OvmfPkg/IntelTdx/Sec/SecMain.c", and (b) this series fixes the 
> > > > > slowdown
> > you had encountered?
> > > > >
> > > > > (that's what's left before we can merge this series)
> > > > >
> > > > We test the patch in TDX and find EXIT_REASON_CR_ACCESS is triggered in
> > DXE phase.
> > >
> > > Hmm.  Sure this caused by this patch series?  For the PEI-less TDX
> > > build this series moves the MTRR setup to a different place in SEC.
> > > Once the DXE phase started the MTRR configuration should be identical
> > > with and without this patch series, and the series also doesn't touch
> > > any control register.
> > 
> > Ping.  Can you double-check please?  Our QE ran a test build with this 
> > series
> > applied through regression testing (including TDX) and has not found any
> > issues.
> 
> We double check the patch-set (v3) for both OvmfPkgX64 and IntelTdx.
> It triggered EXIT_REASON_CR_ACCESS in DXE phase when launching a
> td-guest.

Have you been able to figure which control register access caused the
EXIT_REASON_CR_ACCESS?

> @Gerd, what's the qemu command and test environment your QE
> run the case? We'd like run it in our side.



Tested edk2-ovmf-20231122-1.el9.rhel21704.20240202.1130.noarch with TDX guest, 
no issue found

Version:

edk2-ovmf-20231122-1.el9.rhel21704.20240202.1130.noarch

guest kernel: 5.14.0-415.el9.x86_64

qemu-kvm-8.0.0-15.el9s.x86_64
host kernel-5.14.0-411.test.el9s.x86_64

Steps:

$ sudo /usr/libexec/qemu-kvm  -accel kvm   -drive 
file=/home/zixchen/rhel94_tdx.qcow2,if=none,id=virtio-disk0   -device 
virtio-blk-pci,drive=virtio-disk0   -cpu host -smp 16 -m 10240 -object 
tdx-guest,id=tdx,debug=on   -machine 
q35,hpet=off,kernel_irqchip=split,memory-encryption=tdx,confidential-guest-support=tdx,memory-backend=ram1
   -object memory-backend-ram,id=ram1,size=10240M,private=on  -nographic -vga 
none   -nodefaults -bios /usr/share/edk2/ovmf/OVMF.inteltdx.secboot.fd  -serial 
stdio  -netdev user,id=user.0 -device e1000,netdev=user.0

$ dmesg|grep -i tdx
[0.00] tdx: Guest detected
[0.719122] TECH PREVIEW: Intel Trusted Domain Extensions (TDX) may not be 
fully supported.
[0.719122]  Intel TDX
[0.719122] process: using TDX aware idle routine



Host configuration with the tdx test packages:
https://sigs.centos.org/virt/tdx/host/

Latest edk2 build (stable202311 + patches) has the patch series
included:

https://kojihub.stream.centos.org/koji/buildinfo?buildID=56985

take care,
  Gerd



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




Re: [edk2-devel] [PATCH 1/1] SbsaQemu: AcpiDxe: Create SRAT table at runtime

2024-02-20 Thread Xiong Yining
This is beacuse UEFI only allocates the first memory node memory space for 
SbsaQemu platform,  i refer to implemet of "OvmfPkg/Fdt/HighMemDxe" and add the 
support for other memory nodes via GCD services. Maybe you can apply patch 
"support multi memory nodes" together with this patch.


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