diff options
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 57a6055ffb0b..713f78a89595 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -43,6 +43,7 @@ struct vmcs { | |||
43 | struct vcpu_vmx { | 43 | struct vcpu_vmx { |
44 | struct kvm_vcpu vcpu; | 44 | struct kvm_vcpu vcpu; |
45 | int launched; | 45 | int launched; |
46 | u8 fail; | ||
46 | struct kvm_msr_entry *guest_msrs; | 47 | struct kvm_msr_entry *guest_msrs; |
47 | struct kvm_msr_entry *host_msrs; | 48 | struct kvm_msr_entry *host_msrs; |
48 | int nmsrs; | 49 | int nmsrs; |
@@ -2099,6 +2100,14 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) | |||
2099 | { | 2100 | { |
2100 | u32 vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); | 2101 | u32 vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); |
2101 | u32 exit_reason = vmcs_read32(VM_EXIT_REASON); | 2102 | u32 exit_reason = vmcs_read32(VM_EXIT_REASON); |
2103 | struct vcpu_vmx *vmx = to_vmx(vcpu); | ||
2104 | |||
2105 | if (unlikely(vmx->fail)) { | ||
2106 | kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; | ||
2107 | kvm_run->fail_entry.hardware_entry_failure_reason | ||
2108 | = vmcs_read32(VM_INSTRUCTION_ERROR); | ||
2109 | return 0; | ||
2110 | } | ||
2102 | 2111 | ||
2103 | if ( (vectoring_info & VECTORING_INFO_VALID_MASK) && | 2112 | if ( (vectoring_info & VECTORING_INFO_VALID_MASK) && |
2104 | exit_reason != EXIT_REASON_EXCEPTION_NMI ) | 2113 | exit_reason != EXIT_REASON_EXCEPTION_NMI ) |
@@ -2208,7 +2217,6 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu) | |||
2208 | static int vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 2217 | static int vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
2209 | { | 2218 | { |
2210 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 2219 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
2211 | u8 fail; | ||
2212 | int r; | 2220 | int r; |
2213 | 2221 | ||
2214 | if (unlikely(vcpu->mp_state == VCPU_MP_STATE_SIPI_RECEIVED)) { | 2222 | if (unlikely(vcpu->mp_state == VCPU_MP_STATE_SIPI_RECEIVED)) { |
@@ -2352,7 +2360,7 @@ again: | |||
2352 | "pop %%ecx; popa \n\t" | 2360 | "pop %%ecx; popa \n\t" |
2353 | #endif | 2361 | #endif |
2354 | "setbe %0 \n\t" | 2362 | "setbe %0 \n\t" |
2355 | : "=q" (fail) | 2363 | : "=q" (vmx->fail) |
2356 | : "r"(vmx->launched), "d"((unsigned long)HOST_RSP), | 2364 | : "r"(vmx->launched), "d"((unsigned long)HOST_RSP), |
2357 | "c"(vcpu), | 2365 | "c"(vcpu), |
2358 | [rax]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RAX])), | 2366 | [rax]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RAX])), |
@@ -2387,13 +2395,6 @@ again: | |||
2387 | 2395 | ||
2388 | preempt_enable(); | 2396 | preempt_enable(); |
2389 | 2397 | ||
2390 | if (unlikely(fail)) { | ||
2391 | kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; | ||
2392 | kvm_run->fail_entry.hardware_entry_failure_reason | ||
2393 | = vmcs_read32(VM_INSTRUCTION_ERROR); | ||
2394 | r = 0; | ||
2395 | goto out; | ||
2396 | } | ||
2397 | /* | 2398 | /* |
2398 | * Profile KVM exit RIPs: | 2399 | * Profile KVM exit RIPs: |
2399 | */ | 2400 | */ |