On Thu, Mar 06, 2025, Paolo Bonzini wrote: > I agree with Xiaoyao that this change is sensible but should be proposed > separately for both SNP and TDX. > > Allowing the use of kvm_load_host_xsave_state() is really ugly, especially > since the corresponding code is so simple: > > if (cpu_feature_enabled(X86_FEATURE_PKU) && vcpu->arch.pkru != 0) > wrpkru(vcpu->arch.host_pkru); It's clearly not "so simple", because this code is buggy. The justification for using kvm_load_host_xsave_state() is that either KVM gets the TDX state model correct and the existing flows Just Work, or we handle all that state as one-offs and at best replicate concepts and flows, and at worst have bugs that are unique to TDX, e.g. because we get the "simple" code wrong, we miss flows that subtly consume state, etc.