int kvm_arch_pre_run(CPUState *env, struct kvm_run *run) { int r; unsigned irq; /* PowerPC Qemu tracks the various core input pins (interrupt, critical * interrupt, reset, etc) in PPC-specific env->irq_input_state. */ if (run->ready_for_interrupt_injection && (env->interrupt_request & CPU_INTERRUPT_HARD) && (env->irq_input_state & (1<<PPC_INPUT_INT))) { /* For now KVM disregards the 'irq' argument. However, in the * future KVM could cache it in-kernel to avoid a heavyweight exit * when reading the UIC. */ irq = -1U; dprintf("injected interrupt %d\n", irq); r = kvm_vcpu_ioctl(env, KVM_INTERRUPT, &irq); if (r < 0) printf("cpu %d fail inject %x\n", env->cpu_index, irq); /* We don't know if there are more interrupts pending after this. However, * the guest will return to userspace in the course of handling this one * anyways, so we will get a chance to deliver the rest. */ return 0;