Skip to content

Commit ae0bb3e

Browse files
Gleb Natapovavikivity
authored andcommitted
KVM: VMX: Properly handle software interrupt re-injection in real mode
When reinjecting a software interrupt or exception, use the correct instruction length provided by the hardware instead of a hardcoded 1. Fixes problems running the suse 9.1 livecd boot loader. Problem introduced by commit f0a3602c20 ("KVM: Move interrupt injection logic to x86.c"). Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent 74fca6a commit ae0bb3e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/x86/kvm/vmx.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,9 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
801801
vmx->rmode.irq.pending = true;
802802
vmx->rmode.irq.vector = nr;
803803
vmx->rmode.irq.rip = kvm_rip_read(vcpu);
804-
if (nr == BP_VECTOR || nr == OF_VECTOR)
805-
vmx->rmode.irq.rip++;
804+
if (kvm_exception_is_soft(nr))
805+
vmx->rmode.irq.rip +=
806+
vmx->vcpu.arch.event_exit_inst_len;
806807
intr_info |= INTR_TYPE_SOFT_INTR;
807808
vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, intr_info);
808809
vmcs_write32(VM_ENTRY_INSTRUCTION_LEN, 1);
@@ -2468,6 +2469,9 @@ static void vmx_inject_irq(struct kvm_vcpu *vcpu)
24682469
vmx->rmode.irq.pending = true;
24692470
vmx->rmode.irq.vector = irq;
24702471
vmx->rmode.irq.rip = kvm_rip_read(vcpu);
2472+
if (vcpu->arch.interrupt.soft)
2473+
vmx->rmode.irq.rip +=
2474+
vmx->vcpu.arch.event_exit_inst_len;
24712475
vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
24722476
irq | INTR_TYPE_SOFT_INTR | INTR_INFO_VALID_MASK);
24732477
vmcs_write32(VM_ENTRY_INSTRUCTION_LEN, 1);

0 commit comments

Comments
 (0)