Re: [edk2-devel] [PATCH] MdeModulePkg: Update GCD attribute conversion to support SP attribute

2024-05-30 Thread Du Lin
Liming - It is still under discussion. I’m checking if this patch can be 
reviewed and merged first. You may find more details in the attached email.

BRs,
Lin, Du

From: devel@edk2.groups.io  On Behalf Of gaoliming via 
groups.io
Sent: Thursday, May 30, 2024 1:02 PM
To: devel@edk2.groups.io; Lin, Du 
Cc: Ni, Ray ; o...@linux.microsoft.com
Subject: 回复: [edk2-devel] [PATCH] MdeModulePkg: Update GCD attribute conversion 
to support SP attribute

Lin:
  I see there is some discussion. Have you made the agreement with this change?

Thanks
Liming
发件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> 代表 Du Lin
发送时间: 2024年5月29日 21:05
收件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
抄送: Liming Gao mailto:gaolim...@byosoft.com.cn>>; Ni, 
Ray mailto:ray...@intel.com>>; Lin, Du 
mailto:du@intel.com>>
主题: Re: [edk2-devel] [PATCH] MdeModulePkg: Update GCD attribute conversion to 
support SP attribute

A pull request has been created for this patch: 
https://github.com/tianocore/edk2/pull/5691.

BRs,
Lin, Du

From: Ni, Ray mailto:ray...@intel.com>>
Sent: Friday, May 10, 2024 10:53 AM
To: Lin, Du mailto:du@intel.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>
Subject: Re: [PATCH] MdeModulePkg: Update GCD attribute conversion to support 
SP attribute

Reviewed-by: Ray Ni mailto:ray...@intel.com>>

Thanks,
Ray

From: Lin, Du mailto:du@intel.com>>
Sent: Thursday, May 9, 2024 12:04
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>
Cc: Lin, Du mailto:du@intel.com>>; Liming Gao 
mailto:gaolim...@byosoft.com.cn>>; Ni, Ray 
mailto:ray...@intel.com>>
Subject: [PATCH] MdeModulePkg: Update GCD attribute conversion to support SP 
attribute

Add a new entry into GCD attribute conversion table to convert
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE to EFI_MEMORY_SP.

Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>
Cc: Ray Ni mailto:ray...@intel.com>>
Signed-off-by: Du Lin mailto:du@intel.com>>
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index fe1bbd6974..99364508cd 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -92,6 +92,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY  mAttributeConversionTable[] = 
{
   { EFI_RESOURCE_ATTRIBUTE_TESTED,  EFI_MEMORY_TESTED,
FALSE },
   { EFI_RESOURCE_ATTRIBUTE_PERSISTABLE, EFI_MEMORY_NV,
TRUE  },
   { EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE,   EFI_MEMORY_MORE_RELIABLE, 
TRUE  },
+  { EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE, EFI_MEMORY_SP,
TRUE  },
   { 0,  0,
FALSE }
 };

--
2.44.0.windows.1



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


--- Begin Message ---
Is there any feedback from CXL stakeholders?

It is OK if more time is needed to check with CXL stakeholders. But looks like 
we all agree that the GCD attribute conversion table shall be updated to 
convert EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE to EFI_MEMORY_SP.
So could we review and merge the conversion table update first, while we are 
waiting for the feedback from CXL stakeholders? If you agree, a pull request 
has been created for the conversion table update: 
https://github.com/tianocore/edk2/pull/5691.

BRs,
Lin, Du

-Original Message-
From: Oliver Smith-Denny 
Sent: Friday, May 24, 2024 5:05 AM
To: devel@edk2.groups.io; Lin, Du ; 
mikub...@linux.microsoft.com
Cc: Liming Gao ; Kinney, Michael D 
; Ni, Ray 
Subject: Re: [edk2-devel] [PATCH v3 1/1] MdeModulePkg: Add the 
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute

