diff options
| -rw-r--r-- | arch/x86/kvm/cpuid.c | 14 |
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 | |||
| 56 | int kvm_update_cpuid(struct kvm_vcpu *vcpu) | 58 | int 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 | |||
| 232 | static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry, | 232 | static 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 | { |
