[edk2-devel] [PATCH RESEND 2/4] OvmfPkg/AmdSevDxe: Update ConfidentialComputing blob struct definition

Roth, Michael via groups.io posted 4 patches 1 year, 5 months ago
There is a newer version of this series
[edk2-devel] [PATCH RESEND 2/4] OvmfPkg/AmdSevDxe: Update ConfidentialComputing blob struct definition
Posted by Roth, Michael via groups.io 1 year, 5 months ago
The Confidential Computing blob defined here is intended to match the
definition defined by linux guest kernel. Previously, both definitions
relied on natural alignment, but that relies on both OVMF and kernel
being compiled as 64-bit. While there aren't currently any plans to
enable SNP support for 32-bit compilations, the kernel definition has
since been updated to use explicit padding/reserved fields to avoid
this dependency. Update OVMF to match that definition.

While at it, also fix up the Reserved fields to match the numbering
used in the kernel.

No functional changes (for currently-supported environments, at least).

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 OvmfPkg/AmdSevDxe/AmdSevDxe.c                          | 4 +++-
 OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
index 7250cc90e5..cf074f2c89 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
@@ -48,11 +48,13 @@ AllocateConfidentialComputingBlob (
 

   CcBlob->Header                 = SIGNATURE_32 ('A', 'M', 'D', 'E');

   CcBlob->Version                = 1;

-  CcBlob->Reserved1              = 0;

+  CcBlob->Reserved               = 0;

   CcBlob->SecretsPhysicalAddress = (UINT64)(UINTN)FixedPcdGet32 (PcdOvmfSnpSecretsBase);

   CcBlob->SecretsSize            = FixedPcdGet32 (PcdOvmfSnpSecretsSize);

+  CcBlob->Reserved1              = 0;

   CcBlob->CpuidPhysicalAddress   = (UINT64)(UINTN)FixedPcdGet32 (PcdOvmfCpuidBase);

   CcBlob->CpuidLSize             = FixedPcdGet32 (PcdOvmfCpuidSize);

+  CcBlob->Reserved2              = 0;

 

   *CcBlobPtr = CcBlob;

 

diff --git a/OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h b/OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h
index b328310fd0..83620e31b8 100644
--- a/OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h
+++ b/OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h
@@ -18,14 +18,16 @@
     { 0x85, 0x54, 0x93, 0xd7, 0x77, 0x91, 0x2d, 0x42 }, \

   }

 

-typedef struct {

+typedef PACKED struct {

   UINT32    Header;

   UINT16    Version;

-  UINT16    Reserved1;

+  UINT16    Reserved;

   UINT64    SecretsPhysicalAddress;

   UINT32    SecretsSize;

+  UINT32    Reserved1;

   UINT64    CpuidPhysicalAddress;

   UINT32    CpuidLSize;

+  UINT32    Reserved2;

 } CONFIDENTIAL_COMPUTING_SNP_BLOB_LOCATION;

 

 extern EFI_GUID  gConfidentialComputingSevSnpBlobGuid;

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101246): https://edk2.groups.io/g/devel/message/101246
Mute This Topic: https://groups.io/mt/97638497/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH RESEND 2/4] OvmfPkg/AmdSevDxe: Update ConfidentialComputing blob struct definition
Posted by Gerd Hoffmann 1 year, 5 months ago
On Wed, Mar 15, 2023 at 04:57:45PM -0500, Roth, Michael via groups.io wrote:
> The Confidential Computing blob defined here is intended to match the
> definition defined by linux guest kernel. Previously, both definitions
> relied on natural alignment, but that relies on both OVMF and kernel
> being compiled as 64-bit. While there aren't currently any plans to
> enable SNP support for 32-bit compilations, the kernel definition has
> since been updated to use explicit padding/reserved fields to avoid
> this dependency. Update OVMF to match that definition.
> 
> While at it, also fix up the Reserved fields to match the numbering
> used in the kernel.
> 
> No functional changes (for currently-supported environments, at least).
> 
> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Michael Roth <michael.roth@amd.com>

Acked-by: Gerd Hoffmann <kraxel@redhat.com>



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