aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/x86/kvm/cpuid.h
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2020-03-02 15:56:32 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-16 17:58:16 +0100
commite745e37d49771b8a06955f18c7a435830c0a4a5c (patch)
tree05b7ffb83d000bbc2ff488a7a40533b5023d4320 /arch/x86/kvm/cpuid.h
parentKVM: x86: Introduce cpuid_entry_{change,set,clear}() mutators (diff)
downloadwireguard-linux-e745e37d49771b8a06955f18c7a435830c0a4a5c.tar.xz
wireguard-linux-e745e37d49771b8a06955f18c7a435830c0a4a5c.zip
KVM: x86: Refactor cpuid_mask() to auto-retrieve the register
Use the recently introduced cpuid_entry_get_reg() to automatically get the appropriate register when masking a CPUID entry. No functional change intended. Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> 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.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index de3c6c365a5a..407dc26c0633 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -167,6 +167,14 @@ static __always_inline void cpuid_entry_change(struct kvm_cpuid_entry2 *entry,
*reg &= ~__feature_bit(x86_feature);
}
+static __always_inline void cpuid_entry_mask(struct kvm_cpuid_entry2 *entry,
+ enum cpuid_leafs leaf)
+{
+ u32 *reg = cpuid_entry_get_reg(entry, leaf * 32);
+
+ *reg &= boot_cpu_data.x86_capability[leaf];
+}
+
static __always_inline u32 *guest_cpuid_get_register(struct kvm_vcpu *vcpu,
unsigned int x86_feature)
{