On Mon, Mar 04, 2024, Xu Yilun wrote: > On Mon, Feb 26, 2024 at 02:03:42PM -0500, Paolo Bonzini wrote: > > Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> > > --- > > diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h > > index d0c1b459f7e9..9d950b0b64c9 100644 > > --- a/arch/x86/include/uapi/asm/kvm.h > > +++ b/arch/x86/include/uapi/asm/kvm.h > > @@ -857,5 +857,7 @@ struct kvm_hyperv_eventfd { > > > > #define KVM_X86_DEFAULT_VM 0 > > #define KVM_X86_SW_PROTECTED_VM 1 > > +#define KVM_X86_SEV_VM 2 > > +#define KVM_X86_SEV_ES_VM 3 > > > > #endif /* _ASM_X86_KVM_H */ > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > > index 2549a539a686..1248ccf433e8 100644 > > --- a/arch/x86/kvm/svm/sev.c > > +++ b/arch/x86/kvm/svm/sev.c > > @@ -247,6 +247,9 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) > > if (kvm->created_vcpus) > > return -EINVAL; > > > > + if (kvm->arch.vm_type != KVM_X86_DEFAULT_VM) > > IIUC it should be KVM_X86_SEV_VM? No, this is for the KVM_SEV_INIT version 1, which is restricted to "default" VMs. The idea is that KVM_X86_SEV_VM and KVM_X86_SEV_ES_VM guests must be initialized via KVM_SEV_INIT2.