1 | /** @file
|
---|
2 | Public header file for the AmdSvsmLib.
|
---|
3 |
|
---|
4 | This library class defines some routines used for invoking an SVSM when the
|
---|
5 | guest is not running at VMPL0.
|
---|
6 |
|
---|
7 | Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.<BR>
|
---|
8 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
9 |
|
---|
10 | **/
|
---|
11 |
|
---|
12 | #ifndef AMD_SVSM_LIB_H_
|
---|
13 | #define AMD_SVSM_LIB_H_
|
---|
14 |
|
---|
15 | #include <Protocol/DebugSupport.h>
|
---|
16 | #include <Register/Amd/Ghcb.h>
|
---|
17 |
|
---|
18 | /**
|
---|
19 | Report the presence of an Secure Virtual Services Module (SVSM).
|
---|
20 |
|
---|
21 | Determines the presence of an SVSM.
|
---|
22 |
|
---|
23 | @retval TRUE An SVSM is present
|
---|
24 | @retval FALSE An SVSM is not present
|
---|
25 |
|
---|
26 | **/
|
---|
27 | BOOLEAN
|
---|
28 | EFIAPI
|
---|
29 | AmdSvsmIsSvsmPresent (
|
---|
30 | VOID
|
---|
31 | );
|
---|
32 |
|
---|
33 | /**
|
---|
34 | Report the VMPL level at which the SEV-SNP guest is running.
|
---|
35 |
|
---|
36 | Determines the VMPL level at which the guest is running. If an SVSM is
|
---|
37 | not present, then it must be VMPL0, otherwise return what is reported
|
---|
38 | by the SVSM.
|
---|
39 |
|
---|
40 | @return The VMPL level
|
---|
41 |
|
---|
42 | **/
|
---|
43 | UINT8
|
---|
44 | EFIAPI
|
---|
45 | AmdSvsmSnpGetVmpl (
|
---|
46 | VOID
|
---|
47 | );
|
---|
48 |
|
---|
49 | /**
|
---|
50 | Report the Calling Area address (CAA) for the BSP of the SEV-SNP guest.
|
---|
51 |
|
---|
52 | If an SVSM is present, the CAA for the BSP is returned.
|
---|
53 |
|
---|
54 | @return The CAA
|
---|
55 |
|
---|
56 | **/
|
---|
57 | UINT64
|
---|
58 | EFIAPI
|
---|
59 | AmdSvsmSnpGetCaa (
|
---|
60 | VOID
|
---|
61 | );
|
---|
62 |
|
---|
63 | /**
|
---|
64 | Perform a PVALIDATE operation for the page ranges specified.
|
---|
65 |
|
---|
66 | Validate or rescind the validation of the specified pages.
|
---|
67 |
|
---|
68 | @param[in] Info Pointer to a page state change structure
|
---|
69 |
|
---|
70 | **/
|
---|
71 | VOID
|
---|
72 | EFIAPI
|
---|
73 | AmdSvsmSnpPvalidate (
|
---|
74 | IN SNP_PAGE_STATE_CHANGE_INFO *Info
|
---|
75 | );
|
---|
76 |
|
---|
77 | /**
|
---|
78 | Perform an RMPADJUST operation to alter the VMSA setting of a page.
|
---|
79 |
|
---|
80 | Add or remove the VMSA attribute for a page.
|
---|
81 |
|
---|
82 | @param[in] Vmsa Pointer to an SEV-ES save area page
|
---|
83 | @param[in] ApicId APIC ID associated with the VMSA
|
---|
84 | @param[in] SetVmsa Boolean indicator as to whether to set or
|
---|
85 | or clear the VMSA setting for the page
|
---|
86 |
|
---|
87 | @retval EFI_SUCCESS RMPADJUST operation successful
|
---|
88 | @retval EFI_UNSUPPORTED Operation is not supported
|
---|
89 | @retval EFI_INVALID_PARAMETER RMPADJUST operation failed, an invalid
|
---|
90 | parameter was supplied
|
---|
91 |
|
---|
92 | **/
|
---|
93 | EFI_STATUS
|
---|
94 | EFIAPI
|
---|
95 | AmdSvsmSnpVmsaRmpAdjust (
|
---|
96 | IN SEV_ES_SAVE_AREA *Vmsa,
|
---|
97 | IN UINT32 ApicId,
|
---|
98 | IN BOOLEAN SetVmsa
|
---|
99 | );
|
---|
100 |
|
---|
101 | #endif
|
---|