KVM: selftests: Rework dynamic XFeature helper to take mask, not bit
authorSean Christopherson <seanjc@google.com>
Wed, 5 Apr 2023 00:45:18 +0000 (17:45 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 11 Apr 2023 17:19:03 +0000 (10:19 -0700)
commit7040e54fddf681758800d7375e728557213366f9
tree4e9b739e71468c3733ce9300c08089b5de006ec6
parentb213812d3f4c29502d46f82e40a82cf959670e58
KVM: selftests: Rework dynamic XFeature helper to take mask, not bit

Take the XFeature mask in __vm_xsave_require_permission() instead of the
bit so that there's no need to define macros for both the bit and the
mask.  Asserting that only a single bit is set and retrieving said bit
is easy enough via log2 helpers.

Opportunistically clean up the error message for the
ARCH_REQ_XCOMP_GUEST_PERM sanity check.

Reviewed-by: Aaron Lewis <aaronlewis@google.com>
Tested-by: Aaron Lewis <aaronlewis@google.com>
Link: https://lore.kernel.org/r/20230405004520.421768-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/lib/x86_64/processor.c
tools/testing/selftests/kvm/x86_64/amx_test.c