KVM: selftests: Add support for protected vm_vaddr_* allocations
authorMichael Roth <michael.roth@amd.com>
Fri, 23 Feb 2024 00:42:52 +0000 (16:42 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 28 Feb 2024 20:58:13 +0000 (20:58 +0000)
commitd210eebb51a23ce45b16c493a51c17b664e81de7
treea880f390b58821af7f9d02443b5fc9f784991367
parentcd8eb2913205e5a13ec807061c8f72d6fee624c7
KVM: selftests: Add support for protected vm_vaddr_* allocations

Test programs may wish to allocate shared vaddrs for things like
sharing memory with the guest. Since protected vms will have their
memory encrypted by default an interface is needed to explicitly
request shared pages.

Implement this by splitting the common code out from vm_vaddr_alloc()
and introducing a new vm_vaddr_alloc_shared().

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Vishal Annapurve <vannapurve@google.com>
Cc: Ackerly Tng <ackerleytng@google.com>
cc: Andrew Jones <andrew.jones@linux.dev>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Reviewed-by: Itaru Kitayama <itaru.kitayama@fujitsu.com>
Tested-by: Carlos Bilbao <carlos.bilbao@amd.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Peter Gonda <pgonda@google.com>
Link: https://lore.kernel.org/r/20240223004258.3104051-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/lib/kvm_util.c