1 | ;-----------------------------------------------------------------------------
|
---|
2 | ; @file
|
---|
3 | ; OVMF metadata for the AMD SEV confidential computing guests
|
---|
4 | ;
|
---|
5 | ; Copyright (c) 2021 - 2024, AMD Inc. All rights reserved.<BR>
|
---|
6 | ;
|
---|
7 | ; SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 | ;-----------------------------------------------------------------------------
|
---|
9 |
|
---|
10 | BITS 64
|
---|
11 |
|
---|
12 | %define OVMF_SEV_METADATA_VERSION 1
|
---|
13 |
|
---|
14 | ; The section must be accepted or validated by the VMM before the boot
|
---|
15 | %define OVMF_SECTION_TYPE_SNP_SEC_MEM 0x1
|
---|
16 |
|
---|
17 | ; AMD SEV-SNP specific sections
|
---|
18 | %define OVMF_SECTION_TYPE_SNP_SECRETS 0x2
|
---|
19 |
|
---|
20 | ;
|
---|
21 | ; The section contains the hypervisor pre-populated CPUID values.
|
---|
22 | ; In the case of SEV-SNP, the CPUID values are filtered and measured by
|
---|
23 | ; the SEV-SNP firmware.
|
---|
24 | ; The CPUID format is documented in SEV-SNP firmware spec 0.9 section 7.1
|
---|
25 | ; (CPUID function structure).
|
---|
26 | ;
|
---|
27 | %define OVMF_SECTION_TYPE_CPUID 0x3
|
---|
28 |
|
---|
29 | ; The SVSM Calling Area Address (CAA)
|
---|
30 | %define OVMF_SECTION_TYPE_SVSM_CAA 0x4
|
---|
31 |
|
---|
32 | ; Kernel hashes section for measured direct boot
|
---|
33 | %define OVMF_SECTION_TYPE_KERNEL_HASHES 0x10
|
---|
34 |
|
---|
35 | ALIGN 16
|
---|
36 |
|
---|
37 | TIMES (15 - ((OvmfSevGuidedStructureEnd - OvmfSevGuidedStructureStart + 15) % 16)) DB 0
|
---|
38 |
|
---|
39 | OvmfSevGuidedStructureStart:
|
---|
40 | ;
|
---|
41 | ; OvmfSev metadata descriptor
|
---|
42 | ;
|
---|
43 | OvmfSevMetadataGuid:
|
---|
44 |
|
---|
45 | _DescriptorSev:
|
---|
46 | DB 'A','S','E','V' ; Signature
|
---|
47 | DD OvmfSevGuidedStructureEnd - _DescriptorSev ; Length
|
---|
48 | DD OVMF_SEV_METADATA_VERSION ; Version
|
---|
49 | DD (OvmfSevGuidedStructureEnd - _DescriptorSev - 16) / 12 ; Number of sections
|
---|
50 |
|
---|
51 | ; Region need to be pre-validated by the hypervisor
|
---|
52 | PreValidate1:
|
---|
53 | DD SNP_SEC_MEM_BASE_DESC_1
|
---|
54 | DD SNP_SEC_MEM_SIZE_DESC_1
|
---|
55 | DD OVMF_SECTION_TYPE_SNP_SEC_MEM
|
---|
56 | PreValidate2:
|
---|
57 | DD SNP_SEC_MEM_BASE_DESC_2
|
---|
58 | DD SNP_SEC_MEM_SIZE_DESC_2
|
---|
59 | DD OVMF_SECTION_TYPE_SNP_SEC_MEM
|
---|
60 |
|
---|
61 | ; SEV-SNP Secrets page
|
---|
62 | SevSnpSecrets:
|
---|
63 | DD SEV_SNP_SECRETS_BASE
|
---|
64 | DD SEV_SNP_SECRETS_SIZE
|
---|
65 | DD OVMF_SECTION_TYPE_SNP_SECRETS
|
---|
66 |
|
---|
67 | ; CPUID values
|
---|
68 | CpuidSec:
|
---|
69 | DD CPUID_BASE
|
---|
70 | DD CPUID_SIZE
|
---|
71 | DD OVMF_SECTION_TYPE_CPUID
|
---|
72 |
|
---|
73 | ; SVSM CAA page
|
---|
74 | SvsmCaa:
|
---|
75 | DD SVSM_CAA_BASE
|
---|
76 | DD SVSM_CAA_SIZE
|
---|
77 | DD OVMF_SECTION_TYPE_SVSM_CAA
|
---|
78 |
|
---|
79 | %if (SEV_SNP_KERNEL_HASHES_BASE > 0)
|
---|
80 | ; Kernel hashes for measured direct boot, or zero page if
|
---|
81 | ; there are no kernel hashes / SEV secrets
|
---|
82 | SevSnpKernelHashes:
|
---|
83 | DD SEV_SNP_KERNEL_HASHES_BASE
|
---|
84 | DD SEV_SNP_KERNEL_HASHES_SIZE
|
---|
85 | DD OVMF_SECTION_TYPE_KERNEL_HASHES
|
---|
86 | %endif
|
---|
87 |
|
---|
88 | ; Region need to be pre-validated by the hypervisor
|
---|
89 | PreValidate3:
|
---|
90 | DD SNP_SEC_MEM_BASE_DESC_3
|
---|
91 | DD SNP_SEC_MEM_SIZE_DESC_3
|
---|
92 | DD OVMF_SECTION_TYPE_SNP_SEC_MEM
|
---|
93 | OvmfSevGuidedStructureEnd:
|
---|
94 | ALIGN 16
|
---|