From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com []) by mx.groups.io with SMTP id smtpd.web10.2226.1615251291604715253 for ; Mon, 08 Mar 2021 16:54:52 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: min.m.xu@intel.com) IronPort-SDR: cNADMKroI7KCDImPft+9bzXWX/Yqd+mHpWJ9SBZxl3h+6qzmmenaPKOdQW0tsAi/NayIv68a63 RGWuHnE5BKag== X-IronPort-AV: E=McAfee;i="6000,8403,9917"; a="167402277" X-IronPort-AV: E=Sophos;i="5.81,233,1610438400"; d="scan'208";a="167402277" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2021 16:54:52 -0800 IronPort-SDR: ttjf3tX9+Dt1CS1fltLcAk1xq9UqVby/MRWTBCp94e5MVwxUGrqrwMQ4r5ITEUp050rJ05p+YH PSufkMGrQ2bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,233,1610438400"; d="scan'208";a="376308066" Received: from unknown (HELO shwdeSSSDDPDSW2.ccr.corp.intel.com) ([10.239.54.61]) by fmsmga007.fm.intel.com with ESMTP; 08 Mar 2021 16:54:50 -0800 From: min.m.xu@intel.com To: devel@edk2.groups.io Cc: Min Xu , Doug Reiland , Liming Gao , Zhiguang Liu , Jiewen Yao Subject: [PATCH 1/3] MdePkg: Add Tdx support lib Date: Tue, 9 Mar 2021 08:54:41 +0800 Message-Id: <9986f966565c980ac4e33a86c7a7ce41533433ae.1615249174.git.min.m.xu@intel.com> X-Mailer: git-send-email 2.30.1.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Min Xu Intel Trust Domain Extension (Intel TDX) refers to an Intel technology that extends Virtual Machines Extensions (VMX) and Multi-Key Total Memory Encryption (MKTME) with a new kind of virtual machine guest called a Trust Domain (TD). TdxLib is created with functions to perform the related Tdx operation. This includes functions for: - TdCall : to cause a VM exit to the Intel TDX module - TdVmCall : it is a leaf function 0 for TDCALL - TdVmCallCpuid : enable the TD guest to request VMM to emulate CPUID - TdReport : to retrieve TDREPORT_STRUCT - TdAcceptPages : to accept pending private pages - TdExtendRtmr : to extend one of the RTMR registers The base function in this dirver will not do anything and will return an error if a return value is required. It is expected that other packages (like OvmfPkg) will create a version of the library to fully support a TD guest. Signed-off-by: Min Xu Signed-off-by: Doug Reiland CC: Liming Gao CC: Zhiguang Liu CC: Jiewen Yao --- MdePkg/Include/IndustryStandard/Tdx.h | 201 ++++++++++++++++++++++++++ MdePkg/Include/Library/TdxLib.h | 165 +++++++++++++++++++++ MdePkg/Include/Protocol/Tdx.h | 22 +++ MdePkg/Library/TdxLib/TdxLibNull.c | 155 ++++++++++++++++++++ MdePkg/Library/TdxLib/TdxLibNull.inf | 33 +++++ 5 files changed, 576 insertions(+) create mode 100644 MdePkg/Include/IndustryStandard/Tdx.h create mode 100644 MdePkg/Include/Library/TdxLib.h create mode 100644 MdePkg/Include/Protocol/Tdx.h create mode 100644 MdePkg/Library/TdxLib/TdxLibNull.c create mode 100644 MdePkg/Library/TdxLib/TdxLibNull.inf diff --git a/MdePkg/Include/IndustryStandard/Tdx.h b/MdePkg/Include/Industr= yStandard/Tdx.h new file mode 100644 index 0000000000..dbcc31c265 --- /dev/null +++ b/MdePkg/Include/IndustryStandard/Tdx.h @@ -0,0 +1,201 @@ +/** @file=0D + Intel Trust Domain Extension definitions=0D +=0D + Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#ifndef _TDX_H_=0D +#define _TDX_H_=0D +=0D +#define EXIT_REASON_EXTERNAL_INTERRUPT 1=0D +#define EXIT_REASON_TRIPLE_FAULT 2=0D +=0D +#define EXIT_REASON_PENDING_INTERRUPT 7=0D +#define EXIT_REASON_NMI_WINDOW 8=0D +#define EXIT_REASON_TASK_SWITCH 9=0D +#define EXIT_REASON_CPUID 10=0D +#define EXIT_REASON_HLT 12=0D +#define EXIT_REASON_INVD 13=0D +#define EXIT_REASON_INVLPG 14=0D +#define EXIT_REASON_RDPMC 15=0D +#define EXIT_REASON_RDTSC 16=0D +#define EXIT_REASON_VMCALL 18=0D +#define EXIT_REASON_VMCLEAR 19=0D +#define EXIT_REASON_VMLAUNCH 20=0D +#define EXIT_REASON_VMPTRLD 21=0D +#define EXIT_REASON_VMPTRST 22=0D +#define EXIT_REASON_VMREAD 23=0D +#define EXIT_REASON_VMRESUME 24=0D +#define EXIT_REASON_VMWRITE 25=0D +#define EXIT_REASON_VMOFF 26=0D +#define EXIT_REASON_VMON 27=0D +#define EXIT_REASON_CR_ACCESS 28=0D +#define EXIT_REASON_DR_ACCESS 29=0D +#define EXIT_REASON_IO_INSTRUCTION 30=0D +#define EXIT_REASON_MSR_READ 31=0D +#define EXIT_REASON_MSR_WRITE 32=0D +#define EXIT_REASON_INVALID_STATE 33=0D +#define EXIT_REASON_MSR_LOAD_FAIL 34=0D +#define EXIT_REASON_MWAIT_INSTRUCTION 36=0D +#define EXIT_REASON_MONITOR_TRAP_FLAG 37=0D +#define EXIT_REASON_MONITOR_INSTRUCTION 39=0D +#define EXIT_REASON_PAUSE_INSTRUCTION 40=0D +#define EXIT_REASON_MCE_DURING_VMENTRY 41=0D +#define EXIT_REASON_TPR_BELOW_THRESHOLD 43=0D +#define EXIT_REASON_APIC_ACCESS 44=0D +#define EXIT_REASON_EOI_INDUCED 45=0D +#define EXIT_REASON_GDTR_IDTR 46=0D +#define EXIT_REASON_LDTR_TR 47=0D +#define EXIT_REASON_EPT_VIOLATION 48=0D +#define EXIT_REASON_EPT_MISCONFIG 49=0D +#define EXIT_REASON_INVEPT 50=0D +#define EXIT_REASON_RDTSCP 51=0D +#define EXIT_REASON_PREEMPTION_TIMER 52=0D +#define EXIT_REASON_INVVPID 53=0D +#define EXIT_REASON_WBINVD 54=0D +#define EXIT_REASON_XSETBV 55=0D +#define EXIT_REASON_APIC_WRITE 56=0D +#define EXIT_REASON_RDRAND 57=0D +#define EXIT_REASON_INVPCID 58=0D +#define EXIT_REASON_VMFUNC 59=0D +#define EXIT_REASON_ENCLS 60=0D +#define EXIT_REASON_RDSEED 61=0D +#define EXIT_REASON_PML_FULL 62=0D +#define EXIT_REASON_XSAVES 63=0D +#define EXIT_REASON_XRSTORS 64=0D +=0D +// TDCALL API Function Completion Status Codes=0D +#define TDX_EXIT_REASON_SUCCESS 0x0000000000000000=0D +#define TDX_EXIT_REASON_PAGE_ALREADY_ACCEPTED 0x00000B0A00000000=0D +#define TDX_EXIT_REASON_OPERAND_INVALID 0xC000010000000000=0D +#define TDX_EXIT_REASON_OPERAND_BUSY 0x8000020000000000=0D +=0D +#define TDCALL_TDVMCALL 0=0D +#define TDCALL_TDINFO 1=0D +#define TDCALL_TDEXTENDRTMR 2=0D +#define TDCALL_TDGETVEINFO 3=0D +#define TDCALL_TDREPORT 4=0D +#define TDCALL_TDSETCPUIDVE 5=0D +#define TDCALL_TDACCEPTPAGE 6=0D +=0D +#define TDVMCALL_CPUID 0x0000a=0D +#define TDVMCALL_HALT 0x0000c=0D +#define TDVMCALL_IO 0x0001e=0D +#define TDVMCALL_RDMSR 0x0001f=0D +#define TDVMCALL_WRMSR 0x00020=0D +#define TDVMCALL_MMIO 0x00030=0D +#define TDVMCALL_PCONFIG 0x00041=0D +=0D +#define TDVMCALL_GET_TDVMCALL_INFO 0x10000=0D +#define TDVMCALL_MAPGPA 0x10001=0D +#define TDVMCALL_GET_QUOTE 0x10002=0D +#define TDVMCALL_REPORT_FATAL_ERR 0x10003=0D +#define TDVMCALL_SETUP_EVENT_NOTIFY 0x10004=0D +=0D +#pragma pack(1)=0D +typedef struct {=0D + UINT64 Data[6];=0D +} TDCALL_GENERIC_RETURN_DATA;=0D +=0D +typedef struct {=0D + UINT64 Gpaw;=0D + UINT64 Attributes;=0D + UINT32 MaxVcpus;=0D + UINT32 NumVcpus;=0D + UINT64 Resv[3];=0D +} TDCALL_INFO_RETURN_DATA;=0D +=0D +typedef union {=0D + UINT64 Val;=0D + struct {=0D + UINT32 Size:3;=0D + UINT32 Direction:1;=0D + UINT32 String:1;=0D + UINT32 Rep:1;=0D + UINT32 Encoding:1;=0D + UINT32 Resv:9;=0D + UINT32 Port:16;=0D + UINT32 Resv2;=0D + } Io;=0D +} VMX_EXIT_QUALIFICATION;=0D +=0D +typedef struct {=0D + UINT32 ExitReason;=0D + UINT32 Resv;=0D + VMX_EXIT_QUALIFICATION ExitQualification;=0D + UINT64 GuestLA;=0D + UINT64 GuestPA;=0D + UINT32 ExitInstructionLength;=0D + UINT32 ExitInstructionInfo;=0D + UINT32 Resv1;=0D +} TDCALL_VEINFO_RETURN_DATA;=0D +=0D +typedef union {=0D + TDCALL_GENERIC_RETURN_DATA Generic;=0D + TDCALL_INFO_RETURN_DATA TdInfo;=0D + TDCALL_VEINFO_RETURN_DATA VeInfo;=0D +} TD_RETURN_DATA;=0D +=0D +/* data structure used in TDREPORT_STRUCT */=0D +typedef struct{=0D + UINT8 Type;=0D + UINT8 Subtype;=0D + UINT8 Version;=0D + UINT8 Rsvd;=0D +}TD_REPORT_TYPE;=0D +=0D +typedef struct{=0D + TD_REPORT_TYPE ReportType;=0D + UINT8 Rsvd1[12];=0D + UINT8 CpuSvn[16];=0D + UINT8 TeeTcbInfoHash[48];=0D + UINT8 TeeInfoHash[48];=0D + UINT8 ReportData[64];=0D + UINT8 Rsvd2[32];=0D + UINT8 Mac[32];=0D +}REPORTMACSTRUCT;=0D +=0D +typedef struct{=0D + UINT8 Seam[2];=0D + UINT8 Rsvd[14];=0D +}TEE_TCB_SVN;=0D +=0D +typedef struct{=0D + UINT8 Valid[8];=0D + TEE_TCB_SVN TeeTcbSvn;=0D + UINT8 Mrseam[48];=0D + UINT8 Mrsignerseam[48];=0D + UINT8 Attributes[8];=0D + UINT8 Rsvd[111];=0D +}TEE_TCB_INFO;=0D +=0D +typedef struct{=0D + UINT8 Attributes[8];=0D + UINT8 Xfam[8];=0D + UINT8 Mrtd[48];=0D + UINT8 Mrconfigid[48];=0D + UINT8 Mrowner[48];=0D + UINT8 Mrownerconfig[48];=0D + UINT8 Rtmrs[4][48];=0D + UINT8 Rsvd[112];=0D +}TDINFO;=0D +=0D +typedef struct{=0D + REPORTMACSTRUCT ReportMacStruct;=0D + TEE_TCB_INFO TeeTcbInfo;=0D + UINT8 Rsvd[17];=0D + TDINFO Tdinfo;=0D +}TDREPORT_STRUCT;=0D +=0D +#pragma pack()=0D +=0D +#endif=0D +=0D diff --git a/MdePkg/Include/Library/TdxLib.h b/MdePkg/Include/Library/TdxLi= b.h new file mode 100644 index 0000000000..5e8634c6df --- /dev/null +++ b/MdePkg/Include/Library/TdxLib.h @@ -0,0 +1,165 @@ +/** @file=0D + TdxLib definitions=0D +=0D + Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#ifndef _TDX_LIB_H_=0D +#define _TDX_LIB_H_=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + This function retrieve TDREPORT_STRUCT structure from TDX.=0D + The struct contains the measurements/configuration information of=0D + the guest TD that called the function, measurements/configuratio=0D + information of the TDX-SEAM module and a REPORTMACSTRUCT.=0D + The REPORTMACSTRUCT is integrity protected with a MAC and=0D + contains the hash of the measurements and configuration=0D + as well as additional REPORTDATA provided by the TD software.=0D +=0D + AdditionalData, a 64-byte value, is provided by the guest TD=0D + to be included in the TDREPORT=0D +=0D + @param[in,out] Report Holds the TEREPORT_STRUCT.=0D + @param[in] ReportSize Size of the report. It must be=0D + larger than 1024B.=0D + @param[in] AdditionalData Point to the additional data.=0D + @param[in] AdditionalDataSize Size of the additional data.=0D + If AdditionalData !=3D NULL, then=0D + this value must be 64B.=0D +=0D + @return EFI_SUCCESS=0D + @return EFI_INVALID_PARAMETER=0D + @return EFI_DEVICE_ERROR=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdReport(=0D + IN OUT UINT8 *Report,=0D + IN UINT32 ReportSize,=0D + IN UINT8 *AdditionalData,=0D + IN UINT32 AdditionalDataSize=0D +);=0D +=0D +/**=0D + This function accept a pending private page, and initialize the page to= =0D + all-0 using the TD ephemeral private key.=0D +=0D + @param[in] StartAddress Guest physical address of the private page= =0D + to accept.=0D + @param[in] NumberOfPages Number of the pages to be accepted.=0D +=0D + @return EFI_SUCCESS=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdAcceptPages (=0D + IN UINT64 StartAddress,=0D + IN UINT64 NumberOfPages=0D + );=0D +=0D +/**=0D + This function extends one of the RTMR measurement register=0D + in TDCS with the provided extension data in memory.=0D + RTMR extending supports SHA384 which length is 48 bytes.=0D +=0D + @param[in] Data Point to the data to be extended=0D + @param[in] DataLen Length of the data. Must be 48=0D + @param[in] Index RTMR index=0D +=0D + @return EFI_SUCCESS=0D + @return EFI_INVALID_PARAMETER=0D + @return EFI_DEVICE_ERROR=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdExtendRtmr(=0D + IN UINT32 *Data,=0D + IN UINT32 DataLen,=0D + IN UINT8 PcrIndex=0D + );=0D +=0D +/**=0D + The TDCALL instruction causes a VM exit to the Intel TDX module. It is= =0D + used to call guest-side Intel TDX functions, either local or a TD exit=0D + to the host VMM, as selected by Leaf.=0D + Leaf functions are described at =0D +=0D + @param[in] Leaf Leaf number of TDCALL instruction=0D + @param[in] Arg1 Arg1=0D + @param[in] Arg2 Arg2=0D + @param[in] Arg3 Arg3=0D + @param[in,out] Results Returned result of the Leaf function=0D +=0D + @return EFI_SUCCESS=0D + @return Other See individual leaf functions=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdCall(=0D + IN UINT64 Leaf,=0D + IN UINT64 Arg1,=0D + IN UINT64 Arg2,=0D + IN UINT64 Arg3,=0D + IN OUT VOID *Results=0D + );=0D +=0D +/**=0D + TDVMALL is a leaf function 0 for TDCALL. It helps invoke services from t= he=0D + host VMM to pass/receive information.=0D +=0D + @param[in] Leaf Number of sub-functions=0D + @param[in] Arg1 Arg1=0D + @param[in] Arg2 Arg2=0D + @param[in] Arg3 Arg3=0D + @param[in] Arg4 Arg4=0D + @param[in,out] Results Returned result of the sub-function=0D +=0D + @return EFI_SUCCESS=0D + @return Other See individual sub-functions=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdVmCall (=0D + IN UINT64 Leaf,=0D + IN UINT64 Arg1,=0D + IN UINT64 Arg2,=0D + IN UINT64 Arg3,=0D + IN UINT64 Arg4,=0D + IN OUT VOID *Results=0D + );=0D +=0D +/**=0D + This function enable the TD guest to request the VMM to emulate CPUID=0D + operation, especially for non-architectural, CPUID leaves.=0D +=0D + @param[in] Eax Main leaf of the CPUID=0D + @param[in] Ecx Sub-leaf of the CPUID=0D + @param[out] Results Returned result of CPUID operation=0D +=0D + @return EFI_SUCCESS=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdVmCallCpuid (=0D + IN UINT64 Eax,=0D + IN UINT64 Ecx,=0D + OUT VOID *Results=0D + );=0D +#endif=0D diff --git a/MdePkg/Include/Protocol/Tdx.h b/MdePkg/Include/Protocol/Tdx.h new file mode 100644 index 0000000000..d3e1eae135 --- /dev/null +++ b/MdePkg/Include/Protocol/Tdx.h @@ -0,0 +1,22 @@ +/** @file=0D + Tcg for Intel TDX definitions.=0D +=0D +Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +=0D +#ifndef __TCG_TDX_H__=0D +#define __TCG_TDX_H__=0D +=0D +#include =0D +=0D +#define TCG_TDX_EVENT_DATA_SIGNATURE SIGNATURE_32 ('T', 'D', 'X', 'S')=0D +=0D +#define TD_TCG2_PROTOCOL_GUID \=0D + {0x96751a3d, 0x72f4, 0x41a6, { 0xa7, 0x94, 0xed, 0x5d, 0x0e, 0x67, 0xae,= 0x6b }}=0D +extern EFI_GUID gTdTcg2ProtocolGuid;=0D +=0D +=0D +#endif=0D diff --git a/MdePkg/Library/TdxLib/TdxLibNull.c b/MdePkg/Library/TdxLib/Tdx= LibNull.c new file mode 100644 index 0000000000..8d759e4d33 --- /dev/null +++ b/MdePkg/Library/TdxLib/TdxLibNull.c @@ -0,0 +1,155 @@ +/** @file=0D + Null instance of TdxLib.=0D +=0D + Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + This function retrieve TDREPORT_STRUCT structure from TDX.=0D + The struct contains the measurements/configuration information of=0D + the guest TD that called the function, measurements/configuratio=0D + information of the TDX-SEAM module and a REPORTMACSTRUCT.=0D + The REPORTMACSTRUCT is integrity protected with a MAC and=0D + contains the hash of the measurements and configuration=0D + as well as additional REPORTDATA provided by the TD software.=0D +=0D + AdditionalData, a 64-byte value, is provided by the guest TD=0D + to be included in the TDREPORT=0D +=0D + @param[in,out] Report Holds the TEREPORT_STRUCT.=0D + @param[in] ReportSize Size of the report. It must be=0D + larger than 1024B.=0D + @param[in] AdditionalData Point to the additional data.=0D + @param[in] AdditionalDataSize Size of the additional data.=0D + If AdditionalData !=3D NULL, then=0D + this value must be 64B.=0D +=0D + @return EFI_SUCCESS=0D + @return EFI_INVALID_PARAMETER=0D + @return EFI_DEVICE_ERROR=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdReport(=0D + IN OUT UINT8 *Report,=0D + IN UINT32 ReportSize,=0D + IN UINT8 *AdditionalData,=0D + IN UINT32 AdditionalDataSize=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +/**=0D + This function accept a pending private page, and initialize the page to= =0D + all-0 using the TD ephemeral private key.=0D +=0D + @param[in] StartAddress Guest physical address of the private page= =0D + to accept.=0D + @param[in] NumberOfPages Number of the pages to be accepted.=0D +=0D + @return EFI_UNSUPPORTED=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdAcceptPages (=0D + IN UINT64 StartAddress,=0D + IN UINT64 NumberOfPages=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +/**=0D + The TDCALL instruction causes a VM exit to the Intel TDX module. It is= =0D + used to call guest-side Intel TDX functions, either local or a TD exit=0D + to the host VMM, as selected by Leaf.=0D + Leaf functions are described at =0D +=0D + @param[in] Leaf Leaf number of TDCALL instruction=0D + @param[in] Arg1 Arg1=0D + @param[in] Arg2 Arg2=0D + @param[in] Arg3 Arg3=0D + @param[in,out] Results Returned result of the Leaf function=0D +=0D + @return EFI_SUCCESS=0D + @return Other See individual leaf functions=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdCall(=0D + IN UINT64 Leaf,=0D + IN UINT64 Arg1,=0D + IN UINT64 Arg2,=0D + IN UINT64 Arg3,=0D + IN OUT VOID *Results=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +/**=0D + TDVMALL is a leaf function 0 for TDCALL. It helps invoke services from t= he=0D + host VMM to pass/receive information.=0D +=0D + @param[in] Leaf Number of sub-functions=0D + @param[in] Arg1 Arg1=0D + @param[in] Arg2 Arg2=0D + @param[in] Arg3 Arg3=0D + @param[in] Arg4 Arg4=0D + @param[in,out] Results Returned result of the sub-function=0D +=0D + @return EFI_SUCCESS=0D + @return Other See individual sub-functions=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdVmCall (=0D + IN UINT64 Leaf,=0D + IN UINT64 Arg1,=0D + IN UINT64 Arg2,=0D + IN UINT64 Arg3,=0D + IN UINT64 Arg4,=0D + IN OUT VOID *Results=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +/**=0D + This function enable the TD guest to request the VMM to emulate CPUID=0D + operation, especially for non-architectural, CPUID leaves.=0D +=0D + @param[in] Eax Main leaf of the CPUID=0D + @param[in] Ecx Sub-leaf of the CPUID=0D + @param[in,out] Results Returned result of CPUID operation=0D +=0D + @return EFI_SUCCESS=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +TdVmCallCpuid (=0D + IN UINT64 Eax,=0D + IN UINT64 Ecx,=0D + IN OUT VOID *Results=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D diff --git a/MdePkg/Library/TdxLib/TdxLibNull.inf b/MdePkg/Library/TdxLib/T= dxLibNull.inf new file mode 100644 index 0000000000..0d07595a8c --- /dev/null +++ b/MdePkg/Library/TdxLib/TdxLibNull.inf @@ -0,0 +1,33 @@ +## @file=0D +# Null Tdx library instance=0D +#=0D +# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the BS= D License=0D +# which accompanies this distribution. The full text of the license may b= e found at=0D +# http://opensource.org/licenses/bsd-license.php.=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D TdxLibNull=0D + FILE_GUID =3D 05C5E621-FC66-4420-9C80-F0DE9E5B95FF= =0D + MODULE_TYPE =3D BASE=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D TdxLib=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D X64=0D +#=0D +=0D +[Sources]=0D + TdxLibNull.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D --=20 2.29.2.windows.2