Skip to content

RFC Add TDX intra host migration support

Sagi Shahar kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: Split tdp_mmu_pages to private and shared listsarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/tdp_mmu.c+13 -32 replies
2/5KVM: SEV: Refactor common code out of sev_vm_move_enc_context_fromarch/x86/kvm/svm/sev.c arch/x86/kvm/x86.c arch/x86/kvm/x86.h+201 -1562 replies
3/5KVM: TDX: Add base implementation for tdx_vm_move_enc_context_fromarch/x86/kvm/vmx/main.c arch/x86/kvm/vmx/tdx.c arch/x86/kvm/vmx/tdx.h +1 more+73 -07 replies
4/5KVM: TDX: Implement moving private pages between 2 TDsarch/x86/kvm/mmu.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/tdp_mmu.c +1 more+137 -51 reply
5/5KVM: TDX: Add core logic for TDX intra-host migrationarch/x86/kvm/vmx/tdx.c+190 -11 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/5] Add TDX intra host migration support

This patchset adds support for TDX intra host migration using the same API which was added for SEV intra host migration here:
https://lore.kernel.org/all/[email protected]/

This patchset relies on the latest TDX patches from Intel:
- fd-based approach for supporing KVM v10 and
https://lore.kernel.org/lkml/[email protected]/
- TDX host kernel support v10
https://lore.kernel.org/lkml/[email protected]/
- KVM TDX basic feature support v13
https://lore.kernel.org/[email protected]

The tree can be found at https://github.com/googleprodkernel/linux-cc/tree/copyless
and is based on Intel's tdx tree at https://github.com/intel/tdx/tree/kvm-upstream

In the TDX case, we need to transfer the VM state from multiple sources:

* HKID and encrypted VM state is transfered between the kvm_tdx objects.
* Encrypted and runtime state is transfered between the vcpu_tdx objects.
* The EPT table backing TD's private memory is transfered at the kvm-mmu level. This is needed since the secure EPT table managed by the TD module remains the same after the migration so moving the current private EPT table eliminates the need to rebuild the private EPT table to match the secure EPT table on the destination.
* Information regarding the current shared/private memory is trasfered using the mem_attr_array stored at the kvm object.
* Additional information derived from shared/private memory state is trasfered at the memslot level.

Tested with selftests locally. I will attach the self test in the next version after we send the new TDX selftest framework patches based on KVM TDX basic feature support v13.

Sagi Shahar (5):
KVM: Split tdp_mmu_pages to private and shared lists
KVM: SEV: Refactor common code out of sev_vm_move_enc_context_from
KVM: TDX: Add base implementation for tdx_vm_move_enc_context_from
KVM: TDX: Implement moving private pages between 2 TDs
KVM: TDX: Add core logic for TDX intra-host migration

 arch/x86/include/asm/kvm_host.h |   5 +-
 arch/x86/kvm/mmu.h              |   2 +
 arch/x86/kvm/mmu/mmu.c          |  60 ++++++++
 arch/x86/kvm/mmu/tdp_mmu.c      |  88 +++++++++++-
 arch/x86/kvm/mmu/tdp_mmu.h      |   3 +
 arch/x86/kvm/svm/sev.c          | 175 +++--------------------
 arch/x86/kvm/vmx/main.c         |  10 ++
 arch/x86/kvm/vmx/tdx.c          | 245 ++++++++++++++++++++++++++++++++
 arch/x86/kvm/vmx/tdx.h          |   2 +
 arch/x86/kvm/vmx/x86_ops.h      |   5 +
 arch/x86/kvm/x86.c              | 166 ++++++++++++++++++++++
 arch/x86/kvm/x86.h              |  16 +++
 12 files changed, 613 insertions(+), 164 deletions(-)
Signature · 1 line
2.40.0.348.gf938b09366-goog