]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/ResetVector: introduce SEV metadata descriptor for VMM use
authorBrijesh Singh via groups.io <brijesh.singh=amd.com@groups.io>
Thu, 9 Dec 2021 03:27:32 +0000 (11:27 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 9 Dec 2021 06:28:10 +0000 (06:28 +0000)
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>
OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
OvmfPkg/ResetVector/ResetVector.nasmb
OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm [new file with mode: 0644]

index dee2e3f9de315da48fb597d985caf81440a9adaa..12f2cedd6767b913062c19f32c677cc422dac4ae 100644 (file)
@@ -64,6 +64,20 @@ tdxMetadataOffsetStart:
     DB      0x86, 0x5e, 0x46, 0x85, 0xa7, 0xbf, 0x8e, 0xc2\r
 tdxMetadataOffsetEnd:\r
 \r
+;\r
+; SEV metadata descriptor\r
+;\r
+; Provide the start offset of the metadata blob within the OVMF binary.\r
+\r
+; GUID : dc886566-984a-4798-A75e-5585a7bf67cc\r
+;\r
+OvmfSevMetadataOffsetStart:\r
+  DD      (fourGigabytes - OvmfSevMetadataGuid)\r
+  DW      OvmfSevMetadataOffsetEnd - OvmfSevMetadataOffsetStart\r
+  DB      0x66, 0x65, 0x88, 0xdc, 0x4a, 0x98, 0x98, 0x47\r
+  DB      0xA7, 0x5e, 0x55, 0x85, 0xa7, 0xbf, 0x67, 0xcc\r
+OvmfSevMetadataOffsetEnd:\r
+\r
 %endif\r
 \r
 ; SEV Hash Table Block\r
index 87effedb9c60a17945d67b0fccb4671d4e73fc0f..d847794feadbd74c07e9f3cbdb6732b1247cdd53 100644 (file)
 %include "Ia32/AmdSev.asm"\r
 %include "Ia32/PageTables64.asm"\r
 %include "Ia32/IntelTdx.asm"\r
+%include "X64/OvmfSevMetadata.asm"\r
 %endif\r
 \r
 %include "Ia16/Real16ToFlat32.asm"\r
diff --git a/OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm b/OvmfPkg/ResetVector/X64/OvmfSevMetadata.asm
new file mode 100644 (file)
index 0000000..9d8c3e8
--- /dev/null
@@ -0,0 +1,34 @@
+;-----------------------------------------------------------------------------\r
+; @file\r
+; OVMF metadata for the AMD SEV confidential computing guests\r
+;\r
+; Copyright (c) 2021, AMD Inc. All rights reserved.<BR>\r
+;\r
+; SPDX-License-Identifier: BSD-2-Clause-Patent\r
+;-----------------------------------------------------------------------------\r
+\r
+BITS  64\r
+\r
+%define OVMF_SEV_METADATA_VERSION     1\r
+\r
+; The section must be accepted or validated by the VMM before the boot\r
+%define OVMF_SECTION_TYPE_SNP_SEC_MEM     0x1\r
+\r
+ALIGN 16\r
+\r
+TIMES (15 - ((OvmfSevGuidedStructureEnd - OvmfSevGuidedStructureStart + 15) % 16)) DB 0\r
+\r
+OvmfSevGuidedStructureStart:\r
+;\r
+; OvmfSev metadata descriptor\r
+;\r
+OvmfSevMetadataGuid:\r
+\r
+_DescriptorSev:\r
+  DB 'A','S','E','V'                                        ; Signature\r
+  DD OvmfSevGuidedStructureEnd - _DescriptorSev             ; Length\r
+  DD OVMF_SEV_METADATA_VERSION                              ; Version\r
+  DD (OvmfSevGuidedStructureEnd - _DescriptorSev - 16) / 12 ; Number of sections\r
+\r
+OvmfSevGuidedStructureEnd:\r
+  ALIGN   16\r