OvmfPkg[all]  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MemEncryptSevLib.h File Reference

Data Structures

struct  SEV_ES_PER_CPU_DATA
 

Macros

#define VMGEXIT_MAXIMUM_VC_COUNT   2
 

Enumerations

enum  MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE { MemEncryptSevAddressRangeUnencrypted, MemEncryptSevAddressRangeEncrypted, MemEncryptSevAddressRangeMixed, MemEncryptSevAddressRangeError }
 

Functions

BOOLEAN EFIAPI MemEncryptSevEsIsEnabled (VOID)
 
BOOLEAN EFIAPI MemEncryptSevIsEnabled (VOID)
 
RETURN_STATUS EFIAPI MemEncryptSevClearPageEncMask (IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
 
RETURN_STATUS EFIAPI MemEncryptSevSetPageEncMask (IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
 
RETURN_STATUS EFIAPI MemEncryptSevLocateInitialSmramSaveStateMapPages (OUT UINTN *BaseAddress, OUT UINTN *NumberOfPages)
 
UINT64 EFIAPI MemEncryptSevGetEncryptionMask (VOID)
 
MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE
EFIAPI 
MemEncryptSevGetAddressRangeState (IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN Length)
 
RETURN_STATUS EFIAPI MemEncryptSevClearMmioPageEncMask (IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
 

Detailed Description

Define Secure Encrypted Virtualization (SEV) base library helper function

Copyright (c) 2017 - 2020, AMD Incorporated. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Macro Definition Documentation

#define VMGEXIT_MAXIMUM_VC_COUNT   2

Enumeration Type Documentation

Enumerator
MemEncryptSevAddressRangeUnencrypted 
MemEncryptSevAddressRangeEncrypted 
MemEncryptSevAddressRangeMixed 
MemEncryptSevAddressRangeError 

Function Documentation

RETURN_STATUS EFIAPI MemEncryptSevClearMmioPageEncMask ( IN PHYSICAL_ADDRESS  Cr3BaseAddress,
IN PHYSICAL_ADDRESS  BaseAddress,
IN UINTN  NumPages 
)

This function clears memory encryption bit for the MMIO region specified by BaseAddress and NumPages.

Parameters
[in]Cr3BaseAddressCr3 Base Address (if zero then use current CR3)
[in]BaseAddressThe physical address that is the start address of a MMIO region.
[in]NumPagesThe number of pages from start memory region.
Return values
RETURN_SUCCESSThe attributes were cleared for the memory region.
RETURN_INVALID_PARAMETERNumber of pages is zero.
RETURN_UNSUPPORTEDClearing the memory encryption attribute is not supported
RETURN_STATUS EFIAPI MemEncryptSevClearPageEncMask ( IN PHYSICAL_ADDRESS  Cr3BaseAddress,
IN PHYSICAL_ADDRESS  BaseAddress,
IN UINTN  NumPages 
)

This function clears memory encryption bit for the memory region specified by BaseAddress and NumPages from the current page table context.

Parameters
[in]Cr3BaseAddressCr3 Base Address (if zero then use current CR3)
[in]BaseAddressThe physical address that is the start address of a memory region.
[in]NumPagesThe number of pages from start memory region.
Return values
RETURN_SUCCESSThe attributes were cleared for the memory region.
RETURN_INVALID_PARAMETERNumber of pages is zero.
RETURN_UNSUPPORTEDClearing the memory encryption attribute is not supported
BOOLEAN EFIAPI MemEncryptSevEsIsEnabled ( VOID  )

Returns a boolean to indicate whether SEV-ES is enabled.

Return values
TRUESEV-ES is enabled
FALSESEV-ES is not enabled
MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE EFIAPI MemEncryptSevGetAddressRangeState ( IN PHYSICAL_ADDRESS  Cr3BaseAddress,
IN PHYSICAL_ADDRESS  BaseAddress,
IN UINTN  Length 
)

Returns the encryption state of the specified virtual address range.

Parameters
[in]Cr3BaseAddressCr3 Base Address (if zero then use current CR3)
[in]BaseAddressBase address to check
[in]LengthLength of virtual address range
Return values
MemEncryptSevAddressRangeUnencryptedAddress range is mapped unencrypted
MemEncryptSevAddressRangeEncryptedAddress range is mapped encrypted
MemEncryptSevAddressRangeMixedAddress range is mapped mixed
MemEncryptSevAddressRangeErrorAddress range is not mapped
UINT64 EFIAPI MemEncryptSevGetEncryptionMask ( VOID  )

Returns the SEV encryption mask.

Returns
The SEV pagetable encryption mask
BOOLEAN EFIAPI MemEncryptSevIsEnabled ( VOID  )

Returns a boolean to indicate whether SEV is enabled

Return values
TRUESEV is enabled
FALSESEV is not enabled
RETURN_STATUS EFIAPI MemEncryptSevLocateInitialSmramSaveStateMapPages ( OUT UINTN *  BaseAddress,
OUT UINTN *  NumberOfPages 
)

Locate the page range that covers the initial (pre-SMBASE-relocation) SMRAM Save State Map.

Parameters
[out]BaseAddressThe base address of the lowest-address page that covers the initial SMRAM Save State Map.
[out]NumberOfPagesThe number of pages in the page range that covers the initial SMRAM Save State Map.
Return values
RETURN_SUCCESSBaseAddress and NumberOfPages have been set on output.
RETURN_UNSUPPORTEDSMM is unavailable.
RETURN_STATUS EFIAPI MemEncryptSevSetPageEncMask ( IN PHYSICAL_ADDRESS  Cr3BaseAddress,
IN PHYSICAL_ADDRESS  BaseAddress,
IN UINTN  NumPages 
)

This function sets memory encryption bit for the memory region specified by BaseAddress and NumPages from the current page table context.

Parameters
[in]Cr3BaseAddressCr3 Base Address (if zero then use current CR3)
[in]BaseAddressThe physical address that is the start address of a memory region.
[in]NumPagesThe number of pages from start memory region.
Return values
RETURN_SUCCESSThe attributes were set for the memory region.
RETURN_INVALID_PARAMETERNumber of pages is zero.
RETURN_UNSUPPORTEDSetting the memory encryption attribute is not supported