public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Roth, Michael" <Michael.Roth@amd.com>
To: <devel@edk2.groups.io>
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
	Jiewen Yao <jiewen.yao@intel.com>, <ray.ni@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Erdem Aktas <erdemaktas@google.com>,
	James Bottomley <jejb@linux.ibm.com>, Min Xu <min.m.xu@intel.com>
Subject: [PATCH RESEND 2/4] OvmfPkg/AmdSevDxe: Update ConfidentialComputing blob struct definition
Date: Wed, 15 Mar 2023 16:57:45 -0500	[thread overview]
Message-ID: <20230315215747.1543837-3-michael.roth@amd.com> (raw)
In-Reply-To: <20230315215747.1543837-1-michael.roth@amd.com>

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


  parent reply	other threads:[~2023-03-15 21:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 21:57 [PATCH RESEND 0/4] Fixes for SEV-SNP CC blob and CPUID table handling Roth, Michael
2023-03-15 21:57 ` [PATCH RESEND 1/4] OvmfPkg/AmdSevDxe: Allocate SEV-SNP CC blob as EfiACPIReclaimMemory Roth, Michael
2023-03-20  9:43   ` Gerd Hoffmann
2023-03-15 21:57 ` Roth, Michael [this message]
2023-03-20  9:44   ` [edk2-devel] [PATCH RESEND 2/4] OvmfPkg/AmdSevDxe: Update ConfidentialComputing blob struct definition Gerd Hoffmann
2023-03-15 21:57 ` [PATCH RESEND 3/4] OvmfPkg/CcExitLib: Fix SEV-SNP XSave area size calculation Roth, Michael
2023-03-20  9:46   ` Gerd Hoffmann
2023-03-15 21:57 ` [PATCH RESEND 4/4] OvmfPkg/CcExitLib: Use documented XSave area base size for SEV-SNP Roth, Michael
2023-03-20  9:49   ` Gerd Hoffmann
2023-04-06 23:12 ` [PATCH RESEND 0/4] Fixes for SEV-SNP CC blob and CPUID table handling Roth, Michael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230315215747.1543837-3-michael.roth@amd.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox