Skip to content

Commit

Permalink
kvm: x86: Catch and report failing IRQ and NMI injections
Browse files Browse the repository at this point in the history
We do not need to abort, but the user should be notified that weird
things go on.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
  • Loading branch information
jan-kiszka authored and matosatti committed Feb 14, 2011
1 parent 7a39fe5 commit ce377af
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions target-i386/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,11 +1442,17 @@ int kvm_arch_get_registers(CPUState *env)

void kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
{
int ret;

/* Inject NMI */
if (env->interrupt_request & CPU_INTERRUPT_NMI) {
env->interrupt_request &= ~CPU_INTERRUPT_NMI;
DPRINTF("injected NMI\n");
kvm_vcpu_ioctl(env, KVM_NMI);
ret = kvm_vcpu_ioctl(env, KVM_NMI);
if (ret < 0) {
fprintf(stderr, "KVM: injection failed, NMI lost (%s)\n",
strerror(-ret));
}
}

if (!kvm_irqchip_in_kernel()) {
Expand All @@ -1467,9 +1473,13 @@ void kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
struct kvm_interrupt intr;

intr.irq = irq;
/* FIXME: errors */
DPRINTF("injected interrupt %d\n", irq);
kvm_vcpu_ioctl(env, KVM_INTERRUPT, &intr);
ret = kvm_vcpu_ioctl(env, KVM_INTERRUPT, &intr);
if (ret < 0) {
fprintf(stderr,
"KVM: injection failed, interrupt lost (%s)\n",
strerror(-ret));
}
}
}

Expand Down

0 comments on commit ce377af

Please sign in to comment.