public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Xu, Min M" <min.m.xu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>
Subject: Re: [PATCH 04/23] MdePkg: Add Tdx.h
Date: Thu, 12 Aug 2021 20:52:11 +0000	[thread overview]
Message-ID: <CO1PR11MB49296B3183BDD760D4863910D2F99@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <e3716ecb213b9e748177335bbd38eab95866e460.1628767741.git.min.m.xu@intel.com>

Hi Min,

Please add the link to the public documentation to the
Tdx.h file header

Thanks,

Mike

> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Thursday, August 12, 2021 4:57 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Liu, Zhiguang <zhiguang.liu@intel.com>
> Subject: [PATCH 04/23] MdePkg: Add Tdx.h
> 
> RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
> 
> Tdx.h includes the Intel Trust Domain Extension definitions.
> 
> Detailed information can be found in below document:
> https://software.intel.com/content/dam/develop/external/us/en/
> documents/tdx-module-1eas-v0.85.039.pdf
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> ---
>  MdePkg/Include/IndustryStandard/Tdx.h | 200 ++++++++++++++++++++++++++
>  1 file changed, 200 insertions(+)
>  create mode 100644 MdePkg/Include/IndustryStandard/Tdx.h
> 
> diff --git a/MdePkg/Include/IndustryStandard/Tdx.h b/MdePkg/Include/IndustryStandard/Tdx.h
> new file mode 100644
> index 000000000000..c50470708b56
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/Tdx.h
> @@ -0,0 +1,200 @@
> +/** @file
> +  Intel Trust Domain Extension definitions
> +
> +  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef MDE_PKG_TDX_H_
> +#define MDE_PKG_TDX_H_
> +
> +#define EXIT_REASON_EXTERNAL_INTERRUPT  1
> +#define EXIT_REASON_TRIPLE_FAULT        2
> +
> +#define EXIT_REASON_PENDING_INTERRUPT   7
> +#define EXIT_REASON_NMI_WINDOW          8
> +#define EXIT_REASON_TASK_SWITCH         9
> +#define EXIT_REASON_CPUID               10
> +#define EXIT_REASON_HLT                 12
> +#define EXIT_REASON_INVD                13
> +#define EXIT_REASON_INVLPG              14
> +#define EXIT_REASON_RDPMC               15
> +#define EXIT_REASON_RDTSC               16
> +#define EXIT_REASON_VMCALL              18
> +#define EXIT_REASON_VMCLEAR             19
> +#define EXIT_REASON_VMLAUNCH            20
> +#define EXIT_REASON_VMPTRLD             21
> +#define EXIT_REASON_VMPTRST             22
> +#define EXIT_REASON_VMREAD              23
> +#define EXIT_REASON_VMRESUME            24
> +#define EXIT_REASON_VMWRITE             25
> +#define EXIT_REASON_VMOFF               26
> +#define EXIT_REASON_VMON                27
> +#define EXIT_REASON_CR_ACCESS           28
> +#define EXIT_REASON_DR_ACCESS           29
> +#define EXIT_REASON_IO_INSTRUCTION      30
> +#define EXIT_REASON_MSR_READ            31
> +#define EXIT_REASON_MSR_WRITE           32
> +#define EXIT_REASON_INVALID_STATE       33
> +#define EXIT_REASON_MSR_LOAD_FAIL       34
> +#define EXIT_REASON_MWAIT_INSTRUCTION   36
> +#define EXIT_REASON_MONITOR_TRAP_FLAG   37
> +#define EXIT_REASON_MONITOR_INSTRUCTION 39
> +#define EXIT_REASON_PAUSE_INSTRUCTION   40
> +#define EXIT_REASON_MCE_DURING_VMENTRY  41
> +#define EXIT_REASON_TPR_BELOW_THRESHOLD 43
> +#define EXIT_REASON_APIC_ACCESS         44
> +#define EXIT_REASON_EOI_INDUCED         45
> +#define EXIT_REASON_GDTR_IDTR           46
> +#define EXIT_REASON_LDTR_TR             47
> +#define EXIT_REASON_EPT_VIOLATION       48
> +#define EXIT_REASON_EPT_MISCONFIG       49
> +#define EXIT_REASON_INVEPT              50
> +#define EXIT_REASON_RDTSCP              51
> +#define EXIT_REASON_PREEMPTION_TIMER    52
> +#define EXIT_REASON_INVVPID             53
> +#define EXIT_REASON_WBINVD              54
> +#define EXIT_REASON_XSETBV              55
> +#define EXIT_REASON_APIC_WRITE          56
> +#define EXIT_REASON_RDRAND              57
> +#define EXIT_REASON_INVPCID             58
> +#define EXIT_REASON_VMFUNC              59
> +#define EXIT_REASON_ENCLS               60
> +#define EXIT_REASON_RDSEED              61
> +#define EXIT_REASON_PML_FULL            62
> +#define EXIT_REASON_XSAVES              63
> +#define EXIT_REASON_XRSTORS             64
> +
> +// TDCALL API Function Completion Status Codes
> +#define TDX_EXIT_REASON_SUCCESS                     0x0000000000000000
> +#define TDX_EXIT_REASON_PAGE_ALREADY_ACCEPTED       0x00000B0A00000000
> +#define TDX_EXIT_REASON_PAGE_SIZE_MISMATCH          0xC0000B0B00000000
> +#define TDX_EXIT_REASON_OPERAND_INVALID             0xC000010000000000
> +#define TDX_EXIT_REASON_OPERAND_BUSY                0x8000020000000000
> +
> +// TDCALL [TDG.MEM.PAGE.ACCEPT] page size
> +#define TDCALL_ACCEPT_PAGE_SIZE_4K      0
> +#define TDCALL_ACCEPT_PAGE_SIZE_2M      1
> +#define TDCALL_ACCEPT_PAGE_SIZE_1G      2
> +
> +#define TDCALL_TDVMCALL                 0
> +#define TDCALL_TDINFO                   1
> +#define TDCALL_TDEXTENDRTMR             2
> +#define TDCALL_TDGETVEINFO              3
> +#define TDCALL_TDREPORT                 4
> +#define TDCALL_TDSETCPUIDVE             5
> +#define TDCALL_TDACCEPTPAGE             6
> +
> +#define TDVMCALL_CPUID                  0x0000a
> +#define TDVMCALL_HALT                   0x0000c
> +#define TDVMCALL_IO                     0x0001e
> +#define TDVMCALL_RDMSR                  0x0001f
> +#define TDVMCALL_WRMSR                  0x00020
> +#define TDVMCALL_MMIO                   0x00030
> +#define TDVMCALL_PCONFIG                0x00041
> +
> +#define TDVMCALL_GET_TDVMCALL_INFO      0x10000
> +#define TDVMCALL_MAPGPA                 0x10001
> +#define TDVMCALL_GET_QUOTE              0x10002
> +#define TDVMCALL_REPORT_FATAL_ERR       0x10003
> +#define TDVMCALL_SETUP_EVENT_NOTIFY     0x10004
> +
> +#pragma pack(1)
> +typedef struct {
> +  UINT64  Data[6];
> +} TDCALL_GENERIC_RETURN_DATA;
> +
> +typedef struct {
> +  UINT64  Gpaw;
> +  UINT64  Attributes;
> +  UINT32  MaxVcpus;
> +  UINT32  NumVcpus;
> +  UINT64  Resv[3];
> +} TDCALL_INFO_RETURN_DATA;
> +
> +typedef union {
> +  UINT64  Val;
> +  struct {
> +    UINT32  Size:3;
> +    UINT32  Direction:1;
> +    UINT32  String:1;
> +    UINT32  Rep:1;
> +    UINT32  Encoding:1;
> +    UINT32  Resv:9;
> +    UINT32  Port:16;
> +    UINT32  Resv2;
> +  } Io;
> +} VMX_EXIT_QUALIFICATION;
> +
> +typedef struct {
> +  UINT32                  ExitReason;
> +  UINT32                  Resv;
> +  VMX_EXIT_QUALIFICATION  ExitQualification;
> +  UINT64                  GuestLA;
> +  UINT64                  GuestPA;
> +  UINT32                  ExitInstructionLength;
> +  UINT32                  ExitInstructionInfo;
> +  UINT32                  Resv1;
> +} TDCALL_VEINFO_RETURN_DATA;
> +
> +typedef union {
> +  TDCALL_GENERIC_RETURN_DATA  Generic;
> +  TDCALL_INFO_RETURN_DATA     TdInfo;
> +  TDCALL_VEINFO_RETURN_DATA   VeInfo;
> +} TD_RETURN_DATA;
> +
> +/* data structure used in TDREPORT_STRUCT */
> +typedef struct {
> +  UINT8         Type;
> +  UINT8         Subtype;
> +  UINT8         Version;
> +  UINT8         Rsvd;
> +} TD_REPORT_TYPE;
> +
> +typedef struct {
> +  TD_REPORT_TYPE   ReportType;
> +  UINT8            Rsvd1[12];
> +  UINT8            CpuSvn[16];
> +  UINT8            TeeTcbInfoHash[48];
> +  UINT8            TeeInfoHash[48];
> +  UINT8            ReportData[64];
> +  UINT8            Rsvd2[32];
> +  UINT8            Mac[32];
> +} REPORTMACSTRUCT;
> +
> +typedef struct {
> +  UINT8         Seam[2];
> +  UINT8         Rsvd[14];
> +} TEE_TCB_SVN;
> +
> +typedef struct {
> +  UINT8         Valid[8];
> +  TEE_TCB_SVN   TeeTcbSvn;
> +  UINT8         Mrseam[48];
> +  UINT8         Mrsignerseam[48];
> +  UINT8         Attributes[8];
> +  UINT8         Rsvd[111];
> +} TEE_TCB_INFO;
> +
> +typedef struct {
> +  UINT8         Attributes[8];
> +  UINT8         Xfam[8];
> +  UINT8         Mrtd[48];
> +  UINT8         Mrconfigid[48];
> +  UINT8         Mrowner[48];
> +  UINT8         Mrownerconfig[48];
> +  UINT8         Rtmrs[4][48];
> +  UINT8         Rsvd[112];
> +} TDINFO;
> +
> +typedef struct {
> +  REPORTMACSTRUCT   ReportMacStruct;
> +  TEE_TCB_INFO      TeeTcbInfo;
> +  UINT8             Rsvd[17];
> +  TDINFO            Tdinfo;
> +} TDREPORT_STRUCT;
> +
> +#pragma pack()
> +
> +#endif
> --
> 2.29.2.windows.2


  reply	other threads:[~2021-08-12 20:52 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 11:56 [PATCH 00/23] Enable Intel TDX in OvmfPkg (SEC/PEI) Min Xu
2021-08-12 11:56 ` [PATCH 01/23] OvmfPkg: Add Tdx BFV/CFV PCDs and PcdOvmfImageSizeInKb Min Xu
2021-08-12 11:56 ` [PATCH 02/23] OvmfPkg/Sec: Update the check logic in SevEsIsEnabled Min Xu
2021-09-11  1:13   ` Erdem Aktas
2021-09-13  3:04     ` Min Xu
2021-08-12 11:56 ` [PATCH 03/23] OvmfPkg/ResetVector: Enable Intel TDX in ResetVector of Ovmf Min Xu
2021-09-11  1:14   ` Erdem Aktas
2021-09-13  6:06     ` Min Xu
2021-09-14  2:16       ` Erdem Aktas
2021-08-12 11:56 ` [PATCH 04/23] MdePkg: Add Tdx.h Min Xu
2021-08-12 20:52   ` Michael D Kinney [this message]
2021-08-12 22:57     ` Min Xu
2021-08-12 11:56 ` [PATCH 05/23] MdePkg: Add TdxProbeLib to probe Intel Tdx Min Xu
2021-08-16  9:43   ` [edk2-devel] " Gerd Hoffmann
2021-08-17  0:14     ` Min Xu
2021-08-17  8:20       ` Gerd Hoffmann
2021-08-17  8:43         ` Min Xu
2021-08-17  8:58           ` Gerd Hoffmann
2021-09-11  1:14   ` Erdem Aktas
2021-09-13  6:11     ` [edk2-devel] " Min Xu
2021-08-12 11:56 ` [PATCH 06/23] MdePkg: Add TdxLib to wrap Tdx operations Min Xu
2021-09-11  1:15   ` Erdem Aktas
2021-08-12 11:56 ` [PATCH 07/23] MdePkg: Update BaseIoLibIntrinsicSev to support Tdx Min Xu
2021-08-17  8:38   ` [edk2-devel] " Gerd Hoffmann
2021-08-18  5:54     ` Min Xu
2021-08-19  6:30       ` Gerd Hoffmann
2021-08-19 13:12         ` Min Xu
2021-08-20  6:41           ` Gerd Hoffmann
2021-09-11  1:15   ` Erdem Aktas
2021-09-28  8:33     ` [edk2-devel] " Min Xu
2021-08-12 11:56 ` [PATCH 08/23] UefiCpuPkg: Support TDX in BaseXApicX2ApicLib Min Xu
2021-08-12 11:56 ` [PATCH 09/23] UefiCpuPkg: Add VmTdExitLibNull Min Xu
2021-08-12 11:56 ` [PATCH 10/23] OvmfPkg: Prepare OvmfPkg to use the VmTdExitLib library Min Xu
2021-08-12 11:56 ` [PATCH 11/23] OvmfPkg: Implement library support for VmTdExitLib in Ovmf Min Xu
2021-08-12 11:56 ` [PATCH 12/23] UefiCpuPkg/CpuExceptionHandler: Add base support for the #VE exception Min Xu
2021-08-12 11:56 ` [PATCH 13/23] UefiCpuPkg: Enable Tdx support in MpInitLib Min Xu
2021-08-12 11:56 ` [PATCH 14/23] OvmfPkg: Update SecEntry.nasm to support Tdx Min Xu
2021-08-12 11:56 ` [PATCH 15/23] OvmfPkg: Add IntelTdx.h in OvmfPkg/Include/IndustryStandard Min Xu
2021-08-12 11:56 ` [PATCH 16/23] OvmfPkg: Add TdxMailboxLib Min Xu
2021-08-12 11:56 ` [PATCH 17/23] MdePkg: Add EFI_RESOURCE_ATTRIBUTE_ENCRYPTED in PiHob.h Min Xu
2021-08-12 11:56 ` [PATCH 18/23] OvmfPkg: Enable Tdx in SecMain.c Min Xu
2021-08-19  6:49   ` [edk2-devel] " Gerd Hoffmann
2021-08-19 14:27     ` Min Xu
2021-08-20  7:22       ` Gerd Hoffmann
2021-08-24 12:07         ` Min Xu
2021-08-24 12:55           ` Ard Biesheuvel
2021-08-25  6:10             ` Yao, Jiewen
2021-08-25  7:52               ` Gerd Hoffmann
2021-08-25  9:07                 ` Yao, Jiewen
2021-08-25 14:51                   ` Gerd Hoffmann
2021-08-25 16:28                     ` Yao, Jiewen
2021-08-26  8:31                       ` Gerd Hoffmann
2021-08-26 16:58                         ` Yao, Jiewen
2021-08-25  6:22           ` Gerd Hoffmann
2021-08-12 11:56 ` [PATCH 19/23] OvmfPkg: Check Tdx in QemuFwCfgPei to avoid DMA operation Min Xu
2021-08-12 11:56 ` [PATCH 20/23] MdePkg: Add AllocatePagesWithMemoryType support in PeiMemoryAllocationLib Min Xu
2021-08-12 20:43   ` Michael D Kinney
2021-08-15  2:51     ` Min Xu
2021-08-12 11:57 ` [PATCH 21/23] OvmfPkg: Add PcdUse1GPageTable support for TDX Min Xu
2021-08-12 11:57 ` [PATCH 22/23] MdeModulePkg: EFER should not be changed in TDX Min Xu
2021-08-12 11:57 ` [PATCH 23/23] OvmfPkg: Update PlatformPei to support TDX Min Xu
2021-08-31 10:45 ` [edk2-devel] [PATCH 00/23] Enable Intel TDX in OvmfPkg (SEC/PEI) Gerd Hoffmann
2021-09-01  5:41   ` Min Xu
2021-09-01  6:25     ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB49296B3183BDD760D4863910D2F99@CO1PR11MB4929.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox