TianoCore EDK2 master
Loading...
Searching...
No Matches
TdxLib.h File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI TdAcceptPages (IN UINT64 StartAddress, IN UINT64 NumberOfPages, IN UINT32 PageSize)
 
EFI_STATUS EFIAPI TdExtendRtmr (IN UINT32 *Data, IN UINT32 DataLen, IN UINT8 Index)
 
UINT64 EFIAPI TdSharedPageMask (VOID)
 
UINT32 EFIAPI TdMaxVCpuNum (VOID)
 
UINT32 EFIAPI TdVCpuNum (VOID)
 

Detailed Description

TdxLib definitions

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

Definition in file TdxLib.h.

Function Documentation

◆ TdAcceptPages()

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

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

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. Accept 2M/4K page size.
Returns
EFI_SUCCESS

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

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

Parameters
[in]StartAddressGuest physical address of the private page to accept.
[in]NumberOfPagesNumber of the pages to be accepted.
[in]PageSizeGPA page size. Accept 1G/2M/4K page size.
Returns
EFI_SUCCESS

Definition at line 74 of file AcceptPages.c.

◆ TdExtendRtmr()

EFI_STATUS EFIAPI TdExtendRtmr ( IN UINT32 *  Data,
IN UINT32  DataLen,
IN UINT8  Index 
)

This function extends one of the RTMR measurement register in TDCS with the provided extension data in memory. RTMR extending supports SHA384 which length is 48 bytes.

Parameters
[in]DataPoint to the data to be extended
[in]DataLenLength of the data. Must be 48
[in]IndexRTMR index
Returns
EFI_SUCCESS
EFI_INVALID_PARAMETER
EFI_DEVICE_ERROR

Definition at line 40 of file Rtmr.c.

◆ TdMaxVCpuNum()

UINT32 EFIAPI TdMaxVCpuNum ( VOID  )

This function gets the maximum number of Virtual CPUs that are usable for Td Guest.

Returns
maximum Virtual CPUs number

Definition at line 87 of file TdInfo.c.

◆ TdSharedPageMask()

UINT64 EFIAPI TdSharedPageMask ( VOID  )

This function gets the Td guest shared page mask.

The guest indicates if a page is shared using the Guest Physical Address (GPA) Shared (S) bit. If the GPA Width(GPAW) is 48, the S-bit is bit-47. If the GPAW is 52, the S-bit is bit-51.

Returns
Shared page bit mask

Definition at line 68 of file TdInfo.c.

◆ TdVCpuNum()

UINT32 EFIAPI TdVCpuNum ( VOID  )

This function gets the number of Virtual CPUs that are usable for Td Guest.

Returns
Virtual CPUs number

Definition at line 106 of file TdInfo.c.