Re: [PATCH 2/4] selftests/kvm: check that SEV-ES VMs are allowed in SEV-SNP mode
From: Tycho Andersen
Date: Mon Feb 23 2026 - 11:55:04 EST
Hi Sean,
On Mon, Feb 23, 2026 at 08:36:32AM -0800, Sean Christopherson wrote:
> On Mon, Feb 23, 2026, Tycho Andersen wrote:
> > diff --git a/tools/testing/selftests/kvm/x86/sev_smoke_test.c b/tools/testing/selftests/kvm/x86/sev_smoke_test.c
> > index 86ad1c7d068f..c7fda9fc324b 100644
> > --- a/tools/testing/selftests/kvm/x86/sev_smoke_test.c
> > +++ b/tools/testing/selftests/kvm/x86/sev_smoke_test.c
> > @@ -213,13 +213,48 @@ static void test_sev_smoke(void *guest, uint32_t type, uint64_t policy)
> > }
> > }
> >
> > +static bool sev_es_allowed(void)
> > +{
> > + struct kvm_sev_launch_start launch_start = {
> > + .policy = SEV_POLICY_ES,
> > + };
> > + struct kvm_vcpu *vcpu;
> > + struct kvm_vm *vm;
> > + int firmware_error, ret;
> > + bool supported = true;
> > +
> > + if (!kvm_cpu_has(X86_FEATURE_SEV_ES))
> > + return false;
> > +
> > + if (!kvm_cpu_has(X86_FEATURE_SEV_SNP))
> > + return true;
> > +
> > + /*
> > + * In some cases when SEV-SNP is enabled, firmware disallows starting
> > + * an SEV-ES VM. When SEV-SNP is enabled try to launch an SEV-ES, and
> > + * check the underlying firmware error for this case.
> > + */
> > + vm = vm_sev_create_with_one_vcpu(KVM_X86_SEV_ES_VM, guest_sev_es_code,
> > + &vcpu);
>
> If there's a legimate reason why an SEV-ES VM can't be created, then that needs
> to be explicitly enumerated in some way by the kernel. E.g. is this due to lack
> of ASIDs due to CipherTextHiding or something?
Newer firmware that fixes CVE-2025-48514 won't allow SEV-ES VMs to be
started with SNP enabled, there is a footnote (2) about it here:
https://www.amd.com/en/resources/product-security/bulletin/amd-sb-3023.html
Probably should have included this in the patch, sorry.
> Throwing a noodle to see if it sticks is not an option.
Sure, we could do some firmware version test to see if it's fixed
instead? Or do this same test in the kernel and export that as an
ioctl?
Thanks,
Tycho