On 5/23/2024 2:17 AM, Du Lin wrote:
> Thanks for the quick response.
>
> Agree that the PI and UEFI specs are vague on SP. That is also why I opted to 
> minimize code changes to DXE core for SP support in patch 
> https://edk2.groups.io/g/devel/message/118712.
>
> Would it make more sense to let the caller determine if SP memory is 
> available for UEFI via EFI resource types (e.g., EFI_RESOURCE_SYSTEM_MEMORY 
> vs EFI_RESOURCE_MEMORY_RESERVED)?
>
> CDAT can be read in PEI phase via DOE method and CDAT is important to support 
> CXL 2.0. I believe CDAT spec is referencing EFI_MEMORY_TYPE and Memory 
> Attributes defined in UEFI spec section 7.2. "EfiConventionalMemory Type with 
> EFI_MEMORY_S

Re: [edk2-devel] [PATCH v3 1/1] MdeModulePkg: Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute

2024-05-30 Thread Du Lin
Is there any feedback from CXL stakeholders?

It is OK if more time is needed to check with CXL stakeholders. But looks like 
we all agree that the GCD attribute conversion table shall be updated to 
convert EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE to EFI_MEMORY_SP.
So could we review and merge the conversion table update first, while we are 
waiting for the feedback from CXL stakeholders? If you agree, a pull request 
has been created for the conversion table update: 
https://github.com/tianocore/edk2/pull/5691.

BRs,
Lin, Du

-Original Message-
From: Oliver Smith-Denny  
Sent: Friday, May 24, 2024 5:05 AM
To: devel@edk2.groups.io; Lin, Du ; 
mikub...@linux.microsoft.com
Cc: Liming Gao ; Kinney, Michael D 
; Ni, Ray 
Subject: Re: [edk2-devel] [PATCH v3 1/1] MdeModulePkg: Add the 
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute

On 5/23/2024 2:17 AM, Du Lin wrote:
> Thanks for the quick response.
> 
> Agree that the PI and UEFI specs are vague on SP. That is also why I opted to 
> minimize code changes to DXE core for SP support in patch 
> https://edk2.groups.io/g/devel/message/118712.
> 
> Would it make more sense to let the caller determine if SP memory is 
> available for UEFI via EFI resource types (e.g., EFI_RESOURCE_SYSTEM_MEMORY 
> vs EFI_RESOURCE_MEMORY_RESERVED)?
> 
> CDAT can be read in PEI phase via DOE method and CDAT is important to support 
> CXL 2.0. I believe CDAT spec is referencing EFI_MEMORY_TYPE and Memory 
> Attributes defined in UEFI spec section 7.2. "EfiConventionalMemory Type with 
> EFI_MEMORY_SP Attribute" may suggest that the memory type shall be 
> EfiConventionalMemory and the attribute shall have SP set when reporting the 
> memory to OS. And the concern is whether this combination can still be 
> supported if we always mark resource HOBs with SP set as 
> EfiGcdMemoryTypeReserved.

Thanks for the clarification. I agree that it makes sense to let the resource 
HOB creator determine whether UEFI will put this in system memory or reserved 
memory. DxeCore at that point could decide to not allocate any memory with the 
EFI_MEMORY_SP attribute (or it could decide it doesn't care).

We are meeting with some CXL stakeholders to make sure there is no concern with 
changing this patch and then we will respin this.

Thanks,
Oliver


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




Re: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support new resource attributes

2024-05-30 Thread Du Lin
t; > > > -Original Message-
> > > > > From: Yao, Jiewen 
> > > > > Sent: Thursday, May 16, 2024 5:37 PM
> > > > > To: devel@edk2.groups.io; Lin, Du 
> > > > > Cc: Ard Biesheuvel ; Gerd Hoffmann 
> > > > > 
> > > > > Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list 
> > > > > check to support new resource attributes
> > > > >
> > > > > Reviewed-by: Jiewen Yao 
> > > > >
> > > > > > -Original Message-
> > > > > > From: devel@edk2.groups.io  On Behalf 
> > > > > > Of Lin,
> > Du
> > > > > > Sent: Thursday, May 9, 2024 1:27 PM
> > > > > > To: devel@edk2.groups.io
> > > > > > Cc: Lin, Du ; Ard Biesheuvel 
> > > > > > ; Gerd Hoffmann 
> > > > > > ;
> > Yao,
> > > > > > Jiewen 
> > > > > > Subject: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list 
> > > > > > check to support new resource attributes
> > > > > >
> > > > > > Encrypted and Special Purpose resource attributes are 
> > > > > > introduced in PI
> > > > > > 1.8 Specification. This patch is to update VMM Hob list 
> > > > > > integrity check to recognise these resource attributes.
> > > > > >
> > > > > > Cc: Ard Biesheuvel 
> > > > > > Cc: Gerd Hoffmann 
> > > > > > Cc: Jiewen Yao 
> > > > > > Signed-off-by: Du Lin 
> > > > > > ---
> > > > > >  OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c | 2 ++
> > > > > >  1 file changed, 2 insertions(+)
> > > > > >
> > > > > > diff --git a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> > > > > > b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> > > > > > index b6085eab44..19e9b1bf54 100644
> > > > > > --- a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> > > > > > +++ b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> > > > > > @@ -643,6 +643,8 @@ ValidateHobList (
> > > > > >
> > > > > > EFI_RESOURCE_ATTRIBUTE_PERSISTABLE |
> > > > > >
> > > > > > EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED |
> > > > > >
> > > > > > EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE |
> > > > > > +
> > > > > > + EFI_RESOURCE_ATTRIBUTE_ENCRYPTED|
> > > > > > +
> > > > > > EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE |
> > > > > >
> > > > > > EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE))) != 0)
> > > > > >  {
> > > > > >DEBUG ((DEBUG_ERROR, "HOB: Unknow 
> > > > > > ResourceDescriptor ResourceAttribute type. Type: 0x%08x\n",
> > > > > > Hob.ResourceDescriptor-
> > > > > > >ResourceAttribute));
> > > > > > --
> > > > > > 2.44.0.windows.1
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
> > 
> >



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




Re: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support new resource attributes

2024-05-30 Thread Du Lin
Thanks Jiewen. A new PR has been submitted for this: 
https://github.com/tianocore/edk2/pull/5699.

BRs,
Lin, Du

-Original Message-
From: Yao, Jiewen  
Sent: Thursday, May 30, 2024 8:00 AM
To: devel@edk2.groups.io; Yao, Jiewen ; gaoliming 
; Lin, Du 
Cc: 'Ard Biesheuvel' ; 'Gerd Hoffmann' 

Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support 
new resource attributes

Lin Du
Just FYI: The CI failed after I rebase.

If possible, I recommend to submit a new PR to get it resolved.
Then I can approve again.


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yao, 
> Jiewen
> Sent: Monday, May 27, 2024 3:13 PM
> To: gaoliming ; devel@edk2.groups.io; Lin, 
> Du 
> Cc: 'Ard Biesheuvel' ; 'Gerd Hoffmann'
> 
> Subject: Re: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check 
> to support new resource attributes
> 
> Thanks. Not urgent. Let’s wait.
> 
> 
> > -Original Message-
> > From: gaoliming 
> > Sent: Monday, May 27, 2024 3:12 PM
> > To: devel@edk2.groups.io; Yao, Jiewen ; Lin, 
> > Du 
> > Cc: 'Ard Biesheuvel' ; 'Gerd Hoffmann'
> > 
> > Subject: 回复: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check 
> > to support new resource attributes
> >
> > Jiewen:
> >   If the patch is urgent to be merged, I will help add push label to 
> > merge it with current process.
> >
> >   If the patch is not urgent, it can be merged after TianoCore Code 
> > Review is switched from email to GitHub Pull Requests on US Tuesday.
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: devel@edk2.groups.io  代表 Yao, Jiewen
> > > 发送时间: 2024年5月27日 14:43
> > > 收件人: Lin, Du ; devel@edk2.groups.io
> > > 抄送: Ard Biesheuvel ; Gerd Hoffmann 
> > > 
> > > 主题: Re: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to
> > support
> > > new resource attributes
> > >
> > > I have approved it.
> > >
> > > What is the process to merge? There is no COMMIT button or PUSH label.
> > >
> > >
> > > > -Original Message-
> > > > From: Lin, Du 
> > > > Sent: Monday, May 27, 2024 2:23 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Ard Biesheuvel ; Gerd Hoffmann 
> > > > ; Yao, Jiewen ; Lin, Du 
> > > > 
> > > > Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list 
> > > > check to support new resource attributes
> > > >
> > > > Thanks for the review and approval. Could you please help merge 
> > > > this
> > patch to
> > > > the upstream? A pull request has been created for this patch:
> > > > https://github.com/tianocore/edk2/pull/5644. Thanks.
> > > >
> > > > BRs,
> > > > Lin, Du
> > > >
> > > > -Original Message-
> > > > From: Yao, Jiewen 
> > > > Sent: Thursday, May 16, 2024 5:37 PM
> > > > To: devel@edk2.groups.io; Lin, Du 
> > > > Cc: Ard Biesheuvel ; Gerd Hoffmann 
> > > > 
> > > > Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list 
> > > > check to support new resource attributes
> > > >
> > > > Reviewed-by: Jiewen Yao 
> > > >
> > > > > -Original Message-
> > > > > From: devel@edk2.groups.io  On Behalf Of 
> > > > > Lin,
> Du
> > > > > Sent: Thursday, May 9, 2024 1:27 PM
> > > > > To: devel@edk2.groups.io
> > > > > Cc: Lin, Du ; Ard Biesheuvel 
> > > > > ; Gerd Hoffmann 
> > > > > ;
> Yao,
> > > > > Jiewen 
> > > > > Subject: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list 
> > > > > check to support new resource attributes
> > > > >
> > > > > Encrypted and Special Purpose resource attributes are 
> > > > > introduced in PI
> > > > > 1.8 Specification. This patch is to update VMM Hob list 
> > > > > integrity check to recognise these resource attributes.
> > > > >
> > > > > Cc: Ard Biesheuvel 
> > > > > Cc: Gerd Hoffmann 
> > > > > Cc: Jiewen Yao 
> > > > > Signed-off-by: Du Lin 
> > > > > ---
> > > > >  OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c | 2 ++
> > > > >  1 file changed, 2 insertions(+)
> > > > >
> > > > > diff --git a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> > > > >

Re: [edk2-devel] [PATCH] MdeModulePkg: Update GCD attribute conversion to support SP attribute

2024-05-29 Thread Du Lin
A pull request has been created for this patch: 
https://github.com/tianocore/edk2/pull/5691.

BRs,
Lin, Du

From: Ni, Ray 
Sent: Friday, May 10, 2024 10:53 AM
To: Lin, Du ; devel@edk2.groups.io
Cc: Liming Gao 
Subject: Re: [PATCH] MdeModulePkg: Update GCD attribute conversion to support 
SP attribute

Reviewed-by: Ray Ni mailto:ray...@intel.com>>

Thanks,
Ray

From: Lin, Du mailto:du@intel.com>>
Sent: Thursday, May 9, 2024 12:04
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>
Cc: Lin, Du mailto:du@intel.com>>; Liming Gao 
mailto:gaolim...@byosoft.com.cn>>; Ni, Ray 
mailto:ray...@intel.com>>
Subject: [PATCH] MdeModulePkg: Update GCD attribute conversion to support SP 
attribute

Add a new entry into GCD attribute conversion table to convert
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE to EFI_MEMORY_SP.

Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>
Cc: Ray Ni mailto:ray...@intel.com>>
Signed-off-by: Du Lin mailto:du@intel.com>>
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index fe1bbd6974..99364508cd 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -92,6 +92,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY  mAttributeConversionTable[] = 
{
   { EFI_RESOURCE_ATTRIBUTE_TESTED,  EFI_MEMORY_TESTED,
FALSE },
   { EFI_RESOURCE_ATTRIBUTE_PERSISTABLE, EFI_MEMORY_NV,
TRUE  },
   { EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE,   EFI_MEMORY_MORE_RELIABLE, 
TRUE  },
+  { EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE, EFI_MEMORY_SP,
TRUE  },
   { 0,  0,
FALSE }
 };

--
2.44.0.windows.1


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




Re: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support new resource attributes

2024-05-27 Thread Du Lin
Thanks for the review and approval. Could you please help merge this patch to 
the upstream? A pull request has been created for this patch: 
https://github.com/tianocore/edk2/pull/5644. Thanks.

BRs,
Lin, Du

-Original Message-
From: Yao, Jiewen  
Sent: Thursday, May 16, 2024 5:37 PM
To: devel@edk2.groups.io; Lin, Du 
Cc: Ard Biesheuvel ; Gerd Hoffmann 

Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support 
new resource attributes

Reviewed-by: Jiewen Yao 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Lin, Du
> Sent: Thursday, May 9, 2024 1:27 PM
> To: devel@edk2.groups.io
> Cc: Lin, Du ; Ard Biesheuvel 
> ; Gerd Hoffmann ; Yao, 
> Jiewen 
> Subject: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to 
> support new resource attributes
> 
> Encrypted and Special Purpose resource attributes are introduced in PI 
> 1.8 Specification. This patch is to update VMM Hob list integrity 
> check to recognise these resource attributes.
> 
> Cc: Ard Biesheuvel 
> Cc: Gerd Hoffmann 
> Cc: Jiewen Yao 
> Signed-off-by: Du Lin 
> ---
>  OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> index b6085eab44..19e9b1bf54 100644
> --- a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> +++ b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
> @@ -643,6 +643,8 @@ ValidateHobList (
>  
> EFI_RESOURCE_ATTRIBUTE_PERSISTABLE |
> 
> EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED |
> 
> EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE |
> +
> + EFI_RESOURCE_ATTRIBUTE_ENCRYPTED|
> +
> EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE |
> 
> EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE))) != 0)
>  {
>DEBUG ((DEBUG_ERROR, "HOB: Unknow ResourceDescriptor 
> ResourceAttribute type. Type: 0x%08x\n", Hob.ResourceDescriptor-
> >ResourceAttribute));
> --
> 2.44.0.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119274): https://edk2.groups.io/g/devel/message/119274
Mute This Topic: https://groups.io/mt/105996363/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/1] MdeModulePkg: Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute

