aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-12-03 08:34:47 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2014-12-05 07:57:15 -0500
commit5c404cabd1b5c125653ac573cb9284bdf42b658a (patch)
tree772a563c5308cbb5ce03d8eb2637032521ee4a05 /arch/x86/kvm
parentdf1daba7d1cb8ed7957f873cde5c9e953cbaa483 (diff)
KVM: x86: use F() macro throughout cpuid.c
For code that deals with cpuid, this makes things a bit more readable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/cpuid.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index a4f5ac46226c..11f09a2b31a0 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -53,6 +53,8 @@ u64 kvm_supported_xcr0(void)
53 return xcr0; 53 return xcr0;
54} 54}
55 55
56#define F(x) bit(X86_FEATURE_##x)
57
56int kvm_update_cpuid(struct kvm_vcpu *vcpu) 58int kvm_update_cpuid(struct kvm_vcpu *vcpu)
57{ 59{
58 struct kvm_cpuid_entry2 *best; 60 struct kvm_cpuid_entry2 *best;
@@ -64,13 +66,13 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)
64 66
65 /* Update OSXSAVE bit */ 67 /* Update OSXSAVE bit */
66 if (cpu_has_xsave && best->function == 0x1) { 68 if (cpu_has_xsave && best->function == 0x1) {
67 best->ecx &= ~(bit(X86_FEATURE_OSXSAVE)); 69 best->ecx &= ~F(OSXSAVE);
68 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE)) 70 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE))
69 best->ecx |= bit(X86_FEATURE_OSXSAVE); 71 best->ecx |= F(OSXSAVE);
70 } 72 }
71 73
72 if (apic) { 74 if (apic) {
73 if (best->ecx & bit(X86_FEATURE_TSC_DEADLINE_TIMER)) 75 if (best->ecx & F(TSC_DEADLINE_TIMER))
74 apic->lapic_timer.timer_mode_mask = 3 << 17; 76 apic->lapic_timer.timer_mode_mask = 3 << 17;
75 else 77 else
76 apic->lapic_timer.timer_mode_mask = 1 << 17; 78 apic->lapic_timer.timer_mode_mask = 1 << 17;
@@ -122,8 +124,8 @@ static void cpuid_fix_nx_cap(struct kvm_vcpu *vcpu)
122 break; 124 break;
123 } 125 }
124 } 126 }
125 if (entry && (entry->edx & bit(X86_FEATURE_NX)) && !is_efer_nx()) { 127 if (entry && (entry->edx & F(NX)) && !is_efer_nx()) {
126 entry->edx &= ~bit(X86_FEATURE_NX); 128 entry->edx &= ~F(NX);
127 printk(KERN_INFO "kvm: guest NX capability removed\n"); 129 printk(KERN_INFO "kvm: guest NX capability removed\n");
128 } 130 }
129} 131}
@@ -227,8 +229,6 @@ static void do_cpuid_1_ent(struct kvm_cpuid_entry2 *entry, u32 function,
227 entry->flags = 0; 229 entry->flags = 0;
228} 230}
229 231
230#define F(x) bit(X86_FEATURE_##x)
231
232static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry, 232static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry,
233 u32 func, u32 index, int *nent, int maxnent) 233 u32 func, u32 index, int *nent, int maxnent)
234{ 234{