diff options
-rw-r--r-- | arch/x86/kvm/x86.c | 11 | ||||
-rw-r--r-- | include/asm-x86/kvm_host.h | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6b01552bd1f1..ec9265b354b0 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -41,7 +41,7 @@ | |||
41 | | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) | 41 | | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) |
42 | 42 | ||
43 | #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) | 43 | #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) |
44 | #define EFER_RESERVED_BITS 0xfffffffffffff2fe | 44 | static u64 __read_mostly efer_reserved_bits = 0xfffffffffffff2fe; |
45 | 45 | ||
46 | #define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM | 46 | #define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM |
47 | #define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU | 47 | #define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU |
@@ -428,7 +428,7 @@ static u32 emulated_msrs[] = { | |||
428 | 428 | ||
429 | static void set_efer(struct kvm_vcpu *vcpu, u64 efer) | 429 | static void set_efer(struct kvm_vcpu *vcpu, u64 efer) |
430 | { | 430 | { |
431 | if (efer & EFER_RESERVED_BITS) { | 431 | if (efer & efer_reserved_bits) { |
432 | printk(KERN_DEBUG "set_efer: 0x%llx #GP, reserved bits\n", | 432 | printk(KERN_DEBUG "set_efer: 0x%llx #GP, reserved bits\n", |
433 | efer); | 433 | efer); |
434 | kvm_inject_gp(vcpu, 0); | 434 | kvm_inject_gp(vcpu, 0); |
@@ -452,6 +452,13 @@ static void set_efer(struct kvm_vcpu *vcpu, u64 efer) | |||
452 | 452 | ||
453 | #endif | 453 | #endif |
454 | 454 | ||
455 | void kvm_enable_efer_bits(u64 mask) | ||
456 | { | ||
457 | efer_reserved_bits &= ~mask; | ||
458 | } | ||
459 | EXPORT_SYMBOL_GPL(kvm_enable_efer_bits); | ||
460 | |||
461 | |||
455 | /* | 462 | /* |
456 | * Writes msr value into into the appropriate "register". | 463 | * Writes msr value into into the appropriate "register". |
457 | * Returns 0 on success, non-0 otherwise. | 464 | * Returns 0 on success, non-0 otherwise. |
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h index 28e8177ea4a0..274f153c8704 100644 --- a/include/asm-x86/kvm_host.h +++ b/include/asm-x86/kvm_host.h | |||
@@ -430,6 +430,7 @@ void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw, | |||
430 | unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr); | 430 | unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr); |
431 | void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long value, | 431 | void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long value, |
432 | unsigned long *rflags); | 432 | unsigned long *rflags); |
433 | void kvm_enable_efer_bits(u64); | ||
433 | int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data); | 434 | int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data); |
434 | int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); | 435 | int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); |
435 | 436 | ||