[edk2-devel] [PATCH 15/23] OvmfPkg: Add IntelTdx.h in OvmfPkg/Include/IndustryStandard

Min Xu min.m.xu at intel.com
Thu Aug 12 11:56:54 UTC 2021


RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

IntelTdx.h defines the defitions used by TDX in OvmfPkg:
 - Mailbox related defitions,such as the data structure, command code,
   AP relocation defitions.
 - EFI_HOB_PLATFORM_INFO describes the TDX platform information

Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Brijesh Singh <brijesh.singh at amd.com>
Cc: Erdem Aktas <erdemaktas at google.com>
Cc: James Bottomley <jejb at linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao at intel.com>
Cc: Tom Lendacky <thomas.lendacky at amd.com>
Signed-off-by: Min Xu <min.m.xu at intel.com>
---
 OvmfPkg/Include/IndustryStandard/IntelTdx.h | 77 +++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 OvmfPkg/Include/IndustryStandard/IntelTdx.h

diff --git a/OvmfPkg/Include/IndustryStandard/IntelTdx.h b/OvmfPkg/Include/IndustryStandard/IntelTdx.h
new file mode 100644
index 000000000000..2370f18289a1
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/IntelTdx.h
@@ -0,0 +1,77 @@
+/** @file
+  TBD
+
+  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _OVMF_INTEL_TDX__H_
+#define _OVMF_INTEL_TDX__H_
+
+#include <PiPei.h>
+#include <Library/BaseLib.h>
+#include <Uefi/UefiSpec.h>
+#include <Uefi/UefiBaseType.h>
+
+#define MP_CPU_PROTECTED_MODE_MAILBOX_APICID_INVALID    0xFFFFFFFF
+#define MP_CPU_PROTECTED_MODE_MAILBOX_APICID_BROADCAST  0xFFFFFFFE
+
+typedef enum {
+  MpProtectedModeWakeupCommandNoop = 0,
+  MpProtectedModeWakeupCommandWakeup = 1,
+  MpProtectedModeWakeupCommandSleep = 2,
+  MpProtectedModeWakeupCommandAcceptPages = 3,
+} MP_CPU_PROTECTED_MODE_WAKEUP_CMD;
+
+#pragma pack (1)
+
+  //
+  // Describes the CPU MAILBOX control structure use to
+  // wakeup cpus spinning in long mode
+  //
+  typedef struct {
+    UINT16                  Command;
+    UINT16                  Resv;
+    UINT32                  ApicId;
+    UINT64                  WakeUpVector;
+    UINT8                   ResvForOs[2032];
+    //
+    // Arguments available for wakeup code
+    //
+    UINT64                  WakeUpArgs1;
+    UINT64                  WakeUpArgs2;
+    UINT64                  WakeUpArgs3;
+    UINT64                  WakeUpArgs4;
+    UINT8                   Pad1[0xe0];
+    UINT64                  NumCpusArriving;
+    UINT8                   Pad2[0xf8];
+    UINT64                  NumCpusExiting;
+    UINT32                  Tallies[256];
+    UINT8                   Errors[256];
+    UINT8                   Pad3[0xf8];
+  } MP_WAKEUP_MAILBOX;
+
+
+//
+// AP relocation code information including code address and size,
+// this structure will be shared be C code and assembly code.
+// It is natural aligned by design.
+//
+typedef struct {
+  UINT8             *RelocateApLoopFuncAddress;
+  UINTN             RelocateApLoopFuncSize;
+} MP_RELOCATION_MAP;
+
+typedef struct {
+  ///
+  EFI_HOB_GUID_TYPE       GuidHeader;
+  UINT64                  RelocatedMailBox;
+  UINT16                  HostBridgePciDevId;
+  BOOLEAN                 SetNxForStack;
+  UINT8                   SystemStates[6];
+} EFI_HOB_PLATFORM_INFO;
+
+#pragma pack()
+
+#endif
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79171): https://edk2.groups.io/g/devel/message/79171
Mute This Topic: https://groups.io/mt/84837908/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list