2024-05-23 Thread Du Lin
Thanks for the quick response.

Agree that the PI and UEFI specs are vague on SP. That is also why I opted to 
minimize code changes to DXE core for SP support in patch 
https://edk2.groups.io/g/devel/message/118712.

Would it make more sense to let the caller determine if SP memory is available 
for UEFI via EFI resource types (e.g., EFI_RESOURCE_SYSTEM_MEMORY vs 
EFI_RESOURCE_MEMORY_RESERVED)?

CDAT can be read in PEI phase via DOE method and CDAT is important to support 
CXL 2.0. I believe CDAT spec is referencing EFI_MEMORY_TYPE and Memory 
Attributes defined in UEFI spec section 7.2. "EfiConventionalMemory Type with 
EFI_MEMORY_SP Attribute" may suggest that the memory type shall be 
EfiConventionalMemory and the attribute shall have SP set when reporting the 
memory to OS. And the concern is whether this combination can still be 
supported if we always mark resource HOBs with SP set as 
EfiGcdMemoryTypeReserved.

BRs,
Lin, Du

-Original Message-
From: Oliver Smith-Denny  
Sent: Wednesday, May 22, 2024 11:04 PM
To: devel@edk2.groups.io; Lin, Du ; 
mikub...@linux.microsoft.com
Cc: Liming Gao ; Kinney, Michael D 
; Ni, Ray 
Subject: Re: [edk2-devel] [PATCH v3 1/1] MdeModulePkg: Add the 
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute

