aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/cpuid.h
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2019-12-17 13:32:39 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-21 13:58:27 +0100
commita0a2260c12d8658e522f21ed8ece72bbdede58fd (patch)
tree4e6943b2aea4e0d6eed77c8718186c8ef9dbeb84 /arch/x86/kvm/cpuid.h
parentKVM: x86: Add dedicated emulator helpers for querying CPUID features (diff)
downloadlinux-dev-a0a2260c12d8658e522f21ed8ece72bbdede58fd.tar.xz
linux-dev-a0a2260c12d8658e522f21ed8ece72bbdede58fd.zip
KVM: x86: Move bit() helper to cpuid.h
Move bit() to cpuid.h in preparation for incorporating the reverse_cpuid array in bit() build-time assertions. Opportunistically use the BIT() macro instead of open-coding the shift. No functional change intended. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.h')
-rw-r--r--arch/x86/kvm/cpuid.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index b82ae4d3dc71..f908f76216bf 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -55,6 +55,11 @@ static const struct cpuid_reg reverse_cpuid[] = {
[CPUID_7_EDX] = { 7, 0, CPUID_EDX},
};
+static inline u32 bit(int bitno)
+{
+ return BIT(bitno & 31);
+}
+
static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature)
{
unsigned x86_leaf = x86_feature / 32;