KVM: selftests: Require KVM_CAP_USER_MEMORY2 for tests that create memslots
authorSean Christopherson <seanjc@google.com>
Tue, 30 Apr 2024 16:21:33 +0000 (09:21 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 2 May 2024 23:12:28 +0000 (16:12 -0700)
commit8a53e13021330a25775a31ced44fbec2225a9443
tree570a1e71b188854a3204ed126d16cab651f0f091
parent20ecf595b513b4ee69220794c3317380c4f051b1
KVM: selftests: Require KVM_CAP_USER_MEMORY2 for tests that create memslots

Explicitly require KVM_CAP_USER_MEMORY2 for selftests that create memslots,
i.e. skip selftests that need memslots instead of letting them fail on
KVM_SET_USER_MEMORY_REGION2.  While it's ok to take a dependency on new
kernel features, selftests should skip gracefully instead of failing hard
when run on older kernels.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/69ae0694-8ca3-402c-b864-99b500b24f5d@moroto.mountain
Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240430162133.337541-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/lib/kvm_util.c