On 5/21/2024 8:40 PM, Du Lin wrote:
> Coherent Device Attribute Table (CDAT) specification defines a EFI memory 
> type and attribute "EfiConventionalMemory Type with EFI_MEMORY_SP Attribute".
> Can we still support this type if assigning the GCD memory type 
> "EfiGcdMemoryTypeReserved" for resource HOBs with the SPECIAL_PURPOSE 
> attribute set?
> 
> CDAT 1.04 specification: 
> https://uefi.org/sites/default/files/resources/Coherent%20Device%20Att
> ribute%20Table_1.04%20published_0.pdf

Thanks for pointing out the CDAT specification. I think one of the issues here 
is that the PI and UEFI specs are very vague on EFI_MEMORY_SP, to the point 
that there is no user story on it.
This CDAT spec helps close some of the gap, but I think the PI and UEFI spec 
should be updated to be more verbose in the intended usage of this flag.

Does any CDAT code exist in edk2? A naive search didn't turn up anything (and 
even looking at some of the CXL structures I didn't see any usage outside of 
the header). Is the intention that the CDAT would be read in PEI and a resource 
descriptor HOB created from it? If so, I agree this would prevent 
EfiConventionalMemory from being set. I think the CDAT spec should not be 
referencing EFI memory types if that is the case, because resource descriptor 
HOBs deal with resource types, not EFI types, so there is a mismatch.

