[edk2-devel] [PATCH v2] OvmfPkg: set a default value for the WorkAreaHeader PCD

Corvin Köhne posted 1 patch 2 years, 8 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
OvmfPkg/Include/WorkArea.h     | 4 ++++
OvmfPkg/OvmfPkg.dec            | 7 ++++++-
OvmfPkg/OvmfPkgDefines.fdf.inc | 6 ------
3 files changed, 10 insertions(+), 7 deletions(-)
[edk2-devel] [PATCH v2] OvmfPkg: set a default value for the WorkAreaHeader PCD
Posted by Corvin Köhne 2 years, 8 months ago
SEC checks in IsSevGuest if the PCD defined WorkAreaHeader size matches the size of the WorkAreaHeader struct definition. Set a default value for the PCD to avoid unnecessary DSC/FDF file changes in all OVMF DSC/FDF files.

Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com>
---
 OvmfPkg/Include/WorkArea.h     | 4 ++++
 OvmfPkg/OvmfPkg.dec            | 7 ++++++-
 OvmfPkg/OvmfPkgDefines.fdf.inc | 6 ------
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/Include/WorkArea.h b/OvmfPkg/Include/WorkArea.h
index c16030e3ac..0f9b442e43 100644
--- a/OvmfPkg/Include/WorkArea.h
+++ b/OvmfPkg/Include/WorkArea.h
@@ -25,6 +25,10 @@ typedef enum {
 // to the structure need to be kept in sync with the
 // PcdOvmfConfidentialComputingWorkAreaHeader.
 //
+// PcdOvmfConfidentialComputingWorkAreaHeader ==
+//   sizeof (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER)
+//
+// PcdOvmfConfidentialComputingWorkAreaHeader defined in OvmfPkg/OvmfPkg.dec
 typedef struct _CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER {
   UINT8                   GuestType;
   UINT8                   Reserved1[3];
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 75d47e0e00..3ed3811320 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -339,7 +339,12 @@
   # The size of this header is used early boot, and is provided through
   # a fixed PCD. It need to be kept in sync with any changes to the
   # header definition.
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader|0|UINT32|0x51
+  #
+  # PcdOvmfConfidentialComputingWorkAreaHeader ==
+  #   sizeof (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER)
+  #
+  # CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER defined in OvmfPkg/Include/WorkArea.h
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader|4|UINT32|0x51


 [PcdsDynamic, PcdsDynamicEx]
diff --git a/OvmfPkg/OvmfPkgDefines.fdf.inc b/OvmfPkg/OvmfPkgDefines.fdf.inc
index 3b5e452539..35fd454b97 100644
--- a/OvmfPkg/OvmfPkgDefines.fdf.inc
+++ b/OvmfPkg/OvmfPkgDefines.fdf.inc
@@ -82,12 +82,6 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = $(BLOCK_SIZ
 SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
 SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = $(VARS_SPARE_SIZE)

-# The OVMF WorkArea contains a fixed size header followed by the actual data.
-# The size of header is accessed through a fixed PCD in the reset vector code.
-# The value need to be kept in sync with the any changes to the Confidential
-# Computing Work Area header defined in the Include/WorkArea.h
-SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader  = 4
-
 !if $(SMM_REQUIRE) == TRUE
 SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase
 SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase
--
2.11.0

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff Registered office: Verl, Germany | Register court: Guetersloh HRA 7075




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#80753): https://edk2.groups.io/g/devel/message/80753
Mute This Topic: https://groups.io/mt/85646096/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v2] OvmfPkg: set a default value for the WorkAreaHeader PCD
Posted by Yao, Jiewen 2 years, 8 months ago
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Corvin
> Köhne
> Sent: Thursday, September 16, 2021 2:22 PM
> To: devel@edk2.groups.io
> Cc: ardb+tianocore@kernel.org; Yao, Jiewen <jiewen.yao@intel.com>; Justen,
> Jordan L <jordan.l.justen@intel.com>; kraxel@redhat.com; rebecca@bsdio.com;
> grehan@freebsd.org; Köhne, Corvin <c.koehne@beckhoff.com>
> Subject: [edk2-devel] [PATCH v2] OvmfPkg: set a default value for the
> WorkAreaHeader PCD
> 
> SEC checks in IsSevGuest if the PCD defined WorkAreaHeader size matches the
> size of the WorkAreaHeader struct definition. Set a default value for the PCD to
> avoid unnecessary DSC/FDF file changes in all OVMF DSC/FDF files.
> 
> Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com>
> ---
>  OvmfPkg/Include/WorkArea.h     | 4 ++++
>  OvmfPkg/OvmfPkg.dec            | 7 ++++++-
>  OvmfPkg/OvmfPkgDefines.fdf.inc | 6 ------
>  3 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/OvmfPkg/Include/WorkArea.h b/OvmfPkg/Include/WorkArea.h
> index c16030e3ac..0f9b442e43 100644
> --- a/OvmfPkg/Include/WorkArea.h
> +++ b/OvmfPkg/Include/WorkArea.h
> @@ -25,6 +25,10 @@ typedef enum {
>  // to the structure need to be kept in sync with the
>  // PcdOvmfConfidentialComputingWorkAreaHeader.
>  //
> +// PcdOvmfConfidentialComputingWorkAreaHeader ==
> +//   sizeof (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER)
> +//
> +// PcdOvmfConfidentialComputingWorkAreaHeader defined in
> OvmfPkg/OvmfPkg.dec
>  typedef struct _CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER {
>    UINT8                   GuestType;
>    UINT8                   Reserved1[3];
> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
> index 75d47e0e00..3ed3811320 100644
> --- a/OvmfPkg/OvmfPkg.dec
> +++ b/OvmfPkg/OvmfPkg.dec
> @@ -339,7 +339,12 @@
>    # The size of this header is used early boot, and is provided through
>    # a fixed PCD. It need to be kept in sync with any changes to the
>    # header definition.
> -
> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeade
> r|0|UINT32|0x51
> +  #
> +  # PcdOvmfConfidentialComputingWorkAreaHeader ==
> +  #   sizeof (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER)
> +  #
> +  # CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER defined in
> OvmfPkg/Include/WorkArea.h
> +
> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeade
> r|4|UINT32|0x51
> 
> 
>  [PcdsDynamic, PcdsDynamicEx]
> diff --git a/OvmfPkg/OvmfPkgDefines.fdf.inc
> b/OvmfPkg/OvmfPkgDefines.fdf.inc
> index 3b5e452539..35fd454b97 100644
> --- a/OvmfPkg/OvmfPkgDefines.fdf.inc
> +++ b/OvmfPkg/OvmfPkgDefines.fdf.inc
> @@ -82,12 +82,6 @@ SET
> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize =
> $(BLOCK_SIZ
>  SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase =
> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase +
> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
>  SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize =
> $(VARS_SPARE_SIZE)
> 
> -# The OVMF WorkArea contains a fixed size header followed by the actual data.
> -# The size of header is accessed through a fixed PCD in the reset vector code.
> -# The value need to be kept in sync with the any changes to the Confidential
> -# Computing Work Area header defined in the Include/WorkArea.h
> -SET
> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeade
> r  = 4
> -
>  !if $(SMM_REQUIRE) == TRUE
>  SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 =
> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase
>  SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase =
> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase
> --
> 2.11.0
> 
> Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans
> Beckhoff Registered office: Verl, Germany | Register court: Guetersloh HRA
> 7075
> 
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#80762): https://edk2.groups.io/g/devel/message/80762
Mute This Topic: https://groups.io/mt/85646096/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-