Re: [RFC PATCH 02/11] KVM: selftests: sev_init2_tests: Derive SEV availability from KVM

From: Tycho Andersen

Date: Fri Jul 17 2026 - 10:52:41 EST


On Thu, Jul 16, 2026 at 10:31:22AM +0100, David Woodhouse wrote:
> From: David Woodhouse <dwmw@xxxxxxxxxxxx>
>
> The test asserted that the X86_FEATURE_SEV CPUID bit exactly matches
> whether KVM offers KVM_X86_SEV_VM. That is not an invariant: when all
> SEV ASIDs are assigned to SEV-SNP, KVM does not offer the SEV VM type
> even though CPUID reports SEV, so the test aborts on an SNP-only host.
>
> Derive SEV availability from KVM_CAP_VM_TYPES (as already done for SEV-ES
> and SNP), assert only the one-way implication that a type offered by KVM
> is also reported in CPUID, and TEST_REQUIRE() the SEV VM type so the test
> skips cleanly when it is unavailable.
>
> Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>

Reviewed-by: Tycho Andersen (AMD) <tycho@xxxxxxxxxx>