If the CDAT is read at a different time and a resource descriptor HOB is not 
created from it, then this should not affect it.

The reason that GCD reserved type was chosen here was that the assumption for 
CXL or other remote memory is that UEFI would not want to use it (what if the 
bus went down and DXE core was allocated there). By marking it reserved with 
the EFI_MEMORY_SP bit set, we ensure that UEFI does not use it and that the OS 
knows that this is usable, but the kernel itself may not want to use it, for 
the same reason (or for performance). Again, the UEFI spec does not describe 
what memory type this should be, so if there is a different use case here, 
please do share.

Thanks,
Oliver


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119137): https://edk2.groups.io/g/devel/message/119137
Mute This Topic: https://groups.io/mt/106165072/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/1] MdeModulePkg: Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute

2024-05-21 Thread Du Lin
Coherent Device Attribute Table (CDAT) specification defines a EFI memory type 
and attribute "EfiConventionalMemory Type with EFI_MEMORY_SP Attribute".
Can we still support this type if assigning the GCD memory type 
"EfiGcdMemoryTypeReserved" for resource HOBs with the SPECIAL_PURPOSE attribute 
set?

CDAT 1.04 specification: 
https://uefi.org/sites/default/files/resources/Coherent%20Device%20Attribute%20Table_1.04%20published_0.pdf

BRs,
Lin, Du

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael Kubacki
Sent: Saturday, May 18, 2024 8:58 AM
To: devel@edk2.groups.io
Cc: Liming Gao ; Kinney, Michael D 

Subject: [edk2-devel] [PATCH v3 1/1] MdeModulePkg: Add the 
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute

From: Patrick Payne 

Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE resource attribute as per the PI 
1.8 spec. This flag is used to indicate that the memory should be treated as 
special purpose memory (SPM).

Cc: Liming Gao 
Cc: Michael D Kinney 
Signed-off-by: Michael Kubacki 
---

Notes:
V3: Assign the GCD memory type for resource HOBs with
the SPECIAL_PURPOSE attribute set prior to assigning
the GCD memory type for the PERSISTENT attribute.

Assign the GCD memory type EfiGcdMemoryTypeReserved
instead of EfiGcdMemoryTypeSystemMemory for resource
HOBs with the SPECIAL_PURPOSE attribute set.

V2: Adds package name to commit subject and updates
Signed-off-by.

 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c 
index fe1bbd6974b7..4cc0940c0a7d 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -26,7 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_RESOURCE_ATTRIBUTE_16_BIT_IO
   | \
EFI_RESOURCE_ATTRIBUTE_32_BIT_IO
   | \
EFI_RESOURCE_ATTRIBUTE_64_BIT_IO
   | \
-   EFI_RESOURCE_ATTRIBUTE_PERSISTENT   
   )
+   EFI_RESOURCE_ATTRIBUTE_PERSISTENT   
   | \
+   EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE  
   )
 
 #define TESTED_MEMORY_ATTRIBUTES  (EFI_RESOURCE_ATTRIBUTE_PRESENT | \
EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \ 
@@ -92,6 +93,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY  mAttributeConversionTable[] = 
{
   { EFI_RESOURCE_ATTRIBUTE_TESTED,  EFI_MEMORY_TESTED,
FALSE },
   { EFI_RESOURCE_ATTRIBUTE_PERSISTABLE, EFI_MEMORY_NV,
TRUE  },
   { EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE,   EFI_MEMORY_MORE_RELIABLE, 
TRUE  },
+  { EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE, EFI_MEMORY_SP,
TRUE  },
   { 0,  0,
FALSE }
 };
 
