TianoCore EDK2 master
|
#include <Base.h>
#include <Uefi.h>
#include <Library/BaseMemoryLib.h>
#include <Library/AmdSvsmLib.h>
#include <Register/Amd/Msr.h>
#include <Register/Amd/Svsm.h>
Go to the source code of this file.
Macros | |
#define | PAGES_PER_2MB_ENTRY 512 |
Functions | |
STATIC VOID | SnpTerminate (VOID) |
STATIC UINTN | SvsmMsrProtocol (IN OUT SVSM_CALL_DATA *SvsmCallData) |
BOOLEAN EFIAPI | AmdSvsmIsSvsmPresent (VOID) |
UINT8 EFIAPI | AmdSvsmSnpGetVmpl (VOID) |
UINT64 EFIAPI | AmdSvsmSnpGetCaa (VOID) |
STATIC VOID | SvsmPvalidate (IN SNP_PAGE_STATE_CHANGE_INFO *Info) |
STATIC VOID | BasePvalidate (IN SNP_PAGE_STATE_CHANGE_INFO *Info) |
VOID EFIAPI | AmdSvsmSnpPvalidate (IN SNP_PAGE_STATE_CHANGE_INFO *Info) |
STATIC EFI_STATUS | SvsmVmsaRmpAdjust (IN SEV_ES_SAVE_AREA *Vmsa, IN UINT32 ApicId, IN BOOLEAN SetVmsa) |
STATIC EFI_STATUS | BaseVmsaRmpAdjust (IN SEV_ES_SAVE_AREA *Vmsa, IN BOOLEAN SetVmsa) |
EFI_STATUS EFIAPI | AmdSvsmSnpVmsaRmpAdjust (IN SEV_ES_SAVE_AREA *Vmsa, IN UINT32 ApicId, IN BOOLEAN SetVmsa) |
SVSM Support Library.
Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file AmdSvsmLib.c.
#define PAGES_PER_2MB_ENTRY 512 |
Definition at line 16 of file AmdSvsmLib.c.
BOOLEAN EFIAPI AmdSvsmIsSvsmPresent | ( | VOID | ) |
Report the presence of an Secure Virtual Services Module (SVSM).
Determines the presence of an SVSM.
TRUE | An SVSM is present |
FALSE | An SVSM is not present |
Definition at line 130 of file AmdSvsmLib.c.
UINT64 EFIAPI AmdSvsmSnpGetCaa | ( | VOID | ) |
Report the Calling Area address (CAA) for the BSP of the SEV-SNP guest.
If an SVSM is present, the CAA for the BSP is returned.
Definition at line 174 of file AmdSvsmLib.c.
UINT8 EFIAPI AmdSvsmSnpGetVmpl | ( | VOID | ) |
Report the VMPL level at which the SEV-SNP guest is running.
Determines the VMPL level at which the guest is running. If an SVSM is not present, then it must be VMPL0, otherwise return what is reported by the SVSM.
Definition at line 153 of file AmdSvsmLib.c.
VOID EFIAPI AmdSvsmSnpPvalidate | ( | IN SNP_PAGE_STATE_CHANGE_INFO * | Info | ) |
Perform a PVALIDATE operation for the page ranges specified.
Validate or rescind the validation of the specified pages.
[in] | Info | Pointer to a page state change structure |
Definition at line 373 of file AmdSvsmLib.c.
EFI_STATUS EFIAPI AmdSvsmSnpVmsaRmpAdjust | ( | IN SEV_ES_SAVE_AREA * | Vmsa, |
IN UINT32 | ApicId, | ||
IN BOOLEAN | SetVmsa | ||
) |
Perform an RMPADJUST operation to alter the VMSA setting of a page.
Add or remove the VMSA attribute for a page.
[in] | Vmsa | Pointer to an SEV-ES save area page |
[in] | ApicId | APIC ID associated with the VMSA |
[in] | SetVmsa | Boolean indicator as to whether to set or or clear the VMSA setting for the page |
EFI_SUCCESS | RMPADJUST operation successful |
EFI_UNSUPPORTED | Operation is not supported |
EFI_INVALID_PARAMETER | RMPADJUST operation failed, an invalid parameter was supplied |
Definition at line 492 of file AmdSvsmLib.c.
STATIC VOID BasePvalidate | ( | IN SNP_PAGE_STATE_CHANGE_INFO * | Info | ) |
Perform a native PVALIDATE operation for the page ranges specified.
Validate or rescind the validation of the specified pages.
[in] | Info | Pointer to a page state change structure |
Definition at line 303 of file AmdSvsmLib.c.
STATIC EFI_STATUS BaseVmsaRmpAdjust | ( | IN SEV_ES_SAVE_AREA * | Vmsa, |
IN BOOLEAN | SetVmsa | ||
) |
Perform a native RMPADJUST operation to alter the VMSA setting of a page.
Add or remove the VMSA attribute for a page.
[in] | Vmsa | Pointer to an SEV-ES save area page |
[in] | SetVmsa | Boolean indicator as to whether to set or or clear the VMSA setting for the page |
EFI_SUCCESS | RMPADJUST operation successful |
EFI_INVALID_PARAMETER | RMPADJUST operation failed, an invalid parameter was supplied |
Definition at line 447 of file AmdSvsmLib.c.
STATIC VOID SnpTerminate | ( | VOID | ) |
Issue a GHCB termination request for termination.
Request termination using the GHCB MSR protocol.
Definition at line 26 of file AmdSvsmLib.c.
Issue an SVSM request.
Invokes the SVSM to process a request on behalf of the guest.
[in,out] | SvsmCallData | Pointer to the SVSM call data |
Definition at line 58 of file AmdSvsmLib.c.
STATIC VOID SvsmPvalidate | ( | IN SNP_PAGE_STATE_CHANGE_INFO * | Info | ) |
Issue an SVSM request to perform the PVALIDATE instruction.
Invokes the SVSM to process the PVALIDATE instruction on behalf of the guest to validate or invalidate the memory range specified.
[in] | Info | Pointer to a page state change structure |
Definition at line 196 of file AmdSvsmLib.c.
STATIC EFI_STATUS SvsmVmsaRmpAdjust | ( | IN SEV_ES_SAVE_AREA * | Vmsa, |
IN UINT32 | ApicId, | ||
IN BOOLEAN | SetVmsa | ||
) |
Perform an RMPADJUST operation to alter the VMSA setting of a page.
Add or remove the VMSA attribute for a page.
[in] | Vmsa | Pointer to an SEV-ES save area page |
[in] | ApicId | APIC ID associated with the VMSA |
[in] | SetVmsa | Boolean indicator as to whether to set or or clear the VMSA setting for the page |
EFI_SUCCESS | RMPADJUST operation successful |
EFI_UNSUPPORTED | Operation is not supported |
EFI_INVALID_PARAMETER | RMPADJUST operation failed, an invalid parameter was supplied |
Definition at line 398 of file AmdSvsmLib.c.