]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/virt/tdx: KVM: Consolidate TDX CPU hotplug handling
authorChao Gao <chao.gao@intel.com>
Sat, 14 Feb 2026 01:26:59 +0000 (17:26 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 4 Mar 2026 16:53:05 +0000 (08:53 -0800)
commiteac90a5ba0aa40f6d81def241bd78d2a5cc5e08b
tree33545884d5e7794f96ff3777ab6f72c97b11c340
parent9900400e20c0289bf0c82231169c33b43e38c6e8
x86/virt/tdx: KVM: Consolidate TDX CPU hotplug handling

The core kernel registers a CPU hotplug callback to do VMX and TDX init
and deinit while KVM registers a separate CPU offline callback to block
offlining the last online CPU in a socket.

Splitting TDX-related CPU hotplug handling across two components is odd
and adds unnecessary complexity.

Consolidate TDX-related CPU hotplug handling by integrating KVM's
tdx_offline_cpu() to the one in the core kernel.

Also move nr_configured_hkid to the core kernel because tdx_offline_cpu()
references it. Since HKID allocation and free are handled in the core
kernel, it's more natural to track used HKIDs there.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Tested-by: Chao Gao <chao.gao@intel.com>
Tested-by: Sagi Shahar <sagis@google.com>
Link: https://patch.msgid.link/20260214012702.2368778-14-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/tdx.c
arch/x86/virt/vmx/tdx/tdx.c