Re: [PATCH v2 3/7] KVM: x86/tdx: Do VMXON and TDX-Module initialization during subsys init

Sean Christopherson
2025-12-08T23:17:27Z

On Sat, Dec 06, 2025, dan.j.williams@intel.com wrote:
> Sean Christopherson wrote:
> Given this routine now has nothing to do...
>
> > + * TDX-specific cpuhp callback to disallow offlining the last CPU in a
> > + * packing while KVM is running one or more TDs. Reclaiming HKIDs
> > + * requires doing PAGE.WBINVD on every package, i.e. offlining all CPUs
> > + * of a package would prevent reclaiming the HKID.
> > */
> > + r = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "kvm/cpu/tdx:online",
> > + tdx_online_cpu, tdx_offline_cpu);
>
> ...the @startup param can be NULL. That also saves some grep pain no
> more multiple implementations of a "tdx_online_cpu".
>
> Along those lines, should tdx_offline_cpu() become
> kvm_tdx_offline_cpu()?
>
> [..]
> > /*
> > * Add a memory region as a TDX memory block. The caller must make sure
> > @@ -1156,67 +1194,50 @@ static int init_tdx_module(void)
> > goto out_put_tdxmem;
> > }
> >
> > -static int __tdx_enable(void)
> > +static int tdx_enable(void)
>
> Almost commented about this being able to be __init now, but then I see
> you have a combo patch for that later.
>
> With or without the additional tdx_{on,off}line_cpu fixups:

I think the fixups you're looking for are in patch 5, "/virt/tdx: KVM: Consolidate
TDX CPU hotplug handling", or did I misunderstand?