summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/ResetVector
diff options
context:
space:
mode:
authorBrijesh Singh via groups.io <brijesh.singh=amd.com@groups.io>2021-12-09 11:27:32 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-09 06:28:10 +0000
commit3053183d417ae9e72fa05fd858ad6da15cbef7f9 (patch)
treedaa4aa2fb20e0b7ce800e1ab15f070c3eed030f8 /OvmfPkg/ResetVector
parent2fe8edfe55ea28d9972ce3ba049783f0616007fa (diff)
downloadedk2-3053183d417ae9e72fa05fd858ad6da15cbef7f9.tar.gz
edk2-3053183d417ae9e72fa05fd858ad6da15cbef7f9.tar.bz2
edk2-3053183d417ae9e72fa05fd858ad6da15cbef7f9.zip
OvmfPkg/ResetVector: introduce SEV metadata descriptor for VMM use
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3275 The OvmfPkgX86 build reserves memory regions in MEMFD. The memory regions get accessed in the SEC phase. AMD SEV-SNP require that the guest's private memory be accepted or validated before access. Introduce a Guided metadata structure that describes the reserved memory regions. The VMM can locate the metadata structure by iterating through the reset vector guid and process the areas based on the platform specific requirements. Cc: Michael Roth <michael.roth@amd.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Diffstat (limited to 'OvmfPkg/ResetVector')
-rw-r--r--OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm14
-rw-r--r--OvmfPkg/ResetVector/ResetVector.nasmb1
-rw-r--r--OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm34
3 files changed, 49 insertions, 0 deletions
diff --git a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
index dee2e3f9de..12f2cedd67 100644
--- a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
+++ b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
@@ -64,6 +64,20 @@ tdxMetadataOffsetStart:
DB 0x86, 0x5e, 0x46, 0x85, 0xa7, 0xbf, 0x8e, 0xc2
tdxMetadataOffsetEnd:
+;
+; SEV metadata descriptor
+;
+; Provide the start offset of the metadata blob within the OVMF binary.
+
+; GUID : dc886566-984a-4798-A75e-5585a7bf67cc
+;
+OvmfSevMetadataOffsetStart:
+ DD (fourGigabytes - OvmfSevMetadataGuid)
+ DW OvmfSevMetadataOffsetEnd - OvmfSevMetadataOffsetStart
+ DB 0x66, 0x65, 0x88, 0xdc, 0x4a, 0x98, 0x98, 0x47
+ DB 0xA7, 0x5e, 0x55, 0x85, 0xa7, 0xbf, 0x67, 0xcc
+OvmfSevMetadataOffsetEnd:
+
%endif
; SEV Hash Table Block
diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
index 87effedb9c..d847794fea 100644
--- a/OvmfPkg/ResetVector/ResetVector.nasmb
+++ b/OvmfPkg/ResetVector/ResetVector.nasmb
@@ -109,6 +109,7 @@
%include "Ia32/AmdSev.asm"
%include "Ia32/PageTables64.asm"
%include "Ia32/IntelTdx.asm"
+%include "X64/OvmfSevMetadata.asm"
%endif
%include "Ia16/Real16ToFlat32.asm"
diff --git a/OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm b/OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm
new file mode 100644
index 0000000000..9d8c3e8194
--- /dev/null
+++ b/OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm
@@ -0,0 +1,34 @@
+;-----------------------------------------------------------------------------
+; @file
+; OVMF metadata for the AMD SEV confidential computing guests
+;
+; Copyright (c) 2021, AMD Inc. All rights reserved.<BR>
+;
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;-----------------------------------------------------------------------------
+
+BITS 64
+
+%define OVMF_SEV_METADATA_VERSION 1
+
+; The section must be accepted or validated by the VMM before the boot
+%define OVMF_SECTION_TYPE_SNP_SEC_MEM 0x1
+
+ALIGN 16
+
+TIMES (15 - ((OvmfSevGuidedStructureEnd - OvmfSevGuidedStructureStart + 15) % 16)) DB 0
+
+OvmfSevGuidedStructureStart:
+;
+; OvmfSev metadata descriptor
+;
+OvmfSevMetadataGuid:
+
+_DescriptorSev:
+ DB 'A','S','E','V' ; Signature
+ DD OvmfSevGuidedStructureEnd - _DescriptorSev ; Length
+ DD OVMF_SEV_METADATA_VERSION ; Version
+ DD (OvmfSevGuidedStructureEnd - _DescriptorSev - 16) / 12 ; Number of sections
+
+OvmfSevGuidedStructureEnd:
+ ALIGN 16