[PATCH V5 0/7] KVM: selftests: Add simple SEV test

From: Peter Gonda
Date: Tue Oct 18 2022 - 16:59:03 EST


This patch series continues the work Michael Roth has done in supporting
SEV guests in selftests. It continues on top of the work Sean
Christopherson has sent to support ucalls from SEV guests. Along with a
very simple version of the SEV selftests Michael originally proposed.

V5
* Rebase onto seanjc@'s latest ucall pool series.
* More review changes based on seanjc:
** use protected instead of encrypted outside of SEV specific files
** Swap memcrypt struct for kvm_vm_arch arch specific struct
** Make protected page table data agnostic of address bit stealing specifics
of SEV
** Further clean up for SEV library to just vm_sev_create_one_vcpu()
* Due to large changes moved more authorships from mroth@ to pgonda@. Gave
originally-by tags to mroth@ as suggested by Seanjc for this.

V4
* Rebase ontop of seanjc@'s latest Ucall Pool series:
https://lore.kernel.org/linux-arm-kernel/20220825232522.3997340-8-seanjc@xxxxxxxxxx/
* Fix up review comments from seanjc
* Switch authorship on 2 patches because of significant changes, added
* Michael as suggested-by or originally-by.

V3
* Addressed more of andrew.jones@ in ucall patches.
* Fix build in non-x86 archs.

V2
* Dropped RFC tag
* Correctly separated Sean's ucall patches into 2 as originally
intended.
* Addressed andrew.jones@ in ucall patches.
* Fixed ucall pool usage to work for other archs

V1
* https://lore.kernel.org/all/20220715192956.1873315-1-pgonda@xxxxxxxxxx/

Michael Roth (2):
KVM: selftests: sparsebit: add const where appropriate
KVM: selftests: add support for protected vm_vaddr_* allocations

Peter Gonda (5):
KVM: selftests: add hooks for managing protected guest memory
KVM: selftests: handle protected bits in page tables
KVM: selftests: add library for creating/interacting with SEV guests
KVM: selftests: Update ucall pool to allocate from shared memory
KVM: selftests: Add simple sev vm testing

tools/arch/arm64/include/asm/kvm_host.h | 7 +
tools/arch/riscv/include/asm/kvm_host.h | 7 +
tools/arch/s390/include/asm/kvm_host.h | 7 +
tools/arch/x86/include/asm/kvm_host.h | 15 ++
tools/testing/selftests/kvm/.gitignore | 1 +
tools/testing/selftests/kvm/Makefile | 2 +
.../selftests/kvm/include/kvm_util_base.h | 49 +++-
.../testing/selftests/kvm/include/sparsebit.h | 36 +--
.../selftests/kvm/include/x86_64/sev.h | 22 ++
tools/testing/selftests/kvm/lib/kvm_util.c | 63 ++++-
tools/testing/selftests/kvm/lib/sparsebit.c | 48 ++--
.../testing/selftests/kvm/lib/ucall_common.c | 2 +-
.../selftests/kvm/lib/x86_64/processor.c | 23 +-
tools/testing/selftests/kvm/lib/x86_64/sev.c | 243 ++++++++++++++++++
.../selftests/kvm/x86_64/sev_all_boot_test.c | 84 ++++++
15 files changed, 549 insertions(+), 60 deletions(-)
create mode 100644 tools/arch/arm64/include/asm/kvm_host.h
create mode 100644 tools/arch/riscv/include/asm/kvm_host.h
create mode 100644 tools/arch/s390/include/asm/kvm_host.h
create mode 100644 tools/arch/x86/include/asm/kvm_host.h
create mode 100644 tools/testing/selftests/kvm/include/x86_64/sev.h
create mode 100644 tools/testing/selftests/kvm/lib/x86_64/sev.c
create mode 100644 tools/testing/selftests/kvm/x86_64/sev_all_boot_test.c

--
2.38.0.413.g74048e4d9e-goog