From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min Xu <min.m.xu@intel.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Gerd Hoffmann <kraxel@redhat.com>,
Jordan Justen <jordan.l.justen@intel.com>,
Brijesh Singh <brijesh.singh@amd.com>,
Erdem Aktas <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: [PATCH V7 0/1] Add Intel TDX support in OvmfPkg/ResetVector
Date: Tue, 21 Sep 2021 17:05:21 +0800 [thread overview]
Message-ID: <cover.1632214561.git.min.m.xu@intel.com> (raw)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
Intel's Trust Domain Extensions (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 virutal machines guest called a
Trust Domain (TD). A TD is desinged to run in a CPU mode that protects the
confidentiality of TD memory contents and the TD's CPU state from other
software, including the hosting Virtual-Machine Monitor (VMM), unless
explicitly shared by the TD itself.
The patch-sets to support Intel TDX in OvmfPkg is split into several
waves. This is wave-1 which adds Intel TDX support in OvmfPkg/ResetVector.
Note: TDX only works in X64.
[TDX]: https://software.intel.com/content/dam/develop/external/us/en/
documents/tdx-whitepaper-final9-17.pdf
[TDVF]: https://software.intel.com/content/dam/develop/external/us/en/
documents/tdx-virtual-firmware-design-guide-rev-1.pdf
Code is at https://github.com/mxu9/edk2/tree/tdvf_wave1.v7
v7 changes:
- Refine the offset of TdxMetadata and remove the definition of
PcdOvmfImageSizeInKB
- Use MOV CR* instead of smsw in ResetVector
- Remove the new field (SubType) in
CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER.
v6 changes:
- Remove the 5-level paging support. 5-level paging enabling is *NOT*
super critical for TDX enabling at this moment. It will be enabled
later in a separate patch.
- Add a new field (SubType) in CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER
to record the VM Guest SubType.
- In Main16 entry point, after TransitionFromReal16To32BitFlat,
WORK_AREA_GUEST_TYPE is cleared to 0. WORK_AREA_GUEST_TYPE was
previously cleared in SetCr3ForPageTables64 (see commit ab77b60).
This doesn't work after TDX is introduced in Ovmf. It is because all
TDX CPUs (BSP and APs) start to run from 0xfffffff0. In previous code
WORK_AREA_GUEST_TYPE will be cleared multi-times in TDX guest. So for
SEV and Legacy guest it is moved to Main16 entry point (after
TransitionFromReal16To32BitFlat). For TDX guest WORK_AREA_GUEST_TYPE
is cleared and set in InitTdxWorkarea.
- Make the return result of IsTdx be consistent with IsTdxEnabled.
- Fix some typo in the code comments.
v5 changes:
- Remove the changes of OVMF_WORK_AREA because Commit ab77b60 covers
those changes.
- Refine the TDX related changes in PageTables64.asm and
Flat32ToFlat64.asm.
- Add CheckTdxFeaturesBeforeBuildPagetables to check Non-Tdx, Tdx-BSP or
Tdx-APs. This routine is called before building page tables.
v4 changes:
- Refine the PageTables64.asm and Flat32ToFlat64.asm to enable TDX.
- Refine SEV_ES_WORK_AREA so that SEV/TDX/Legach guest all can use this
memory region. https://edk2.groups.io/g/devel/message/78345 is the
discussion.
- AmdSev.asm is removed because Brijesh Singh has done it in
https://edk2.groups.io/g/devel/message/78241.
v3 changes:
- Refine PageTables64.asm and Flat32ToFlat64.asm based on the review
comments in [ReviewComment-1] and [ReviewComment-2].
- SEV codes are in AmdSev.asm
- TDX codes are in IntelTdx.asm
- Main.asm is created in OvmfPkg/ResetVector. The one in
UefiCpuPkg/ResetVector/Vtf0 is not used.
- Init32.asm/ReloadFlat32.asm in UefiCpuPkg/ResetVector/Vtf0/Ia32 are
deleted. They're moved to OvmfPkg/ResetVector/Ia32.
- InitTdx.asm is renamed to InteTdx.asm
v2 changes:
- Move InitTdx.asm and ReloadFlat32.asm from UefiCpuPkg/ResetVector/Vtf0
to OvmfPkg/ResetVector. Init32.asm is created which is a null stub of
32-bit initialization. In Main32 just simply call Init32. It makes
the Main.asm in UefiCpuPkg/ResetVector clean and clear.
- Init32.asm/InitTdx.asm/ReloadFlat32.asm are created under
OvmfPkg/ResetVector/Ia32.
- Update some descriptions of the patch-sets.
- Update the REF link in cover letter.
- Add Ard Biesheuvel in Cc list.
v1: https://edk2.groups.io/g/devel/message/77675
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Min Xu (1):
OvmfPkg: Enable TDX in ResetVector
OvmfPkg/OvmfPkg.dec | 9 +
OvmfPkg/OvmfPkgDefines.fdf.inc | 9 +
OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm | 39 +++
OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm | 11 +
OvmfPkg/ResetVector/Ia32/IntelTdx.asm | 235 +++++++++++++++++++
OvmfPkg/ResetVector/Ia32/PageTables64.asm | 21 +-
OvmfPkg/ResetVector/Main.asm | 119 ++++++++++
OvmfPkg/ResetVector/ResetVector.inf | 9 +
OvmfPkg/ResetVector/ResetVector.nasmb | 40 +++-
OvmfPkg/ResetVector/X64/IntelTdxMetadata.asm | 102 ++++++++
10 files changed, 587 insertions(+), 7 deletions(-)
create mode 100644 OvmfPkg/ResetVector/Ia32/IntelTdx.asm
create mode 100644 OvmfPkg/ResetVector/Main.asm
create mode 100644 OvmfPkg/ResetVector/X64/IntelTdxMetadata.asm
--
2.29.2.windows.2
next reply other threads:[~2021-09-21 9:06 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-21 9:05 Min Xu [this message]
2021-09-21 9:05 ` [PATCH V7 1/1] OvmfPkg: Enable TDX in ResetVector Min Xu
2021-09-22 7:49 ` Gerd Hoffmann
2021-09-23 0:38 ` Min Xu
2021-09-23 8:48 ` Gerd Hoffmann
2021-09-23 11:39 ` Yao, Jiewen
2021-09-23 12:54 ` Brijesh Singh
2021-09-23 13:18 ` Yao, Jiewen
2021-09-23 13:19 ` [edk2-devel] " Min Xu
2021-09-23 13:38 ` Yao, Jiewen
2021-09-23 14:03 ` Brijesh Singh
2021-09-23 14:15 ` Min Xu
2021-09-23 14:19 ` Yao, Jiewen
2021-09-24 5:37 ` Gerd Hoffmann
2021-09-24 7:36 ` Yao, Jiewen
2021-09-24 9:24 ` Gerd Hoffmann
2021-09-24 9:55 ` Yao, Jiewen
2021-09-24 5:28 ` Gerd Hoffmann
2021-09-24 6:55 ` Min Xu
2021-09-24 10:07 ` Gerd Hoffmann
2021-09-24 10:33 ` Yao, Jiewen
2021-09-24 14:02 ` Gerd Hoffmann
2021-09-24 16:40 ` Yao, Jiewen
2021-09-27 8:05 ` Gerd Hoffmann
2021-09-27 10:05 ` Yao, Jiewen
2021-09-27 14:59 ` Gerd Hoffmann
2021-09-28 0:21 ` Yao, Jiewen
2021-09-24 7:32 ` Yao, Jiewen
2021-09-24 9:15 ` Gerd Hoffmann
2021-09-24 4:54 ` Gerd Hoffmann
2021-09-24 7:39 ` Yao, Jiewen
2021-09-24 9:34 ` Gerd Hoffmann
2021-09-24 10:11 ` Yao, Jiewen
2021-09-24 10:38 ` Brijesh Singh
2021-09-24 11:17 ` Gerd Hoffmann
2021-09-24 11:29 ` Brijesh Singh
2021-09-24 10:14 ` Brijesh Singh
2021-09-24 10:58 ` Brijesh Singh
2021-09-25 0:03 ` Min Xu
2021-09-25 3:21 ` Brijesh Singh
2021-09-25 23:17 ` [edk2-devel] " Min Xu
2021-09-25 23:30 ` Yao, Jiewen
2021-09-27 8:44 ` 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=cover.1632214561.git.min.m.xu@intel.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