diff options
-rw-r--r-- | arch/x86/kvm/vmx.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 238c59b73144..7cc566b09ff2 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -6436,7 +6436,7 @@ static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx) | |||
6436 | ktime_to_ns(ktime_sub(ktime_get(), vmx->entry_time)); | 6436 | ktime_to_ns(ktime_sub(ktime_get(), vmx->entry_time)); |
6437 | } | 6437 | } |
6438 | 6438 | ||
6439 | static void __vmx_complete_interrupts(struct vcpu_vmx *vmx, | 6439 | static void __vmx_complete_interrupts(struct kvm_vcpu *vcpu, |
6440 | u32 idt_vectoring_info, | 6440 | u32 idt_vectoring_info, |
6441 | int instr_len_field, | 6441 | int instr_len_field, |
6442 | int error_code_field) | 6442 | int error_code_field) |
@@ -6447,46 +6447,43 @@ static void __vmx_complete_interrupts(struct vcpu_vmx *vmx, | |||
6447 | 6447 | ||
6448 | idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; | 6448 | idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; |
6449 | 6449 | ||
6450 | vmx->vcpu.arch.nmi_injected = false; | 6450 | vcpu->arch.nmi_injected = false; |
6451 | kvm_clear_exception_queue(&vmx->vcpu); | 6451 | kvm_clear_exception_queue(vcpu); |
6452 | kvm_clear_interrupt_queue(&vmx->vcpu); | 6452 | kvm_clear_interrupt_queue(vcpu); |
6453 | 6453 | ||
6454 | if (!idtv_info_valid) | 6454 | if (!idtv_info_valid) |
6455 | return; | 6455 | return; |
6456 | 6456 | ||
6457 | kvm_make_request(KVM_REQ_EVENT, &vmx->vcpu); | 6457 | kvm_make_request(KVM_REQ_EVENT, vcpu); |
6458 | 6458 | ||
6459 | vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK; | 6459 | vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK; |
6460 | type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK; | 6460 | type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK; |
6461 | 6461 | ||
6462 | switch (type) { | 6462 | switch (type) { |
6463 | case INTR_TYPE_NMI_INTR: | 6463 | case INTR_TYPE_NMI_INTR: |
6464 | vmx->vcpu.arch.nmi_injected = true; | 6464 | vcpu->arch.nmi_injected = true; |
6465 | /* | 6465 | /* |
6466 | * SDM 3: 27.7.1.2 (September 2008) | 6466 | * SDM 3: 27.7.1.2 (September 2008) |
6467 | * Clear bit "block by NMI" before VM entry if a NMI | 6467 | * Clear bit "block by NMI" before VM entry if a NMI |
6468 | * delivery faulted. | 6468 | * delivery faulted. |
6469 | */ | 6469 | */ |
6470 | vmx_set_nmi_mask(&vmx->vcpu, false); | 6470 | vmx_set_nmi_mask(vcpu, false); |
6471 | break; | 6471 | break; |
6472 | case INTR_TYPE_SOFT_EXCEPTION: | 6472 | case INTR_TYPE_SOFT_EXCEPTION: |
6473 | vmx->vcpu.arch.event_exit_inst_len = | 6473 | vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field); |
6474 | vmcs_read32(instr_len_field); | ||
6475 | /* fall through */ | 6474 | /* fall through */ |
6476 | case INTR_TYPE_HARD_EXCEPTION: | 6475 | case INTR_TYPE_HARD_EXCEPTION: |
6477 | if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) { | 6476 | if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) { |
6478 | u32 err = vmcs_read32(error_code_field); | 6477 | u32 err = vmcs_read32(error_code_field); |
6479 | kvm_queue_exception_e(&vmx->vcpu, vector, err); | 6478 | kvm_queue_exception_e(vcpu, vector, err); |
6480 | } else | 6479 | } else |
6481 | kvm_queue_exception(&vmx->vcpu, vector); | 6480 | kvm_queue_exception(vcpu, vector); |
6482 | break; | 6481 | break; |
6483 | case INTR_TYPE_SOFT_INTR: | 6482 | case INTR_TYPE_SOFT_INTR: |
6484 | vmx->vcpu.arch.event_exit_inst_len = | 6483 | vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field); |
6485 | vmcs_read32(instr_len_field); | ||
6486 | /* fall through */ | 6484 | /* fall through */ |
6487 | case INTR_TYPE_EXT_INTR: | 6485 | case INTR_TYPE_EXT_INTR: |
6488 | kvm_queue_interrupt(&vmx->vcpu, vector, | 6486 | kvm_queue_interrupt(vcpu, vector, type == INTR_TYPE_SOFT_INTR); |
6489 | type == INTR_TYPE_SOFT_INTR); | ||
6490 | break; | 6487 | break; |
6491 | default: | 6488 | default: |
6492 | break; | 6489 | break; |
@@ -6497,7 +6494,7 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx) | |||
6497 | { | 6494 | { |
6498 | if (is_guest_mode(&vmx->vcpu)) | 6495 | if (is_guest_mode(&vmx->vcpu)) |
6499 | return; | 6496 | return; |
6500 | __vmx_complete_interrupts(vmx, vmx->idt_vectoring_info, | 6497 | __vmx_complete_interrupts(&vmx->vcpu, vmx->idt_vectoring_info, |
6501 | VM_EXIT_INSTRUCTION_LEN, | 6498 | VM_EXIT_INSTRUCTION_LEN, |
6502 | IDT_VECTORING_ERROR_CODE); | 6499 | IDT_VECTORING_ERROR_CODE); |
6503 | } | 6500 | } |
@@ -6506,7 +6503,7 @@ static void vmx_cancel_injection(struct kvm_vcpu *vcpu) | |||
6506 | { | 6503 | { |
6507 | if (is_guest_mode(vcpu)) | 6504 | if (is_guest_mode(vcpu)) |
6508 | return; | 6505 | return; |
6509 | __vmx_complete_interrupts(to_vmx(vcpu), | 6506 | __vmx_complete_interrupts(vcpu, |
6510 | vmcs_read32(VM_ENTRY_INTR_INFO_FIELD), | 6507 | vmcs_read32(VM_ENTRY_INTR_INFO_FIELD), |
6511 | VM_ENTRY_INSTRUCTION_LEN, | 6508 | VM_ENTRY_INSTRUCTION_LEN, |
6512 | VM_ENTRY_EXCEPTION_ERROR_CODE); | 6509 | VM_ENTRY_EXCEPTION_ERROR_CODE); |