@@ -691,6 +693,10 @@ ConverToCpuArchAttributes (
 CpuArchAttributes |= EFI_MEMORY_WP;
   }
 
+  if ((Attributes & EFI_MEMORY_SP) == EFI_MEMORY_SP) {
+CpuArchAttributes |= EFI_MEMORY_SP;  }
+
   return CpuArchAttributes;
 }
 
@@ -2656,6 +2662,10 @@ CoreInitializeGcdServices (
 GcdMemoryType = EfiGcdMemoryTypeReserved;
   }
 
+  if ((ResourceHob->ResourceAttribute & 
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE) == 
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE) {
+GcdMemoryType = EfiGcdMemoryTypeReserved;
+  }
+
   if ((ResourceHob->ResourceAttribute & 
EFI_RESOURCE_ATTRIBUTE_PERSISTENT) == EFI_RESOURCE_ATTRIBUTE_PERSISTENT) {
 GcdMemoryType = EfiGcdMemoryTypePersistent;
   }
--
2.45.1.windows.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119065): https://edk2.groups.io/g/devel/message/119065
Mute This Topic: https://groups.io/mt/106165072/8327890
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [du@intel.com]
-=-=-=-=-=-=




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




Re: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support new resource attributes

2024-05-20 Thread Du Lin
Thanks for the review and approval. Could you please help merge this patch to 
the upstream? A pull request has been created for this patch: 
https://github.com/tianocore/edk2/pull/5644. Thanks.


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




