OSDN Git Service

KVM: selftests: Add X86_PROPERTY_* framework to retrieve CPUID values
authorSean Christopherson <seanjc@google.com>
Thu, 6 Oct 2022 00:51:16 +0000 (00:51 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 17 Nov 2022 00:59:03 +0000 (16:59 -0800)
commit53a7dc0f215ec91b098e3e6d7bb4bb9cef43a99a
tree9b1e180d6364acf35eb5c9a5814fd8ad61a0322b
parentee3795536664e514196cbe7396d3eb4c9925de98
KVM: selftests: Add X86_PROPERTY_* framework to retrieve CPUID values

Introduce X86_PROPERTY_* to allow retrieving values/properties from CPUID
leafs, e.g. MAXPHYADDR from CPUID.0x80000008.  Use the same core code as
X86_FEATURE_*, the primary difference is that properties are multi-bit
values, whereas features enumerate a single bit.

Add this_cpu_has_p() to allow querying whether or not a property exists
based on the maximum leaf associated with the property, e.g. MAXPHYADDR
doesn't exist if the max leaf for 0x8000_xxxx is less than 0x8000_0008.

Use the new property infrastructure in vm_compute_max_gfn() to prove
that the code works as intended.  Future patches will convert additional
selftests code.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221006005125.680782-4-seanjc@google.com
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/lib/x86_64/processor.c