> > > > +void sev_init_vmcb(struct vcpu_svm *svm) > > +{ > > + svm->vmcb->control.nested_ctl |= SVM_NESTED_CTL_SEV_ENABLE; > > + clr_exception_intercept(svm, UD_VECTOR); > > I don't love separating SEV and SEV-ES VMCB initialization, especially since they're > both doing RMW operations and not straight writes. E.g. migration ends up reversing > the order between the two relatively to init_vmcb(). That's just asking for a subtle > bug to be introduced that affects only due to the ordering difference. > > What about using common top-level flows for SEV and SEV-ES so that the sequencing > between SEV and SEV-ES is more rigid? The resulting sev_migrate_from() is a little > gross, but IMO it's worth having a fixed sequence, and the flip side to the ugliness > it that it documents some of the differences between SEV and SEV-ES migration. Thanks for the suggestion Sean! I like your suggestion here. I'll test it out, clean it up and send it out as V2. I think the distinction between SEV and SEV-ES migration was largely due to how I split up the set of patches that enabled this feature.