]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: TDX: Drop kvm_x86_ops.remove_external_spte()
authorSean Christopherson <seanjc@google.com>
Sat, 9 May 2026 07:57:09 +0000 (15:57 +0800)
committerSean Christopherson <seanjc@google.com>
Thu, 28 May 2026 00:19:20 +0000 (17:19 -0700)
commit6eae9ce9461cc0ba16a779b49a70eaab2271a969
tree6fbec5d9e6aaa898dca871b24a669f3095cdbb3a
parentc74893aa56f4e7515c0877c5230f9f42357ff044
KVM: TDX: Drop kvm_x86_ops.remove_external_spte()

Drop kvm_x86_ops.remove_external_spte(), and instead handle the removal of
leaf SPTEs in the S-EPT (a.k.a. external page table) in
kvm_x86_ops.set_external_spte(). This will also allow extending
tdx_sept_set_private_spte() to support splitting a huge S-EPT entry without
needing yet another kvm_x86_ops hook.

Now all changes for removing leaf mirror SPTEs are propagated through
kvm_x86_ops.set_external_spte().
- When removing leaf mirror SPTEs under shared mmu_lock (though currently
  no path can trigger this scenario and TDX does not support this
  scenario), tdx_sept_remove_private_spte() may produce a warning due to
  lockdep_assert_held_write() or may return -EIO and trigger TDX_BUG_ON()
  due to concurrent BLOCK, TRACK, REMOVE.
- When removing leaf mirror SPTEs under exclusive mmu_lock, all errors are
  unexpected. If any error occurs in this scenario,
  tdx_sept_remove_private_spte() will return -EIO and trigger KVM_BUG_ON().
  A redundant KVM_BUG_ON() call will also be triggered in TDP MMU core in
  handle_changed_spte(), which is benign (the WARN will fire if and only if
  the VM isn't already bugged).

Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Link: https://patch.msgid.link/20260509075709.4322-1-yan.y.zhao@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm-x86-ops.h
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu/tdp_mmu.c
arch/x86/kvm/vmx/tdx.c