Re: [edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support new resource attributes

2024-05-16 Thread Du Lin
Thanks for the review and approval. Could you please help merge this patch to 
the upstream? A pull request has been created for this patch: 
https://github.com/tianocore/edk2/pull/5644. Thanks.


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




[edk2-devel] [PATCH] OvmfPkg: Update VMM Hob list check to support new resource attributes

2024-05-08 Thread Du Lin
Encrypted and Special Purpose resource attributes are introduced in
PI 1.8 Specification. This patch is to update VMM Hob list integrity
check to recognise these resource attributes.

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Signed-off-by: Du Lin 
---
 OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c 
b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
index b6085eab44..19e9b1bf54 100644
--- a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
+++ b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c
@@ -643,6 +643,8 @@ ValidateHobList (
 
EFI_RESOURCE_ATTRIBUTE_PERSISTABLE |
 
EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED |
 
EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE |
+
EFI_RESOURCE_ATTRIBUTE_ENCRYPTED|
+
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE |
 
EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE))) != 0)
 {
   DEBUG ((DEBUG_ERROR, "HOB: Unknow ResourceDescriptor 
ResourceAttribute type. Type: 0x%08x\n", 
Hob.ResourceDescriptor->ResourceAttribute));
-- 
2.44.0.windows.1



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




[edk2-devel] [PATCH] MdeModulePkg: Update GCD attribute conversion to support SP attribute

2024-05-08 Thread Du Lin
Add a new entry into GCD attribute conversion table to convert
EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE to EFI_MEMORY_SP.

Cc: Liming Gao 
Cc: Ray Ni 
Signed-off-by: Du Lin 
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index fe1bbd6974..99364508cd 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -92,6 +92,7 @@ GCD_ATTRIBUTE_CONVERSION_ENTRY  mAttributeConversionTable[] = 
{
   { EFI_RESOURCE_ATTRIBUTE_TESTED,  EFI_MEMORY_TESTED,
FALSE },
   { EFI_RESOURCE_ATTRIBUTE_PERSISTABLE, EFI_MEMORY_NV,
TRUE  },
   { EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE,   EFI_MEMORY_MORE_RELIABLE, 
TRUE  },
+  { EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE, EFI_MEMORY_SP,
TRUE  },
   { 0,  0,
FALSE }
 };
 
-- 
2.44.0.windows.1



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




Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-13 Thread Du Lin
This patch has been updated to address Ray's comment. For more details, please 
check [PATCH v2] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit() 
(groups.io) ( https://edk2.groups.io/g/devel/message/116723 ). Thanks Ray for 
the comment.


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




[edk2-devel] [PATCH v2] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-13 Thread Du Lin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4701

The error handling of FspmWrapperInit() is limited to ASSERT
statements only, which only works in debug builds, but not in
release builds.
Fix the issue by enhancing the error handling of FspmWrapperInit()
to cover both debug builds and release builds.

Signed-off-by: Du Lin 
Cc: Ashraf Ali S 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Susovan Mohapatra 
Cc: Ted Kuo 
---
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c 
b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index ba0c742fea..7f1deb9542 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -197,12 +197,20 @@ FspmWrapperInit (
 
   MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
   ASSERT (MeasurementExcludedFvPpi != NULL);
+  if (MeasurementExcludedFvPpi == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedFvPpi->Count  = 1;
   MeasurementExcludedFvPpi->Fv[0].FvBase   = PcdGet32 (PcdFspmBaseAddress);
   MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER 
*)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength;
 
   MeasurementExcludedPpiList = AllocatePool (sizeof 
(*MeasurementExcludedPpiList));
   ASSERT (MeasurementExcludedPpiList != NULL);
+  if (MeasurementExcludedPpiList == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
   MeasurementExcludedPpiList->Guid  = 

   MeasurementExcludedPpiList->Ppi   = MeasurementExcludedFvPpi;
-- 
2.44.0.windows.1



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




[edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()

2024-03-12 Thread Du Lin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4701

The error handling of FspmWrapperInit() is limited to ASSERT
statements only, which only works in debug builds, but not in
release builds.
Fix the issue by enhancing the error handling of FspmWrapperInit()
to cover both debug builds and release builds.

Signed-off-by: Du Lin 
Cc: Ashraf Ali S 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Susovan Mohapatra 
Cc: Ted Kuo 
---
 .../FspmWrapperPeim/FspmWrapperPeim.c| 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c 
b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index ba0c742fea..356baeeccf 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -196,13 +196,21 @@ FspmWrapperInit (
   EFI_PEI_PPI_DESCRIPTOR 
*MeasurementExcludedPpiList;
 
   MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
-  ASSERT (MeasurementExcludedFvPpi != NULL);
+  if (MeasurementExcludedFvPpi == NULL) {
+ASSERT (FALSE);
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedFvPpi->Count  = 1;
   MeasurementExcludedFvPpi->Fv[0].FvBase   = PcdGet32 (PcdFspmBaseAddress);
   MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER 
*)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength;
 
   MeasurementExcludedPpiList = AllocatePool (sizeof 
(*MeasurementExcludedPpiList));
-  ASSERT (MeasurementExcludedPpiList != NULL);
+  if (MeasurementExcludedPpiList == NULL) {
+ASSERT (FALSE);
+return EFI_OUT_OF_RESOURCES;
+  }
+
   MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
   MeasurementExcludedPpiList->Guid  = 

   MeasurementExcludedPpiList->Ppi   = MeasurementExcludedFvPpi;
-- 
2.44.0.windows.1



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




[edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of TpmMeasureAndLogDataWithFlags()

2024-03-12 Thread Du Lin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4700

TpmMeasureAndLogDataWithFlags() computes the measure the code and
log it into PCR 0. TpmMeasureAndLogData() computes the hash for the
configuration. The same "Status" variable is used to store the return
values for both of the functions. There is no error handling if
TpmMeasureAndLogDataWithFlags() returns an error Status.
Fix the issue by adding error handling for TpmMeasureAndLogDataWithFlags().

Signed-off-by: Du Lin 
Cc: Ashraf Ali S 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Susovan Mohapatra 
Cc: Ted Kuo 
---
 .../Library/BaseFspMeasurementLib/FspMeasurementLib.c | 4 
 1 file changed, 4 insertions(+)

diff --git 
a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c 
b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
index 2c017a4250..228277649b 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
+++ b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c
@@ -197,6 +197,10 @@ MeasureFspFirmwareBlobWithCfg (
  (UINTN)sizeof (DigestList),
  EDKII_TCG_PRE_HASH_LOG_ONLY
  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "TpmMeasureAndLogDataWithFlags failed - %r\n", 
Status));
+return Status;
+  }
 
   Status = TpmMeasureAndLogData (
  1,
-- 
2.26.2.windows.1



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