[PATCH v14 00/23] TDX host kernel support

From: Kai Huang
Date: Tue Oct 17 2023 - 06:15:10 EST


Hi all,

For people who concern this patchset, sorry for sending out late. And to
save people's time, I didn't include the full coverletter here this time.
For detailed information please refer to previous v13's coverletter[1].


This version mainly adds a new patch to handle TDX vs S3/hibernation
interaction. In short, TDX cannot survive when platform goes to S3 and
deeper states. TDX gets completely reset upon this, and both TDX guests
and TDX module are destroyed. Please refer to the new patch (21).

Other changes from v13 -> v14:
- Addressed comments received in v13 (Rick/Nikolay/Dave).
- SEAMCALL patches, skeleton patch, kexec patch
- Some minor updates based on internal discussion.
- Added received Reviewed-by tags (thanks!).
- Updated the documentation patch to reflect new changes.

Please see each individual patch for specific change history.

Hi Dave,

In this version all patches (except the documentation one) now have at
least Kirill's Reviewed-by tag. Could you help to take a look?

And again, thanks everyone for reviewing and helping on this series.

[1]: v13 https://lore.kernel.org/lkml/cover.1692962263.git.kai.huang@xxxxxxxxx/T/


Kai Huang (23):
x86/virt/tdx: Detect TDX during kernel boot
x86/tdx: Define TDX supported page sizes as macros
x86/virt/tdx: Make INTEL_TDX_HOST depend on X86_X2APIC
x86/cpu: Detect TDX partial write machine check erratum
x86/virt/tdx: Handle SEAMCALL no entropy error in common code
x86/virt/tdx: Add SEAMCALL error printing for module initialization
x86/virt/tdx: Add skeleton to enable TDX on demand
x86/virt/tdx: Get information about TDX module and TDX-capable memory
x86/virt/tdx: Use all system memory when initializing TDX module as
TDX memory
x86/virt/tdx: Add placeholder to construct TDMRs to cover all TDX
memory regions
x86/virt/tdx: Fill out TDMRs to cover all TDX memory regions
x86/virt/tdx: Allocate and set up PAMTs for TDMRs
x86/virt/tdx: Designate reserved areas for all TDMRs
x86/virt/tdx: Configure TDX module with the TDMRs and global KeyID
x86/virt/tdx: Configure global KeyID on all packages
x86/virt/tdx: Initialize all TDMRs
x86/kexec: Flush cache of TDX private memory
x86/virt/tdx: Keep TDMRs when module initialization is successful
x86/virt/tdx: Improve readability of module initialization error
handling
x86/kexec(): Reset TDX private memory on platforms with TDX erratum
x86/virt/tdx: Handle TDX interaction with ACPI S3 and deeper states
x86/mce: Improve error log of kernel space TDX #MC due to erratum
Documentation/x86: Add documentation for TDX host support

Documentation/arch/x86/tdx.rst | 217 +++-
arch/x86/Kconfig | 3 +
arch/x86/coco/tdx/tdx-shared.c | 6 +-
arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/include/asm/msr-index.h | 3 +
arch/x86/include/asm/shared/tdx.h | 6 +
arch/x86/include/asm/tdx.h | 39 +
arch/x86/kernel/cpu/intel.c | 17 +
arch/x86/kernel/cpu/mce/core.c | 33 +
arch/x86/kernel/machine_kexec_64.c | 16 +
arch/x86/kernel/process.c | 8 +-
arch/x86/kernel/reboot.c | 15 +
arch/x86/kernel/setup.c | 2 +
arch/x86/virt/vmx/tdx/Makefile | 2 +-
arch/x86/virt/vmx/tdx/tdx.c | 1587 ++++++++++++++++++++++++++++
arch/x86/virt/vmx/tdx/tdx.h | 145 +++
16 files changed, 2084 insertions(+), 16 deletions(-)
create mode 100644 arch/x86/virt/vmx/tdx/tdx.c
create mode 100644 arch/x86/virt/vmx/tdx/tdx.h


base-commit: 9ee4318c157b9802589b746cc340bae3142d984c
--
2.41.0