KVM: selftests: Add a basic SEV-ES smoke test
authorSean Christopherson <seanjc@google.com>
Fri, 23 Feb 2024 00:42:58 +0000 (16:42 -0800)
committerSean Christopherson <seanjc@google.com>
Thu, 29 Feb 2024 00:39:55 +0000 (16:39 -0800)
commit40e09b3ccfacc640d58e1e3d6b8f29b2db0a9848
tree291aa24964376b96138284b9497cb9d69f80fbdf
parentbe250ff437fa260550113a361ff0b31ccd34e9e5
KVM: selftests: Add a basic SEV-ES smoke test

Extend sev_smoke_test to also run a minimal SEV-ES smoke test so that it's
possible to test KVM's unique VMRUN=>#VMEXIT path for SEV-ES guests
without needing a full blown SEV-ES capable VM, which requires a rather
absurd amount of properly configured collateral.

Punt on proper GHCB and ucall support, and instead use the GHCB MSR
protocol to signal test completion.  The most important thing at this
point is to have _any_ kind of testing of KVM's __svm_sev_es_vcpu_run().

Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Cc: Peter Gonda <pgonda@google.com>
Cc: Carlos Bilbao <carlos.bilbao@amd.com>
Tested-by: Carlos Bilbao <carlos.bilbao@amd.com>
Link: https://lore.kernel.org/r/20240223004258.3104051-12-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/x86_64/sev.h
tools/testing/selftests/kvm/lib/x86_64/processor.c
tools/testing/selftests/kvm/lib/x86_64/sev.c
tools/testing/selftests/kvm/x86_64/sev_smoke_test.c