Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Michael Kubacki
The file looks okay to me as an interface proposal but I agree with 
Jiewen about deferring the edk2 submission until an implementation can 
be reviewed with it as well.


Regards,
Michael


On 6/10/2022 9:09 PM, Yao, Jiewen wrote:

Thanks for the response.

1) Why we need "enable UEFI variable write before permanent memory is 
available"?

2) If the implementation is not ready, I do have concern to add it so early in 
EDKII.
If I don’t have a big picture, I am not sure how to review the completeness.

Can we put it to EDKII-staging (https://github.com/tianocore/edk2-staging) for 
a moment?
I don’t see the need to add the interface now for work-in-progress feature, 
since there is no consumer and no producer.

Another reason is that I happen to know other feature (in EDKII stage) is 
impacting variable driver.
https://github.com/tianocore/edk2-staging/tree/ProtectedVariable/libs

Please do consider that as well - how to write a protected variable in PEI 
phase.

Thank you
Yao Jiewen


-Original Message-
From: Desimone, Nathaniel L 
Sent: Saturday, June 11, 2022 5:49 AM
To: Yao, Jiewen ; devel@edk2.groups.io;
michael.kuba...@outlook.com
Cc: Wang, Jian J ; Gao, Liming
; Kinney, Michael D
; Oram, Isaac W ;
Chiu, Chasel ; Cheng, Gao ;
Zhang, Di ; Bu, Daocheng ;
Kubacki, Michael 
Subject: RE: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of
EDKII_PEI_VARIABLE_PPI

Hi Jiewen,

Thanks for the feedback, per your questions:

1. The primary use case for this is to enable UEFI variable writes before
permanent memory is available.
2. The implementation is a work in progress. We will provide it shortly. As this
will be a rather large patch set, I would like to get this piece in place 
beforehand
so that the reviewers can focus on the implementation separate from the API
definition.
3. No impact to secure boot. We are not going to support writing to
authenticated variables in PEI. As mentioned in the comments, if a PEIM wishes
to update any of the authenticated variables it must use the existing HOB
mechanism to have a later DXE phase perform the update.
4. With regard to atomicity, we have a complete implementation of the fault
tolerant write services operational in Pre-Memory PEI.
5. Good point on the S3 resume, we will need to add an SMI to have the variable
services re-initialize the mNvVariableCache.

Hope that helps,
Nate

-Original Message-
From: Yao, Jiewen 
Sent: Friday, June 10, 2022 9:56 AM
To: devel@edk2.groups.io; michael.kuba...@outlook.com; Desimone,
Nathaniel L 
Cc: Wang, Jian J ; Gao, Liming
; Kinney, Michael D
; Oram, Isaac W ;
Chiu, Chasel ; Cheng, Gao ;
Zhang, Di ; Bu, Daocheng ;
Kubacki, Michael 
Subject: RE: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of
EDKII_PEI_VARIABLE_PPI

Hi

I am curious why we need this interface. Why we need write variable capability
in PEI phase?

Where is the implementation of this? I prefer to see an implementation
submitted together with header file.
For example, what is the impact to secure boot related feature, how to write
auth variable in PEI, how PEI write variable cowork with SMM version in S3
resume phase, how to support variable atomicity, etc.

Thank you
Yao Jiewen



-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael
Kubacki
Sent: Friday, June 10, 2022 10:00 AM
To: devel@edk2.groups.io; Desimone, Nathaniel L

Cc: Wang, Jian J ; Gao, Liming
; Kinney, Michael D
; Oram, Isaac W ;
Chiu, Chasel ; Cheng, Gao
; Zhang, Di ; Bu, Daocheng
; Kubacki, Michael

Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition
of EDKII_PEI_VARIABLE_PPI

Is this change just adding the interface to Tianocore or is there
additional implementation planned as well?

---

I thought we were following this convention now:

"#ifndef __PEI_VARIABLE_PPI_H_" -> "#ifndef PEI_VARIABLE_PPI_H_"

Some other comments are inline.

Regards,
Michael

On 6/9/2022 9:17 PM, Nate DeSimone wrote:

Adds definition of EDKII_PEI_VARIABLE_PPI, a pre-cursor to enabling
variable writes in the PEI environment.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Isaac Oram 
Cc: Chasel Chiu 
Cc: Gao Cheng 
Cc: Di Zhang 
Cc: Daocheng Bu 
Cc: Michael Kubacki 
Signed-off-by: Nate DeSimone 
---
   MdeModulePkg/Include/Ppi/Variable.h | 189



   MdeModulePkg/MdeModulePkg.dec   |   3 +
   2 files changed, 192 insertions(+)
   create mode 100644 MdeModulePkg/Include/Ppi/Variable.h

diff --git a/MdeModulePkg/Include/Ppi/Variable.h

b/MdeModulePkg/Include/Ppi/Variable.h

new file mode 100644
index 00..97dc7ceefa
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/Variable.h
@@ -0,0 +1,189 @@
+/** @file
+  EDKII PEI Variable Protocol provides an implementation of
+variables


[MK] Was "EDKII PEI Variable PPI" intended?


+  intended for use as a means to store data in the PEI environment.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+

Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Yao, Jiewen
Thanks for the response.

1) Why we need "enable UEFI variable write before permanent memory is 
available"?

2) If the implementation is not ready, I do have concern to add it so early in 
EDKII.
If I don’t have a big picture, I am not sure how to review the completeness.

Can we put it to EDKII-staging (https://github.com/tianocore/edk2-staging) for 
a moment?
I don’t see the need to add the interface now for work-in-progress feature, 
since there is no consumer and no producer.

Another reason is that I happen to know other feature (in EDKII stage) is 
impacting variable driver.
https://github.com/tianocore/edk2-staging/tree/ProtectedVariable/libs

Please do consider that as well - how to write a protected variable in PEI 
phase.

Thank you
Yao Jiewen

> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Saturday, June 11, 2022 5:49 AM
> To: Yao, Jiewen ; devel@edk2.groups.io;
> michael.kuba...@outlook.com
> Cc: Wang, Jian J ; Gao, Liming
> ; Kinney, Michael D
> ; Oram, Isaac W ;
> Chiu, Chasel ; Cheng, Gao ;
> Zhang, Di ; Bu, Daocheng ;
> Kubacki, Michael 
> Subject: RE: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of
> EDKII_PEI_VARIABLE_PPI
> 
> Hi Jiewen,
> 
> Thanks for the feedback, per your questions:
> 
> 1. The primary use case for this is to enable UEFI variable writes before
> permanent memory is available.
> 2. The implementation is a work in progress. We will provide it shortly. As 
> this
> will be a rather large patch set, I would like to get this piece in place 
> beforehand
> so that the reviewers can focus on the implementation separate from the API
> definition.
> 3. No impact to secure boot. We are not going to support writing to
> authenticated variables in PEI. As mentioned in the comments, if a PEIM wishes
> to update any of the authenticated variables it must use the existing HOB
> mechanism to have a later DXE phase perform the update.
> 4. With regard to atomicity, we have a complete implementation of the fault
> tolerant write services operational in Pre-Memory PEI.
> 5. Good point on the S3 resume, we will need to add an SMI to have the 
> variable
> services re-initialize the mNvVariableCache.
> 
> Hope that helps,
> Nate
> 
> -Original Message-
> From: Yao, Jiewen 
> Sent: Friday, June 10, 2022 9:56 AM
> To: devel@edk2.groups.io; michael.kuba...@outlook.com; Desimone,
> Nathaniel L 
> Cc: Wang, Jian J ; Gao, Liming
> ; Kinney, Michael D
> ; Oram, Isaac W ;
> Chiu, Chasel ; Cheng, Gao ;
> Zhang, Di ; Bu, Daocheng ;
> Kubacki, Michael 
> Subject: RE: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of
> EDKII_PEI_VARIABLE_PPI
> 
> Hi
> 
> I am curious why we need this interface. Why we need write variable capability
> in PEI phase?
> 
> Where is the implementation of this? I prefer to see an implementation
> submitted together with header file.
> For example, what is the impact to secure boot related feature, how to write
> auth variable in PEI, how PEI write variable cowork with SMM version in S3
> resume phase, how to support variable atomicity, etc.
> 
> Thank you
> Yao Jiewen
> 
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Michael
> > Kubacki
> > Sent: Friday, June 10, 2022 10:00 AM
> > To: devel@edk2.groups.io; Desimone, Nathaniel L
> > 
> > Cc: Wang, Jian J ; Gao, Liming
> > ; Kinney, Michael D
> > ; Oram, Isaac W ;
> > Chiu, Chasel ; Cheng, Gao
> > ; Zhang, Di ; Bu, Daocheng
> > ; Kubacki, Michael
> > 
> > Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition
> > of EDKII_PEI_VARIABLE_PPI
> >
> > Is this change just adding the interface to Tianocore or is there
> > additional implementation planned as well?
> >
> > ---
> >
> > I thought we were following this convention now:
> >
> > "#ifndef __PEI_VARIABLE_PPI_H_" -> "#ifndef PEI_VARIABLE_PPI_H_"
> >
> > Some other comments are inline.
> >
> > Regards,
> > Michael
> >
> > On 6/9/2022 9:17 PM, Nate DeSimone wrote:
> > > Adds definition of EDKII_PEI_VARIABLE_PPI, a pre-cursor to enabling
> > > variable writes in the PEI environment.
> > >
> > > Cc: Jian J Wang 
> > > Cc: Liming Gao 
> > > Cc: Michael D Kinney 
> > > Cc: Isaac Oram 
> > > Cc: Chasel Chiu 
> > > Cc: Gao Cheng 
> > > Cc: Di Zhang 
> > > Cc: Daocheng Bu 
> > > Cc: Michael Kubacki 
> > > Signed-off-by: Nate DeSimone 
> > > ---
> > >   MdeModulePkg/Include/Ppi/Variable.h | 189
> > 
> > >   MdeModulePkg/MdeModulePkg.dec   |   3 +
> > >   2 files changed, 192 insertions(+)
> > >   create mode 100644 MdeModulePkg/Include/Ppi/Variable.h
> > >
> > > diff --git a/MdeModulePkg/Include/Ppi/Variable.h
> > b/MdeModulePkg/Include/Ppi/Variable.h
> > > new file mode 100644
> > > index 00..97dc7ceefa
> > > --- /dev/null
> > > +++ b/MdeModulePkg/Include/Ppi/Variable.h
> > > @@ -0,0 +1,189 @@
> > > +/** @file
> > > +  EDKII PEI Variable Protocol provides an implementation of
> > > +variables
> >
> > [MK] Was "EDKII PEI Variable PPI" intended?
> 

Re: [edk2-devel] [PATCH V2 0/1] Add EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Michael Kubacki

Acked-by: Michael Kubacki 

On 6/10/2022 5:20 PM, Nate DeSimone wrote:

Changes in V2:
   - Fixed instances where the new PPI was incorrectly reffered to as
 "EDKII PEI Variable Protocol"
   - Added OPTIONAL to the Attributes argument of GetVariable()
   - Added description of initial calling conditions to GetNextVariableName()
   - Clarified the function and format of EFI_AUTHENTICATED_VARIABLE_HOB

This patch series proposes a new architectural PPI: EDKII_PEI_VARIABLE_PPI
This PPI provides services to read and write to UEFI variables during the PEI
environment. While an implementation of this PPI does not exist yet, Intel is
working on a new implementation of the PEI variable services that includes write
support.

As this is essentially a PEI version of the EFI_SMM_VARIABLE_PROTOCOL, I don't
expect it to be immensely controversial. Regardless, before this implementation
is done, we would like to provide the community with an opportunity to provide
input the on new architectural PPI.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Isaac Oram 
Cc: Chasel Chiu 
Cc: Gao Cheng 
Cc: Di Zhang 
Cc: Daocheng Bu 
Cc: Michael Kubacki 
Signed-off-by: Nate DeSimone 

Nathaniel L Desimone (1):
   MdeModulePkg: Add Definition of EDKII_PEI_VARIABLE_PPI

  MdeModulePkg/Include/Ppi/Variable.h | 195 
  MdeModulePkg/MdeModulePkg.dec   |   3 +
  2 files changed, 198 insertions(+)
  create mode 100644 MdeModulePkg/Include/Ppi/Variable.h




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




[edk2-devel] [PATCH v3 1/1] [edk2-platforms]Tools\FitGen: Add extra parameter fixed FIT address

2022-06-10 Thread wenyijia
From: fanwang2intel 

Add "-T " parameter to provide fixed
FIT address on flash region. When this parameter is set
to a valid address in the input FD/FV file, tool will
directly generate FIT on this address.

It's users' responsibilities to reserve enough size for
FIT table and option modules on the target location,
otherwise, FIT Gen process will fail.

Cc: Chen Christine 
Cc: Bob Feng 

Signed-off-by: fanwang2intel 
---
 Silicon/Intel/Tools/FitGen/FitGen.c | 163 ++--
 1 file changed, 120 insertions(+), 43 deletions(-)

diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c 
b/Silicon/Intel/Tools/FitGen/FitGen.c
index 290e688f6e4e..4de72ea4225e 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -345,6 +345,7 @@ Returns:
   "\t[-M ] [-M ...]|[-U ||] [-V 
]\n"
   "\t[-O RecordType  [-V ]] [-O ... [-V ...]]\n"
   "\t[-P RecordType  [-V 
]] [-P ... [-V ...]]\n"
+  "\t[-T ]\n"
   , UTILITY_NAME);
   printf ("  Where:\n");
   printf ("\t-D - It is FD file instead of FV file. (The 
tool will search FV file)\n");
@@ -388,6 +389,7 @@ Returns:
   printf ("\tWidth  - The Width of the port.\n");
   printf ("\tBit- The Bit Number of the port.\n");
   printf ("\tIndex  - The Index Number of the port.\n");
+  printf ("\tFixedFitLocation   - Fixed FIT location in flash address. FIT 
table will be generated at this location and Option Modules will be directly 
put right before it.\n");
   printf ("\nUsage (view): %s [-view] InputFile -F \n", 
UTILITY_NAME);
   printf ("  Where:\n");
   printf ("\tInputFile  - Name of the input file.\n");
@@ -445,6 +447,46 @@ CheckPath (
   return TRUE;
 }
 
+UINT32
+GetFixedFitLocation (
+  IN INTN   argc,
+  IN CHAR8  **argv
+  )
+/*++
+
+Routine Description:
+
+  Get fixed FIT location from argument
+
+Arguments:
+
+  argc   - Number of command line parameters.
+  argv   - Array of pointers to parameter strings.
+
+Returns:
+
+  FitLocation - The FIT location specified by Argument
+  0   - Argument parse fail
+
+*/
+{
+  UINT32  FitLocation;
+  INTNIndex;
+
+  FitLocation = 0;
+
+  for (Index = 0; Index + 1 < argc; Index ++) {
+
+if ((strcmp (argv[Index], "-T") == 0) ||
+(strcmp (argv[Index], "-t") == 0) ) {
+  FitLocation =  xtoi (argv[Index + 1]);
+  break;
+}
+  }
+
+  return FitLocation;
+}
+
 STATUS
 ReadInputFile (
   IN CHAR8*FileName,
@@ -1909,10 +1951,11 @@ Returns:
 }
 
 VOID *
-GetFreeSpaceFromFv (
+GetFreeSpaceForFit (
   IN UINT8 *FvBuffer,
   IN UINT32FvSize,
-  IN UINT32FitEntryNumber
+  IN UINT32FitTableSize,
+  IN UINT32FixedFitLocation
   )
 /*++
 
@@ -1922,9 +1965,10 @@ Routine Description:
 
 Arguments:
 
-  FvBuffer   - FvRecovery binary buffer
-  FvSize - FvRecovery size
-  FitEntryNumber - The FIT entry number
+  FvBuffer - FvRecovery binary buffer
+  FvSize   - FvRecovery size
+  FitTableSize - The FIT table size
+  FixedFitLocation - Fixed FIT location provided by argument
 
 Returns:
 
@@ -1939,7 +1983,6 @@ Returns:
   UINT8   *OptionalModuleAddress;
   EFI_GUIDVTFGuid = EFI_FFS_VOLUME_TOP_FILE_GUID;
   UINT32  AlignedSize;
-  UINT32  FitTableSize;
 
   EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;
   EFI_FFS_FILE_HEADER *FileHeader;
@@ -1966,45 +2009,62 @@ Returns:
 }
   }
 
-  //
-  // Get EFI_FFS_VOLUME_TOP_FILE_GUID location
-  //
-  FitTableOffset = NULL;
+  if (FixedFitLocation != 0) {
+//
+// Get Free space from fixed location
+//
+FitTableOffset = (UINT8 *) FLASH_TO_MEMORY (FixedFitLocation, FvBuffer, 
FvSize);
+  } else {
+//
+// Get Free Space from FvRecovery
+//
+FitTableOffset = NULL;
 
-  FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)FvBuffer;
-  FvLength = FvHeader->FvLength;
-  FileHeader   = (EFI_FFS_FILE_HEADER *)(FvBuffer + 
FvHeader->HeaderLength);
-  Offset   = (UINTN)FileHeader - (UINTN)FvBuffer;
+FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)FvBuffer;
+FvLength = FvHeader->FvLength;
+FileHeader   = (EFI_FFS_FILE_HEADER *)(FvBuffer + 
FvHeader->HeaderLength);
+Offset   = (UINTN)FileHeader - (UINTN)FvBuffer;
 
-  while (Offset < FvLength) {
-FileLength = (*(UINT32 *)(FileHeader->Size)) & 0x00FF;
-FileOccupiedSize = GETOCCUPIEDSIZE(FileLength, 8);
-if ((CompareGuid (&(FileHeader->Name), &VTFGuid)) == 0) {
-  // find it
-  FitTableOffset = (UINT8 *)FileHeader;
-  break;
+//
+// Get EFI_FFS_VOLUME_TOP_FILE_GUID location
+//
+while (Offset < FvLength) {
+  FileLength = (*(UINT32 *)(FileHeader->Size)) & 0x00FF;
+  FileOccupiedSize = GETOCCUPIEDSIZE(FileLength, 8);
+  if ((CompareGuid (&(FileHeader->Name), &VTFGuid)) == 0) {
+// find it
+   

Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Nate DeSimone
Hi Jiewen,

Thanks for the feedback, per your questions:

1. The primary use case for this is to enable UEFI variable writes before 
permanent memory is available.
2. The implementation is a work in progress. We will provide it shortly. As 
this will be a rather large patch set, I would like to get this piece in place 
beforehand so that the reviewers can focus on the implementation separate from 
the API definition.
3. No impact to secure boot. We are not going to support writing to 
authenticated variables in PEI. As mentioned in the comments, if a PEIM wishes 
to update any of the authenticated variables it must use the existing HOB 
mechanism to have a later DXE phase perform the update.
4. With regard to atomicity, we have a complete implementation of the fault 
tolerant write services operational in Pre-Memory PEI.
5. Good point on the S3 resume, we will need to add an SMI to have the variable 
services re-initialize the mNvVariableCache.

Hope that helps,
Nate

-Original Message-
From: Yao, Jiewen  
Sent: Friday, June 10, 2022 9:56 AM
To: devel@edk2.groups.io; michael.kuba...@outlook.com; Desimone, Nathaniel L 

Cc: Wang, Jian J ; Gao, Liming 
; Kinney, Michael D ; 
Oram, Isaac W ; Chiu, Chasel ; 
Cheng, Gao ; Zhang, Di ; Bu, Daocheng 
; Kubacki, Michael 
Subject: RE: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of 
EDKII_PEI_VARIABLE_PPI

Hi

I am curious why we need this interface. Why we need write variable capability 
in PEI phase?

Where is the implementation of this? I prefer to see an implementation 
submitted together with header file.
For example, what is the impact to secure boot related feature, how to write 
auth variable in PEI, how PEI write variable cowork with SMM version in S3 
resume phase, how to support variable atomicity, etc.

Thank you
Yao Jiewen


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael 
> Kubacki
> Sent: Friday, June 10, 2022 10:00 AM
> To: devel@edk2.groups.io; Desimone, Nathaniel L 
> 
> Cc: Wang, Jian J ; Gao, Liming 
> ; Kinney, Michael D 
> ; Oram, Isaac W ; 
> Chiu, Chasel ; Cheng, Gao 
> ; Zhang, Di ; Bu, Daocheng 
> ; Kubacki, Michael 
> 
> Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition 
> of EDKII_PEI_VARIABLE_PPI
> 
> Is this change just adding the interface to Tianocore or is there 
> additional implementation planned as well?
> 
> ---
> 
> I thought we were following this convention now:
> 
> "#ifndef __PEI_VARIABLE_PPI_H_" -> "#ifndef PEI_VARIABLE_PPI_H_"
> 
> Some other comments are inline.
> 
> Regards,
> Michael
> 
> On 6/9/2022 9:17 PM, Nate DeSimone wrote:
> > Adds definition of EDKII_PEI_VARIABLE_PPI, a pre-cursor to enabling 
> > variable writes in the PEI environment.
> >
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Cc: Michael D Kinney 
> > Cc: Isaac Oram 
> > Cc: Chasel Chiu 
> > Cc: Gao Cheng 
> > Cc: Di Zhang 
> > Cc: Daocheng Bu 
> > Cc: Michael Kubacki 
> > Signed-off-by: Nate DeSimone 
> > ---
> >   MdeModulePkg/Include/Ppi/Variable.h | 189
> 
> >   MdeModulePkg/MdeModulePkg.dec   |   3 +
> >   2 files changed, 192 insertions(+)
> >   create mode 100644 MdeModulePkg/Include/Ppi/Variable.h
> >
> > diff --git a/MdeModulePkg/Include/Ppi/Variable.h
> b/MdeModulePkg/Include/Ppi/Variable.h
> > new file mode 100644
> > index 00..97dc7ceefa
> > --- /dev/null
> > +++ b/MdeModulePkg/Include/Ppi/Variable.h
> > @@ -0,0 +1,189 @@
> > +/** @file
> > +  EDKII PEI Variable Protocol provides an implementation of 
> > +variables
> 
> [MK] Was "EDKII PEI Variable PPI" intended?
> 
> > +  intended for use as a means to store data in the PEI environment.
> > +
> > +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef __PEI_VARIABLE_PPI_H_
> > +#define __PEI_VARIABLE_PPI_H_
> > +
> > +#define EDKII_PEI_VARIABLE_PPI_GUID \
> > +  { \
> > +0xe7b2cd04, 0x4b14, 0x44c2, { 0xb7, 0x48, 0xce, 0xaf, 0x2b, 
> > +0x66, 0x4a,
> 0xb0 } \
> > +  }
> > +
> > +typedef struct _EDKII_PEI_VARIABLE_PPI EDKII_PEI_VARIABLE_PPI;
> > +
> > +/**
> > +  This service retrieves a variable's value using its name and GUID.
> > +
> > +  Read the specified variable from the UEFI variable store. If the 
> > + Data  buffer is too small to hold the contents of the variable,  
> > + the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to 
> > + the  required buffer size to obtain the data.
> > +
> > +  @param[in]This  A pointer to this instance of the
> EDKII_PEI_VARIABLE_PPI.
> > +  @param[in]VariableName  A pointer to a null-terminated 
> > string that
> is the variable's name.
> > +  @param[in]VariableGuid  A pointer to an EFI_GUID that is the
> variable's GUID. The combination of
> > +  VariableGuid and VariableName must 
> > be unique.
> > +  @param[out]   AttributesIf non-NULL, on

[edk2-devel] [PATCH V2 1/1] MdeModulePkg: Add Definition of EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Nate DeSimone
Adds definition of EDKII_PEI_VARIABLE_PPI, a pre-cursor
to enabling variable writes in the PEI environment.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Isaac Oram 
Cc: Chasel Chiu 
Cc: Gao Cheng 
Cc: Di Zhang 
Cc: Daocheng Bu 
Cc: Michael Kubacki 
Signed-off-by: Nate DeSimone 
---
 MdeModulePkg/Include/Ppi/Variable.h | 195 
 MdeModulePkg/MdeModulePkg.dec   |   3 +
 2 files changed, 198 insertions(+)
 create mode 100644 MdeModulePkg/Include/Ppi/Variable.h

diff --git a/MdeModulePkg/Include/Ppi/Variable.h 
b/MdeModulePkg/Include/Ppi/Variable.h
new file mode 100644
index 00..b4b120d2ba
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/Variable.h
@@ -0,0 +1,195 @@
+/** @file
+  EDKII PEI Variable PPI provides an implementation of variables
+  intended for use as a means to store data in the PEI environment.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef PEI_VARIABLE_PPI_H_
+#define PEI_VARIABLE_PPI_H_
+
+#define EDKII_PEI_VARIABLE_PPI_GUID \
+  { \
+0xe7b2cd04, 0x4b14, 0x44c2, { 0xb7, 0x48, 0xce, 0xaf, 0x2b, 0x66, 0x4a, 
0xb0 } \
+  }
+
+typedef struct _EDKII_PEI_VARIABLE_PPI EDKII_PEI_VARIABLE_PPI;
+
+/**
+  This service retrieves a variable's value using its name and GUID.
+
+  Read the specified variable from the UEFI variable store. If the Data
+  buffer is too small to hold the contents of the variable,
+  the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the
+  required buffer size to obtain the data.
+
+  @param[in]This  A pointer to this instance of the 
EDKII_PEI_VARIABLE_PPI.
+  @param[in]VariableName  A pointer to a null-terminated string 
that is the variable's name.
+  @param[in]VariableGuid  A pointer to an EFI_GUID that is the 
variable's GUID. The combination of
+  VariableGuid and VariableName must be 
unique.
+  @param[out]   AttributesIf non-NULL, on return, points to the 
variable's attributes.
+  @param[in, out]   DataSize  On entry, points to the size in bytes of 
the Data buffer.
+  On return, points to the size of the 
data returned in Data.
+  @param[out]   Data  Points to the buffer which will hold the 
returned variable value.
+  May be NULL with a zero DataSize in 
order to determine the size of the
+  buffer needed.
+
+  @retval EFI_SUCCESS The variable was read successfully.
+  @retval EFI_NOT_FOUND   The variable was not found.
+  @retval EFI_BUFFER_TOO_SMALLThe DataSize is too small for the 
resulting data.
+  DataSize is updated with the size 
required for
+  the specified variable.
+  @retval EFI_INVALID_PARAMETER   VariableName, VariableGuid, DataSize or 
Data is NULL.
+  @retval EFI_DEVICE_ERRORThe variable could not be retrieved 
because of a device error.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_PEI_GET_VARIABLE)(
+  IN CONST  EDKII_PEI_VARIABLE_PPI*This,
+  IN CONST  CHAR16*VariableName,
+  IN CONST  EFI_GUID  *VariableGuid,
+  OUT   UINT32*Attributes   OPTIONAL,
+  IN OUTUINTN *DataSize,
+  OUT   VOID  *Data OPTIONAL
+  );
+
+/**
+  Return the next variable name and GUID.
+
+  This function is called multiple times to retrieve the VariableName
+  and VariableGuid of all variables currently available in the system.
+  On each call, the previous results are passed into the interface,
+  and, on return, the interface returns the data for the next
+  interface. To get started, VariableName should initially contain L"\0"
+  and VariableNameSize should be sizeof(CHAR16). When the entire
+  variable list has been returned, EFI_NOT_FOUND is returned.
+
+  @param[in]This  A pointer to this instance of the 
EDKII_PEI_VARIABLE_PPI.
+  @param[in, out]   VariableNameSize  On entry, points to the size of the 
buffer pointed to by VariableName.
+  On return, the size of the variable name 
buffer.
+  @param[in, out]   VariableName  On entry, a pointer to a null-terminated 
string that is the variable's name.
+  On return, points to the next variable's 
null-terminated name string.
+  @param[in, out]   VariableGuid  On entry, a pointer to an EFI_GUID that 
is the variable's GUID.
+  On return, a pointer to the next 
variable's GUID.
+
+  @retval EFI_SUCCESS The variable was read successfully.
+  @retval EFI_NOT_FOUND   The variable could not be found.
+  @retval EFI_BUFFER_TOO_SMALLThe VariableNameSize is

[edk2-devel] [PATCH V2 0/1] Add EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Nate DeSimone
Changes in V2:
  - Fixed instances where the new PPI was incorrectly reffered to as
"EDKII PEI Variable Protocol"
  - Added OPTIONAL to the Attributes argument of GetVariable()
  - Added description of initial calling conditions to GetNextVariableName()
  - Clarified the function and format of EFI_AUTHENTICATED_VARIABLE_HOB

This patch series proposes a new architectural PPI: EDKII_PEI_VARIABLE_PPI
This PPI provides services to read and write to UEFI variables during the PEI
environment. While an implementation of this PPI does not exist yet, Intel is
working on a new implementation of the PEI variable services that includes write
support.

As this is essentially a PEI version of the EFI_SMM_VARIABLE_PROTOCOL, I don't
expect it to be immensely controversial. Regardless, before this implementation
is done, we would like to provide the community with an opportunity to provide
input the on new architectural PPI.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Isaac Oram 
Cc: Chasel Chiu 
Cc: Gao Cheng 
Cc: Di Zhang 
Cc: Daocheng Bu 
Cc: Michael Kubacki 
Signed-off-by: Nate DeSimone 

Nathaniel L Desimone (1):
  MdeModulePkg: Add Definition of EDKII_PEI_VARIABLE_PPI

 MdeModulePkg/Include/Ppi/Variable.h | 195 
 MdeModulePkg/MdeModulePkg.dec   |   3 +
 2 files changed, 198 insertions(+)
 create mode 100644 MdeModulePkg/Include/Ppi/Variable.h

-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90449): https://edk2.groups.io/g/devel/message/90449
Mute This Topic: https://groups.io/mt/91678221/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: Add Definition of EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Nate DeSimone
Hi Michael,

Thanks for the great feedback! I believe I have addressed all of it in the V2 
patch. Please take a look when you get a chance.

Per your comment on the EFI_AUTHENTICATED_VARIABLE_HOB... this is one of those 
old data structures migrated from the edk1 that has the EFI_ prefix even though 
it was never added to the PI spec proper. The name wasn't changed for backwards 
compatibility reasons (there is a huge amount of code dependent on those old 
names.) There are a fair number of instances of this in the variable services, 
EFI_SMM_VARIABLE_PROTOCOL perhaps being the most visible.

Thanks,
Nate

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael Kubacki
Sent: Thursday, June 9, 2022 7:00 PM
To: devel@edk2.groups.io; Desimone, Nathaniel L 
Cc: Wang, Jian J ; Gao, Liming 
; Kinney, Michael D ; 
Oram, Isaac W ; Chiu, Chasel ; 
Cheng, Gao ; Zhang, Di ; Bu, Daocheng 
; Kubacki, Michael 
Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of 
EDKII_PEI_VARIABLE_PPI

Is this change just adding the interface to Tianocore or is there additional 
implementation planned as well?

---

I thought we were following this convention now:

"#ifndef __PEI_VARIABLE_PPI_H_" -> "#ifndef PEI_VARIABLE_PPI_H_"

Some other comments are inline.

Regards,
Michael

On 6/9/2022 9:17 PM, Nate DeSimone wrote:
> Adds definition of EDKII_PEI_VARIABLE_PPI, a pre-cursor to enabling 
> variable writes in the PEI environment.
> 
> Cc: Jian J Wang 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Isaac Oram 
> Cc: Chasel Chiu 
> Cc: Gao Cheng 
> Cc: Di Zhang 
> Cc: Daocheng Bu 
> Cc: Michael Kubacki 
> Signed-off-by: Nate DeSimone 
> ---
>   MdeModulePkg/Include/Ppi/Variable.h | 189 
>   MdeModulePkg/MdeModulePkg.dec   |   3 +
>   2 files changed, 192 insertions(+)
>   create mode 100644 MdeModulePkg/Include/Ppi/Variable.h
> 
> diff --git a/MdeModulePkg/Include/Ppi/Variable.h 
> b/MdeModulePkg/Include/Ppi/Variable.h
> new file mode 100644
> index 00..97dc7ceefa
> --- /dev/null
> +++ b/MdeModulePkg/Include/Ppi/Variable.h
> @@ -0,0 +1,189 @@
> +/** @file
> +  EDKII PEI Variable Protocol provides an implementation of variables

[MK] Was "EDKII PEI Variable PPI" intended?

> +  intended for use as a means to store data in the PEI environment.
> +
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __PEI_VARIABLE_PPI_H_
> +#define __PEI_VARIABLE_PPI_H_
> +
> +#define EDKII_PEI_VARIABLE_PPI_GUID \
> +  { \
> +0xe7b2cd04, 0x4b14, 0x44c2, { 0xb7, 0x48, 0xce, 0xaf, 0x2b, 0x66, 
> +0x4a, 0xb0 } \
> +  }
> +
> +typedef struct _EDKII_PEI_VARIABLE_PPI EDKII_PEI_VARIABLE_PPI;
> +
> +/**
> +  This service retrieves a variable's value using its name and GUID.
> +
> +  Read the specified variable from the UEFI variable store. If the 
> + Data  buffer is too small to hold the contents of the variable,  the 
> + error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the  
> + required buffer size to obtain the data.
> +
> +  @param[in]This  A pointer to this instance of the 
> EDKII_PEI_VARIABLE_PPI.
> +  @param[in]VariableName  A pointer to a null-terminated string 
> that is the variable's name.
> +  @param[in]VariableGuid  A pointer to an EFI_GUID that is the 
> variable's GUID. The combination of
> +  VariableGuid and VariableName must be 
> unique.
> +  @param[out]   AttributesIf non-NULL, on return, points to the 
> variable's attributes.
> +  @param[in, out]   DataSize  On entry, points to the size in bytes 
> of the Data buffer.
> +  On return, points to the size of the 
> data returned in Data.
> +  @param[out]   Data  Points to the buffer which will hold 
> the returned variable value.
> +  May be NULL with a zero DataSize in 
> order to determine the size of the
> +  buffer needed.
> +
> +  @retval EFI_SUCCESS The variable was read successfully.
> +  @retval EFI_NOT_FOUND   The variable was not found.
> +  @retval EFI_BUFFER_TOO_SMALLThe DataSize is too small for the 
> resulting data.
> +  DataSize is updated with the size 
> required for
> +  the specified variable.
> +  @retval EFI_INVALID_PARAMETER   VariableName, VariableGuid, DataSize 
> or Data is NULL.
> +  @retval EFI_DEVICE_ERRORThe variable could not be retrieved 
> because of a device error.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_PEI_GET_VARIABLE)(
> +  IN CONST  EDKII_PEI_VARIABLE_PPI*This,
> +  IN CONST  CHAR16*VariableName,
> +  IN CONST  EFI_GUID  *VariableGuid,
> +  OUT   UINT32  

[edk2-devel] [PATCH] BaseTools/tools_def.txt: Add -march=x86-64 for X64 CLANG and GCC targets

2022-06-10 Thread dann frazier
From: dann frazier 

Some Linux distributions are experimenting with builds that target a
higher x86-64 psABI, such as x86-64-v3. To avoid inheriting these
compiler defaults in edk2 builds, and therefore breaking compatibility
with machines using older CPUs, explicitly target the generic x86-64
psABI. This is similar to how we explicitly specify the cpu type for
some other architectures (-march=i586 for IA32, -march=armv7-a for ARM).

Spot tested with OVMF builds using GCC5 and CLANG38.

Signed-off-by: dann frazier 
---
 BaseTools/Conf/tools_def.template | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index adcd23f727..569d16fb3e 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1885,7 +1885,7 @@ DEFINE GCC_DEPS_FLAGS  = -MMD -MF $@.deps
 DEFINE GCC48_ALL_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
-ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
 DEFINE GCC48_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x20
 DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC48_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address
-DEFINE GCC48_X64_CC_FLAGS= DEF(GCC48_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_X64_CC_FLAGS= DEF(GCC48_ALL_CC_FLAGS) -m64 
-march=x86-64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
 DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC48_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 DEFINE GCC48_IA32_DLINK2_FLAGS   = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
@@ -2613,15 +2613,15 @@ NOOPT_CLANG38_IA32_DLINK2_FLAGS = 
DEF(GCC5_IA32_DLINK2_FLAGS) -O0
 *_CLANG38_X64_ASLPP_FLAGS  = DEF(GCC_ASLPP_FLAGS) 
DEF(CLANG38_X64_TARGET)
 *_CLANG38_X64_VFRPP_FLAGS  = DEF(GCC_VFRPP_FLAGS) 
DEF(CLANG38_X64_TARGET)
 
-DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 
"-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto 
DEF(CLANG38_X64_TARGET) -g
+DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 
-march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small 
-fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g
 DEBUG_CLANG38_X64_DLINK_FLAGS  = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto 
-Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
 DEBUG_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3
 
-RELEASE_CLANG38_X64_CC_FLAGS   = DEF(CLANG38_ALL_CC_FLAGS) -m64 
"-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto 
DEF(CLANG38_X64_TARGET)
+RELEASE_CLANG38_X64_CC_FLAGS   = DEF(CLANG38_ALL_CC_FLAGS) -m64 
-march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small 
-fpie -Oz -flto DEF(CLANG38_X64_TARGET)
 RELEASE_CLANG38_X64_DLINK_FLAGS= DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto 
-Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
 RELEASE_CLANG38_X64_DLINK2_FLAGS   = DEF(GCC5_X64_DLINK2_FLAGS) -O3
 
-NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 
"-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -O0 
DEF(CLANG38_X64_TARGET) -g
+NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 
-march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small 
-fpie -O0 DEF(CLANG38_X64_TARGET) -g
 NOOPT_CLANG38_X64_DLINK_FLAGS  = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 
-Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
 NOOPT_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O0
 
@@ -2798,17 +2798,17 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS =
 *_CLANGPDB_X64_ASLPP_FLAGS  = DEF(GCC_ASLPP_FLAGS) 
DEF(CLANGPDB_X64_TARGET)
 *_CLANGPDB_X64_VFRPP_FLAGS  = DEF(GCC_VFRPP_FLAGS) 
DEF(CLANGPDB_X64_TARGET)
 
-DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 
"-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz -flto 
DEF(CLANGPDB_X64_TARGET) -gcodeview  -funwind-tables
+DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 
-march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small 
-Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview  -funwind-tables
 DEBUG_CLANGPDB_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IG

Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of EDKII_PEI_VARIABLE_PPI

2022-06-10 Thread Yao, Jiewen
Hi

I am curious why we need this interface. Why we need write variable capability 
in PEI phase?

Where is the implementation of this? I prefer to see an implementation 
submitted together with header file.
For example, what is the impact to secure boot related feature, how to write 
auth variable in PEI, how PEI write variable cowork with SMM version in S3 
resume phase, how to support variable atomicity, etc.

Thank you
Yao Jiewen


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael
> Kubacki
> Sent: Friday, June 10, 2022 10:00 AM
> To: devel@edk2.groups.io; Desimone, Nathaniel L
> 
> Cc: Wang, Jian J ; Gao, Liming
> ; Kinney, Michael D
> ; Oram, Isaac W ;
> Chiu, Chasel ; Cheng, Gao ;
> Zhang, Di ; Bu, Daocheng ;
> Kubacki, Michael 
> Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg: Add Definition of
> EDKII_PEI_VARIABLE_PPI
> 
> Is this change just adding the interface to Tianocore or is there
> additional implementation planned as well?
> 
> ---
> 
> I thought we were following this convention now:
> 
> "#ifndef __PEI_VARIABLE_PPI_H_" -> "#ifndef PEI_VARIABLE_PPI_H_"
> 
> Some other comments are inline.
> 
> Regards,
> Michael
> 
> On 6/9/2022 9:17 PM, Nate DeSimone wrote:
> > Adds definition of EDKII_PEI_VARIABLE_PPI, a pre-cursor
> > to enabling variable writes in the PEI environment.
> >
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Cc: Michael D Kinney 
> > Cc: Isaac Oram 
> > Cc: Chasel Chiu 
> > Cc: Gao Cheng 
> > Cc: Di Zhang 
> > Cc: Daocheng Bu 
> > Cc: Michael Kubacki 
> > Signed-off-by: Nate DeSimone 
> > ---
> >   MdeModulePkg/Include/Ppi/Variable.h | 189
> 
> >   MdeModulePkg/MdeModulePkg.dec   |   3 +
> >   2 files changed, 192 insertions(+)
> >   create mode 100644 MdeModulePkg/Include/Ppi/Variable.h
> >
> > diff --git a/MdeModulePkg/Include/Ppi/Variable.h
> b/MdeModulePkg/Include/Ppi/Variable.h
> > new file mode 100644
> > index 00..97dc7ceefa
> > --- /dev/null
> > +++ b/MdeModulePkg/Include/Ppi/Variable.h
> > @@ -0,0 +1,189 @@
> > +/** @file
> > +  EDKII PEI Variable Protocol provides an implementation of variables
> 
> [MK] Was "EDKII PEI Variable PPI" intended?
> 
> > +  intended for use as a means to store data in the PEI environment.
> > +
> > +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef __PEI_VARIABLE_PPI_H_
> > +#define __PEI_VARIABLE_PPI_H_
> > +
> > +#define EDKII_PEI_VARIABLE_PPI_GUID \
> > +  { \
> > +0xe7b2cd04, 0x4b14, 0x44c2, { 0xb7, 0x48, 0xce, 0xaf, 0x2b, 0x66, 0x4a,
> 0xb0 } \
> > +  }
> > +
> > +typedef struct _EDKII_PEI_VARIABLE_PPI EDKII_PEI_VARIABLE_PPI;
> > +
> > +/**
> > +  This service retrieves a variable's value using its name and GUID.
> > +
> > +  Read the specified variable from the UEFI variable store. If the Data
> > +  buffer is too small to hold the contents of the variable,
> > +  the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the
> > +  required buffer size to obtain the data.
> > +
> > +  @param[in]This  A pointer to this instance of the
> EDKII_PEI_VARIABLE_PPI.
> > +  @param[in]VariableName  A pointer to a null-terminated 
> > string that
> is the variable's name.
> > +  @param[in]VariableGuid  A pointer to an EFI_GUID that is the
> variable's GUID. The combination of
> > +  VariableGuid and VariableName must 
> > be unique.
> > +  @param[out]   AttributesIf non-NULL, on return, points to the
> variable's attributes.
> > +  @param[in, out]   DataSize  On entry, points to the size in 
> > bytes of the
> Data buffer.
> > +  On return, points to the size of the 
> > data returned in Data.
> > +  @param[out]   Data  Points to the buffer which will hold 
> > the
> returned variable value.
> > +  May be NULL with a zero DataSize in 
> > order to determine
> the size of the
> > +  buffer needed.
> > +
> > +  @retval EFI_SUCCESS The variable was read successfully.
> > +  @retval EFI_NOT_FOUND   The variable was not found.
> > +  @retval EFI_BUFFER_TOO_SMALLThe DataSize is too small for the
> resulting data.
> > +  DataSize is updated with the size 
> > required for
> > +  the specified variable.
> > +  @retval EFI_INVALID_PARAMETER   VariableName, VariableGuid,
> DataSize or Data is NULL.
> > +  @retval EFI_DEVICE_ERRORThe variable could not be retrieved
> because of a device error.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EDKII_PEI_GET_VARIABLE)(
> > +  IN CONST  EDKII_PEI_VARIABLE_PPI*This,
> > +  IN CONST  CHAR16*VariableName,
> > +  IN CONST  EFI_GUID  *Var

Re: [edk2-devel] [PATCH V4 5/9] OvmfPkg/IntelTdx: Measure Td HobList and Configuration FV

2022-06-10 Thread Gerd Hoffmann
On Mon, May 16, 2022 at 03:42:19PM +0800, Min Xu wrote:
> RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3853
> 
> TdHobList and Configuration FV are external data provided by Host VMM.
> These are not trusted in Td guest. So they should be validated , measured
> and extended to Td RTMR registers. In the meantime 2 EFI_CC_EVENT_HOB are
> created. These 2 GUIDed HOBs carry the hash value of TdHobList and
> Configuration FV. In DXE phase EFI_CC_EVENT can be created based on these
> 2 GUIDed HOBs.

This breaks booting the IntelTdx build without tdx:

ASSERT 
/home/kraxel/projects/edk2/SecurityPkg/Library/HashLibTdx/HashLibTdx.c(189): 
TdIsEnabled ()

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v6 1/3] Revert "OvmfPkg/Sec: fix stack switch"

2022-06-10 Thread Yao, Jiewen
OK. I will revert this at first.

Let's figure out a right solution.

Acked-by: Jiewen Yao 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Gerd
> Hoffmann
> Sent: Friday, June 10, 2022 7:03 PM
> To: devel@edk2.groups.io
> Cc: Oliver Steffen ; James Bottomley
> ; Tom Lendacky ; Gerd
> Hoffmann ; Justen, Jordan L ;
> Chen, Christine ; Brijesh Singh
> ; Aktas, Erdem ; Yao,
> Jiewen ; Gao, Liming ;
> Ard Biesheuvel ; Pawel Polawski
> ; Feng, Bob C ; Xu, Min M
> 
> Subject: [edk2-devel] [PATCH v6 1/3] Revert "OvmfPkg/Sec: fix stack switch"
> 
> This reverts commit ff36b2550f94dc5fac838cf298ae5a23cfddf204.
> 
> Has no effect because GCC_IA32_CC_FLAGS and GCC_X64_CC_FLAGS are
> unused.
> 
> Signed-off-by: Gerd Hoffmann 
> ---
>  OvmfPkg/Sec/SecMain.c | 4 
>  BaseTools/Conf/tools_def.template | 6 +++---
>  2 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
> index 3ca0dcdfd3dd..1167d22a68cc 100644
> --- a/OvmfPkg/Sec/SecMain.c
> +++ b/OvmfPkg/Sec/SecMain.c
> @@ -1052,15 +1052,11 @@ TemporaryRamMigration (
>if (SetJump (&JumpBuffer) == 0) {
>   #if defined (MDE_CPU_IA32)
>  JumpBuffer.Esp = JumpBuffer.Esp + DebugAgentContext.StackMigrateOffset;
> - #ifndef OMIT_FRAME_POINTER
>  JumpBuffer.Ebp = JumpBuffer.Ebp + DebugAgentContext.StackMigrateOffset;
>   #endif
> - #endif
>   #if defined (MDE_CPU_X64)
>  JumpBuffer.Rsp = JumpBuffer.Rsp + DebugAgentContext.StackMigrateOffset;
> - #ifndef OMIT_FRAME_POINTER
>  JumpBuffer.Rbp = JumpBuffer.Rbp + DebugAgentContext.StackMigrateOffset;
> - #endif
>   #endif
>  LongJump (&JumpBuffer, (UINTN)-1);
>}
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index adcd23f7273f..5ed19810b727 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -1849,9 +1849,9 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-
> gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
>  *_*_*_DTC_PATH = DEF(DTC_BIN)
> 
>  DEFINE GCC_ALL_CC_FLAGS= -g -Os -fshort-wchar -fno-builtin -fno-
> strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-
> common
> -DEFINE GCC_IA32_CC_FLAGS   = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-
> double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-
> probe -fno-omit-frame-pointer
> -DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -
> Wno-address -mno-stack-arg-probe -fomit-frame-pointer -
> DOMIT_FRAME_POINTER=1
> -DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian
> -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-
> sections -fomit-frame-pointer -DOMIT_FRAME_POINTER=1 -Wno-address -
> mthumb -mfloat-abi=soft -fno-pic -fno-pie
> +DEFINE GCC_IA32_CC_FLAGS   = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-
> double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-
> probe
> +DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone
> -Wno-address -mno-stack-arg-probe
> +DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian
> -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-
> sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic
> -fno-pie
>  DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
>  DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-
> endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -
> fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-
> tables -fno-pic -fno-pie -ffixed-x18
>  DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align -mgeneral-regs-only
> --
> 2.36.1
> 
> 
> 
> 
> 



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




[edk2-devel] [PATCH v6 3/3] tools_def: add -fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS

2022-06-10 Thread Gerd Hoffmann
Fixes problems due to code assuming it runs with frame pointers and thus
updates rbp / ebp registers when switching stacks.

Signed-off-by: Gerd Hoffmann 
---
 BaseTools/Conf/tools_def.template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index a53199c9c76b..756f112b9395 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1882,8 +1882,8 @@ DEFINE GCC_DEPS_FLAGS  = -MMD -MF $@.deps
 
 DEFINE GCC48_ALL_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
-ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
 DEFINE GCC48_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x20
-DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC48_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address
-DEFINE GCC48_X64_CC_FLAGS= DEF(GCC48_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC48_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address -fno-omit-frame-pointer
+DEFINE GCC48_X64_CC_FLAGS= DEF(GCC48_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address  -fno-omit-frame-pointer
 DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC48_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 DEFINE GCC48_IA32_DLINK2_FLAGS   = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
-- 
2.36.1



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




[edk2-devel] [PATCH v6 2/3] tools_def: remove GCC_IA32_CC_FLAGS/GCC_X64_CC_FLAGS

2022-06-10 Thread Gerd Hoffmann
They are not used anywhere.  Remove them.

Signed-off-by: Gerd Hoffmann 
---
 BaseTools/Conf/tools_def.template | 2 --
 1 file changed, 2 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 5ed19810b727..a53199c9c76b 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1849,8 +1849,6 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = 
--add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
 *_*_*_DTC_PATH = DEF(DTC_BIN)
 
 DEFINE GCC_ALL_CC_FLAGS= -g -Os -fshort-wchar -fno-builtin 
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h 
-fno-common
-DEFINE GCC_IA32_CC_FLAGS   = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double 
-freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
-DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone 
-Wno-address -mno-stack-arg-probe
 DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections 
-fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft 
-fno-pic -fno-pie
 DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
 DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections 
-fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables 
-fno-pic -fno-pie -ffixed-x18
-- 
2.36.1



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




[edk2-devel] [PATCH v6 0/3] Fix stack switching, this time for real.

2022-06-10 Thread Gerd Hoffmann
My testing was busted, ran the tests with outdated tools_def
so I didn't notice the patch had zero effect ...

So, revert the broken patch, drop two lines which are not used
anywhere to reduce confusion, then just disable omit-frame-pointers
for ia32 and x64 to get the source tree back into working state
with minimum fuss.

Not fully sure yet how to go forward with that longer-term.  Enabling
omit-frame-pointers unconditionally makes the NOOPT noticeable larger,
which is probably the reason why the gcc enables that by default only
for -O1 and higher.  So maybe we need different cflags for NOOPT vs.
DEBUG/RELEASE builds.

Or go for a completely different approach, like integrating
DebugAgentLib support into the Pei Dispatcher, so the need to
have a custom TemporaryRamMigration() for that goes away ...

Comments?

take care,
  Gerd

Gerd Hoffmann (3):
  Revert "OvmfPkg/Sec: fix stack switch"
  tools_def: remove GCC_IA32_CC_FLAGS/GCC_X64_CC_FLAGS
  tools_def: add -fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS

 OvmfPkg/Sec/SecMain.c | 4 
 BaseTools/Conf/tools_def.template | 8 +++-
 2 files changed, 3 insertions(+), 9 deletions(-)

-- 
2.36.1



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




[edk2-devel] [PATCH v6 1/3] Revert "OvmfPkg/Sec: fix stack switch"

2022-06-10 Thread Gerd Hoffmann
This reverts commit ff36b2550f94dc5fac838cf298ae5a23cfddf204.

Has no effect because GCC_IA32_CC_FLAGS and GCC_X64_CC_FLAGS are unused.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/Sec/SecMain.c | 4 
 BaseTools/Conf/tools_def.template | 6 +++---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index 3ca0dcdfd3dd..1167d22a68cc 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -1052,15 +1052,11 @@ TemporaryRamMigration (
   if (SetJump (&JumpBuffer) == 0) {
  #if defined (MDE_CPU_IA32)
 JumpBuffer.Esp = JumpBuffer.Esp + DebugAgentContext.StackMigrateOffset;
- #ifndef OMIT_FRAME_POINTER
 JumpBuffer.Ebp = JumpBuffer.Ebp + DebugAgentContext.StackMigrateOffset;
  #endif
- #endif
  #if defined (MDE_CPU_X64)
 JumpBuffer.Rsp = JumpBuffer.Rsp + DebugAgentContext.StackMigrateOffset;
- #ifndef OMIT_FRAME_POINTER
 JumpBuffer.Rbp = JumpBuffer.Rbp + DebugAgentContext.StackMigrateOffset;
- #endif
  #endif
 LongJump (&JumpBuffer, (UINTN)-1);
   }
diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index adcd23f7273f..5ed19810b727 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1849,9 +1849,9 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = 
--add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
 *_*_*_DTC_PATH = DEF(DTC_BIN)
 
 DEFINE GCC_ALL_CC_FLAGS= -g -Os -fshort-wchar -fno-builtin 
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h 
-fno-common
-DEFINE GCC_IA32_CC_FLAGS   = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double 
-freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe 
-fno-omit-frame-pointer
-DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone 
-Wno-address -mno-stack-arg-probe -fomit-frame-pointer -DOMIT_FRAME_POINTER=1
-DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections 
-fdata-sections -fomit-frame-pointer -DOMIT_FRAME_POINTER=1 -Wno-address 
-mthumb -mfloat-abi=soft -fno-pic -fno-pie
+DEFINE GCC_IA32_CC_FLAGS   = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double 
-freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
+DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone 
-Wno-address -mno-stack-arg-probe
+DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections 
-fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft 
-fno-pic -fno-pie
 DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
 DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections 
-fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables 
-fno-pic -fno-pie -ffixed-x18
 DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align -mgeneral-regs-only
-- 
2.36.1



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




Re: [edk2-devel] [edk2-platforms PATCH 1/1] Marvell: Add VariableFlashInfoLib

2022-06-10 Thread Ard Biesheuvel
On Fri, 10 Jun 2022 at 10:13, Sunny Wang  wrote:
>
> Reviewed-by: Sunny Wang 
>
> -Original Message-
> From: Marcin Wojtas 
> Sent: 10 June 2022 00:51
> To: devel@edk2.groups.io
> Cc: quic_llind...@quicinc.com; ardb+tianoc...@kernel.org; m...@semihalf.com; 
> j...@semihalf.com; g...@semihalf.com; upstr...@semihalf.com; Sunny Wang 
> ; michael.kuba...@microsoft.com
> Subject: [edk2-platforms PATCH 1/1] Marvell: Add VariableFlashInfoLib
>
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479
>
> This patch adds an instance for the library class VariableFlashInfoLib
> that was recently introduced in MdeModulePkg. This change is made to
> allow the new variable driver to build that has a dependency on
> this library class and does not require any further platform changes.
>
> Signed-off-by: Marcin Wojtas 

Pushed as 86119cb4962f..242e681ed8ed

Thanks all,


> ---
>  Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
> b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> index 9322ad881e..b64c0ffdee 100644
> --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> @@ -69,6 +69,7 @@
>
> UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
>
>UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
>
>UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
>
> +  
> VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
>
>
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
>
>
>
>PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
>
> --
> 2.29.0
>
> IMPORTANT NOTICE: The contents of this email and any attachments are 
> confidential and may also be privileged. If you are not the intended 
> recipient, please notify the sender immediately and do not disclose the 
> contents to any other person, use it for any purpose, or store or copy the 
> information in any medium. Thank you.
>
>
> 
>
>


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




[edk2-devel] [PATCH] DxeMain: Fix the bug that StackGuard is not enabled

2022-06-10 Thread Ni, Ray
Commit e7abb94d1 removed InitializeCpuExceptionHandlersEx
and updated DxeMain to call InitializeCpuExceptionHandlers
for exception setup. But the old behavior that calls *Ex() sets
up the stack guard as well. To match the old behavior,
the patch calls InitializeSeparateExceptionStacks.

Signed-off-by: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 83f49d7c00..0a1f3d79e2 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -256,6 +256,14 @@ DxeMain (
   Status = InitializeCpuExceptionHandlers (VectorInfoList);
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Setup Stack Guard
+  //
+  if (PcdGetBool (PcdCpuStackGuard)) {
+Status = InitializeSeparateExceptionStacks (NULL);
+ASSERT_EFI_ERROR (Status);
+  }
+
   //
   // Initialize Debug Agent to support source level debug in DXE phase
   //
-- 
2.35.1.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90438): https://edk2.groups.io/g/devel/message/90438
Mute This Topic: https://groups.io/mt/91664463/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/5] MpInitLib code refactoring

2022-06-10 Thread Dong, Eric
Reviewed-by: Eric Dong   for this serial.

Thanks,
Eric

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Ni, Ray
Sent: Monday, May 16, 2022 3:14 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH v3 0/5] MpInitLib code refactoring

v2:
  Updated 3/5: "Put SEV logic in separate file" patch.
  Added 5/5: "Move the Above1Mb vector allocation to MpInitLibInitialize" patch.

v3:
  v2 was sent to wrong mailing list "edk2-de...@lists.01.org".
  v3 is created to send to correct mailing list.
  All code changes are in https://github.com/niruiyu/edk2/tree/refactormp3.

Ray Ni (5):
  MpInitLib: Allocate code buffer for PEI phase
  MpInitLib: remove unneeded global ASM_PFX
  MpInitLib: Put SEV logic in separate file
  MpInitLib: Only allocate below 1MB memory for 16bit code
  MpInitLib: Move the Above1Mb vector allocation to MpInitLibInitialize

 UefiCpuPkg/Library/MpInitLib/AmdSev.c |   6 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c   |   2 +-
 .../Library/MpInitLib/Ia32/MpFuncs.nasm   |  13 +-
 UefiCpuPkg/Library/MpInitLib/MpEqu.inc|   6 +-
 UefiCpuPkg/Library/MpInitLib/MpLib.c  | 124 ++---
 UefiCpuPkg/Library/MpInitLib/MpLib.h  |   6 +-
 UefiCpuPkg/Library/MpInitLib/PeiMpLib.c   |  15 +-
 UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm  | 148 +++  
UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 169 +-
 9 files changed, 233 insertions(+), 256 deletions(-)

--
2.35.1.windows.2








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




Re: [edk2-devel] [edk2-platforms PATCH 1/1] Marvell: Add VariableFlashInfoLib

2022-06-10 Thread Sunny Wang
Reviewed-by: Sunny Wang 

-Original Message-
From: Marcin Wojtas 
Sent: 10 June 2022 00:51
To: devel@edk2.groups.io
Cc: quic_llind...@quicinc.com; ardb+tianoc...@kernel.org; m...@semihalf.com; 
j...@semihalf.com; g...@semihalf.com; upstr...@semihalf.com; Sunny Wang 
; michael.kuba...@microsoft.com
Subject: [edk2-platforms PATCH 1/1] Marvell: Add VariableFlashInfoLib

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

This patch adds an instance for the library class VariableFlashInfoLib
that was recently introduced in MdeModulePkg. This change is made to
allow the new variable driver to build that has a dependency on
this library class and does not require any further platform changes.

Signed-off-by: Marcin Wojtas 
---
 Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
index 9322ad881e..b64c0ffdee 100644
--- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
+++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
@@ -69,6 +69,7 @@
   
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf

   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf

   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf

+  
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf

   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf



   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf

--
2.29.0

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


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