On Tue, May 20, 2025 at 02:18:12PM +0800, Binbin Wu wrote: > > > On 4/24/2025 11:08 AM, Yan Zhao wrote: > [...] > > + > > +int tdx_sept_split_private_spt(struct kvm *kvm, gfn_t gfn, enum pg_level level, > > + void *private_spt) > > +{ > > + struct page *page = virt_to_page(private_spt); > > + int ret; > > + > > + if (KVM_BUG_ON(to_kvm_tdx(kvm)->state != TD_STATE_RUNNABLE || level != PG_LEVEL_2M, kvm)) > > + return -EINVAL; > > + > > + ret = tdx_sept_zap_private_spte(kvm, gfn, level, page); > > + if (ret <= 0) > > + return ret; > > + > > + tdx_track(kvm); > > It may worth a helper for the zap and track code. > It's the some code as what in tdx_sept_remove_private_spte(). > So that they can share the code, including the bug check for HKID and the > comments. Not sure if it's worthwhile. But I'm open to it if others also agree. > > > + > > + return tdx_spte_demote_private_spte(kvm, gfn, level, page); > > +} > > + > > > [...]