From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.4779.1648080680578717265 for ; Wed, 23 Mar 2022 17:11:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=gu8Q6PZO; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648080694; x=1679616694; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AyhAu0pWxp1mprhHORJ8AA+xMMK3zS1rl4ssUF1RbQI=; b=gu8Q6PZONxTP3O6fRKCrxzCqW41IS+/xf+HkL7dybdCDtYVlAEB+zC2G VtvcXu8MkCeCPhCKEIPywAeb2OiD2TNwdYdjq24nBWu277k0lFB3NjFyW CDpfw6o8zrwXdlS4myzN7l0aUkStqNlur6soeKtif7DZefLnf5fhcx2fW mu0kjK26yezMUxVsqsWbEiaaoC9VyyiAOdIXDKODtyyzaa50ADg1cakhs HPp5+KWfe6GhoU2GYa2kdJ3RKabW4gQqw3u1+4+/Z9NlvSisZ36uZQpxa TUDn8DYZO/1ZxRztU1r20m1n8t2HzzniCgQJgHQ9bHoIsCCVsnx/S277z g==; X-IronPort-AV: E=McAfee;i="6200,9189,10295"; a="258207224" X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="258207224" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:11:33 -0700 X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="649651136" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.31.90]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:11:31 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [PATCH V10 15/47] OvmfPkg: Add IntelTdx.h in OvmfPkg/Include/IndustryStandard Date: Thu, 24 Mar 2022 08:10:01 +0800 Message-Id: <20220324001033.1169-16-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: <20220324001033.1169-1-min.m.xu@intel.com> References: <20220324001033.1169-1-min.m.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 IntelTdx.h defines the defition used by TDX in OvmfPkg: - Mailbox related defitions,such as the data structure, command code, AP relocation defitions. See Table 5.44 Multiprocessor Wakeup Mailbox Structure in below link. https://uefi.org/specs/ACPI/6.4/05_ACPI_Software_Programming_Model/ ACPI_Software_Programming_Model.html#multiprocessor-wakeup-structure Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Acked-by: Gerd Hoffmann Signed-off-by: Min Xu --- OvmfPkg/Include/IndustryStandard/IntelTdx.h | 67 +++++++++++++++++++++ 1 file changed, 67 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..cc849be2fb59 --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/IntelTdx.h @@ -0,0 +1,67 @@ +/** @file + Defines the defitions used by TDX in OvmfPkg. + + Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef OVMF_INTEL_TDX_H_ +#define OVMF_INTEL_TDX_H_ + +#include +#include +#include +#include + +#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; + +#pragma pack() + +#endif -- 2.29.2.windows.2