TianoCore EDK2 master
Loading...
Searching...
No Matches
AcceptPages.c File Reference

Go to the source code of this file.

Macros

#define TDX_ACCEPTPAGE_MAX_RETRIED   3
 
#define INVALID_ACCEPT_PAGELEVEL   ARRAY_SIZE(mTdxAcceptPageLevelMap)
 

Functions

UINT32 GetGpaPageLevel (UINT32 PageSize)
 
EFI_STATUS EFIAPI TdAcceptPages (IN UINT64 StartAddress, IN UINT64 NumberOfPages, IN UINT32 PageSize)
 

Variables

UINT64 mNumberOfDuplicatedAcceptedPages
 
UINT32 mTdxAcceptPageLevelMap [2]
 

Detailed Description

Unaccepted memory is a special type of private memory. In Td guest TDCALL [TDG.MEM.PAGE.ACCEPT] is invoked to accept the unaccepted memory before use it.

Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AcceptPages.c.

Macro Definition Documentation

◆ INVALID_ACCEPT_PAGELEVEL

#define INVALID_ACCEPT_PAGELEVEL   ARRAY_SIZE(mTdxAcceptPageLevelMap)

Definition at line 30 of file AcceptPages.c.

◆ TDX_ACCEPTPAGE_MAX_RETRIED

#define TDX_ACCEPTPAGE_MAX_RETRIED   3

Definition at line 21 of file AcceptPages.c.

Function Documentation

◆ GetGpaPageLevel()

UINT32 GetGpaPageLevel ( UINT32  PageSize)

This function gets the PageLevel according to the input page size.

Parameters
[in]PageSizePage size
Returns
UINT32 The mapped page level

Definition at line 40 of file AcceptPages.c.

◆ TdAcceptPages()

EFI_STATUS EFIAPI TdAcceptPages ( IN UINT64  StartAddress,
IN UINT64  NumberOfPages,
IN UINT32  PageSize 
)

This function accept a pending private page, and initialize the page to all-0 using the TD ephemeral private key.

Sometimes TDCALL [TDG.MEM.PAGE.ACCEPT] may return TDX_EXIT_REASON_PAGE_SIZE_MISMATCH. It indicates the input PageLevel is not workable. In this case we need to try to fallback to a smaller PageLevel if possible.

Parameters
[in]StartAddressGuest physical address of the private page to accept. [63:52] and [11:0] must be 0.
[in]NumberOfPagesNumber of the pages to be accepted.
[in]PageSizeGPA page size. Only accept 2M/4K size.
Returns
EFI_SUCCESS Accept successfully
others Indicate other errors

Definition at line 74 of file AcceptPages.c.

Variable Documentation

◆ mNumberOfDuplicatedAcceptedPages

UINT64 mNumberOfDuplicatedAcceptedPages

Definition at line 19 of file AcceptPages.c.

◆ mTdxAcceptPageLevelMap

UINT32 mTdxAcceptPageLevelMap[2]
Initial value:
= {
SIZE_4KB,
SIZE_2MB
}

Definition at line 25 of file AcceptPages.c.