Skip to content

Add preliminary Intel TDX support [v2] #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

jakecorrenti
Copy link
Member

This pull request adds support for Intel Trust Domain eXtensions (TDX), another hardware Trusted Execution Environment architecture.

Note: this pull request does not support attestation.

In the IOAPIC constructor, only enable the SPLIT IRQCHIP capability on
non-tdx flavors. The TDX flavor will enable the necessary capabilities
for the system on Vm creation.

Signed-off-by: Jake Correnti <[email protected]>
TDX requires the IRQCHIP to be split between the guest and the host.
Enable the functionality in the launch-tee test.

Signed-off-by: Jake Correnti <[email protected]>
Some of the pre-existing feature checks in the `vmm` crate, whether
`tee` or `amd-sev`, are not compatible with the `tdx` feature.

Signed-off-by: Jake Correnti <[email protected]>
Ensure the -tdx flavor links with the correct libkrunfw flavor, which in
this case is libkrunfw-tdx.

Signed-off-by: Jake Correnti <[email protected]>
The registers and APIC state on TDX systems are considered "protected",
therefore we cannot configure them at all through the KVM API.

Signed-off-by: Jake Correnti <[email protected]>
Adds a new `inteltdx` module and implements a TDX implementation for `Vm::new()`

Signed-off-by: Jake Correnti <[email protected]>
TDX requires the number of 4k pages and the number of vCPUs to be
specified in the boot parameters differently than the other `tee`
architectures.

Signed-off-by: Jake Correnti <[email protected]>
TDX starts execution in 32-bit protected mode, not 16-bit real mode.
Change the reset vector to reflect that.

Signed-off-by: Jake Correnti <[email protected]>
Retrieve the TDX capabilities KVM supports with the current TDX module
the system has loaded and perform TDX specific VM initialization.

Signed-off-by: Jake Correnti <[email protected]>
Signed-off-by: Jake Correnti <[email protected]>
After the vCPUs have been created with KVM, add them to the TDX
launcher and then do the necessary initialization.

Signed-off-by: Jake Correnti <[email protected]>
Initialize the guest private memory for each of the measured regions
created.

Signed-off-by: Jake Correnti <[email protected]>
Set up the worker thread so the TDX guest is able to convert memory from
shared -> private or private -> shared when a hypercall is made or a
memory fault occurs.

Signed-off-by: Jake Correnti <[email protected]>
When the vCPU exits with VcpuExit::MemoryFault, ensure that we are
checking the exit flag has the private bit set to 1 before attempting to
convert any memory.

Signed-off-by: Jake Correnti <[email protected]>
@jakecorrenti
Copy link
Member Author

jakecorrenti commented Jun 13, 2025

Currently working through two outstanding issues that just came up:

  • giving the VM more than 3072 mib of memory causes an error because the guest exits with VcpuExit::MemoryFault, then tries to conver the region at MMIO_START to private. It's unclear if this is a TDX-specific issue or this is also affecting SNP
  • giving the VM more than 1 processor leads to only the BSP being active. The APs fail to wake up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant