Re: [PATCH v2 05/10] KVM: SVM: Require AP's "requested" SEV_FEATURES to match KVM's view

From: Sean Christopherson
Date: Thu Feb 27 2025 - 10:44:28 EST


On Thu, Feb 27, 2025, Pankaj Gupta wrote:
>
> > > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> > > > index 9aad0dae3a80..bad5834ec143 100644
> > > > --- a/arch/x86/kvm/svm/sev.c
> > > > +++ b/arch/x86/kvm/svm/sev.c
> > > > @@ -3932,6 +3932,7 @@ void sev_snp_init_protected_guest_state(struct kvm_vcpu *vcpu)
> > > > static int sev_snp_ap_creation(struct vcpu_svm *svm)
> > > > {
> > > > + struct kvm_sev_info *sev = to_kvm_sev_info(svm->vcpu.kvm);
> > > > struct kvm_vcpu *vcpu = &svm->vcpu;
> > > > struct kvm_vcpu *target_vcpu;
> > > > struct vcpu_svm *target_svm;
> > > > @@ -3963,26 +3964,18 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
> > > > mutex_lock(&target_svm->sev_es.snp_vmsa_mutex);
> > > > - /* Interrupt injection mode shouldn't change for AP creation */
> > > > - if (request < SVM_VMGEXIT_AP_DESTROY) {
> > > > - u64 sev_features;
> > > > -
> > > > - sev_features = vcpu->arch.regs[VCPU_REGS_RAX];
> > > > - sev_features ^= to_kvm_sev_info(svm->vcpu.kvm)->vmsa_features;
> > > > -
> > > > - if (sev_features & SVM_SEV_FEAT_INT_INJ_MODES) {
> > >
> > > 'SVM_SEV_FEAT_INT_INJ_MODES' would even be required in any future use-case,
> > > maybe?
> >
> > Can you elaborate? I don't quite follow what you're suggesting.
>
> SVM_SEV_FEAT_INT_INJ_MODES macro is not used anymore? If there is no plan to
> use it, maybe we can remove that as well?

Ah, gotcha. I didn't realize it was a compound macro. Yeah, unless someone
objects, I'll remove it when applying.