1 | /** @file
|
---|
2 |
|
---|
3 | Work Area structure definition
|
---|
4 |
|
---|
5 | Copyright (c) 2021 - 2024, AMD Inc.
|
---|
6 |
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef __OVMF_WORK_AREA_H__
|
---|
11 | #define __OVMF_WORK_AREA_H__
|
---|
12 |
|
---|
13 | #include <ConfidentialComputingGuestAttr.h>
|
---|
14 | #include <IndustryStandard/Tpm20.h>
|
---|
15 |
|
---|
16 | //
|
---|
17 | // Confidential computing work area header definition. Any change
|
---|
18 | // to the structure need to be kept in sync with the
|
---|
19 | // PcdOvmfConfidentialComputingWorkAreaHeader.
|
---|
20 | //
|
---|
21 | // PcdOvmfConfidentialComputingWorkAreaHeader ==
|
---|
22 | // sizeof (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER)
|
---|
23 | // PcdOvmfConfidentialComputingWorkAreaHeader defined in:
|
---|
24 | // OvmfPkg/OvmfPkg.dec
|
---|
25 | // OvmfPkg/Include/Fdf/OvmfPkgDefines.fdf.inc
|
---|
26 | typedef struct _CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER {
|
---|
27 | UINT8 GuestType;
|
---|
28 | UINT8 Reserved1[3];
|
---|
29 | } CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER;
|
---|
30 |
|
---|
31 | //
|
---|
32 | // Internal structure for holding SEV-ES information needed during SEC phase
|
---|
33 | // and valid only during SEC phase and early PEI during platform
|
---|
34 | // initialization.
|
---|
35 | //
|
---|
36 | // This structure is also used by assembler files:
|
---|
37 | // OvmfPkg/ResetVector/ResetVector.nasmb
|
---|
38 | // OvmfPkg/ResetVector/Ia32/PageTables64.asm
|
---|
39 | // OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm
|
---|
40 | // any changes must stay in sync with its usage.
|
---|
41 | //
|
---|
42 | typedef struct _SEC_SEV_ES_WORK_AREA {
|
---|
43 | //
|
---|
44 | // Hold the SevStatus MSR value read by OvmfPkg/ResetVector/Ia32/AmdSev.c
|
---|
45 | //
|
---|
46 | UINT64 SevStatusMsrValue;
|
---|
47 |
|
---|
48 | UINT64 RandomData;
|
---|
49 |
|
---|
50 | UINT64 EncryptionMask;
|
---|
51 |
|
---|
52 | //
|
---|
53 | // Indicator that the VC handler is called. It is used during the SevFeature
|
---|
54 | // detection in OvmfPkg/ResetVector/Ia32/AmdSev.c
|
---|
55 | //
|
---|
56 | UINT8 ReceivedVc;
|
---|
57 | UINT8 Reserved[7];
|
---|
58 |
|
---|
59 | // Used by SEC to generate Page State Change requests. This should be
|
---|
60 | // sized less than an equal to the GHCB shared buffer area to allow a
|
---|
61 | // single call to the hypervisor.
|
---|
62 | //
|
---|
63 | UINT8 WorkBuffer[1024];
|
---|
64 | } SEC_SEV_ES_WORK_AREA;
|
---|
65 |
|
---|
66 | //
|
---|
67 | // The SEV work area definition.
|
---|
68 | //
|
---|
69 | typedef struct _SEV_WORK_AREA {
|
---|
70 | CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
|
---|
71 |
|
---|
72 | SEC_SEV_ES_WORK_AREA SevEsWorkArea;
|
---|
73 | } SEV_WORK_AREA;
|
---|
74 |
|
---|
75 | //
|
---|
76 | // Start of TDX Specific WorkArea definition
|
---|
77 | //
|
---|
78 |
|
---|
79 | #define TDX_MEASUREMENT_TDHOB_BITMASK 0x1
|
---|
80 | #define TDX_MEASUREMENT_CFVIMG_BITMASK 0x2
|
---|
81 |
|
---|
82 | typedef struct _TDX_MEASUREMENTS_DATA {
|
---|
83 | UINT32 MeasurementsBitmap;
|
---|
84 | UINT8 TdHobHashValue[SHA384_DIGEST_SIZE];
|
---|
85 | UINT8 CfvImgHashValue[SHA384_DIGEST_SIZE];
|
---|
86 | } TDX_MEASUREMENTS_DATA;
|
---|
87 |
|
---|
88 | //
|
---|
89 | // The TDX work area definition
|
---|
90 | //
|
---|
91 | typedef struct _SEC_TDX_WORK_AREA {
|
---|
92 | UINT32 PageTableReady;
|
---|
93 | UINT32 Gpaw;
|
---|
94 | UINT64 HobList;
|
---|
95 | TDX_MEASUREMENTS_DATA TdxMeasurementsData;
|
---|
96 | } SEC_TDX_WORK_AREA;
|
---|
97 |
|
---|
98 | typedef struct _TDX_WORK_AREA {
|
---|
99 | CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
|
---|
100 | SEC_TDX_WORK_AREA SecTdxWorkArea;
|
---|
101 | } TDX_WORK_AREA;
|
---|
102 |
|
---|
103 | //
|
---|
104 | // End of TDX Specific WorkArea definition
|
---|
105 | //
|
---|
106 |
|
---|
107 | typedef union {
|
---|
108 | CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
|
---|
109 | SEV_WORK_AREA SevWorkArea;
|
---|
110 | TDX_WORK_AREA TdxWorkArea;
|
---|
111 | } OVMF_WORK_AREA;
|
---|
112 |
|
---|
113 | #endif
|
---|