From: Jan Kiszka Date: Mon, 7 Feb 2011 11:19:21 +0000 (+0100) Subject: kvm: x86: Catch and report failing IRQ and NMI injections X-Git-Tag: TizenStudio_2.0_p2.3~3372^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a3098b3f61a867b5976fc83e9cf0e1fb7bcae16;p=sdk%2Femulator%2Fqemu.git kvm: x86: Catch and report failing IRQ and NMI injections We do not need to abort, but the user should be notified that weird things go on. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 8668cb3..0aa0a41 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -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()) { @@ -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)); + } } }