aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2010-12-10 15:42:53 +0800
committerMarcelo Tosatti <mtosatti@redhat.com>2011-01-21 14:05:21 -0200
commit276ce81563aeadea5493fbc4fbc84647d5bfbdeb (patch)
tree0cc89a6301f26ea0bf297fcd9b05e84c05bf8cff /target-i386
parentb646968336d4180bdd7d2e24209708dcee6ba400 (diff)
kvm: Enable user space NMI injection for kvm guest
Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space raised them. (example: qemu monitor's "nmi" command) Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/kvm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 7dfc357e42..755f8c9089 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1417,6 +1417,13 @@ int kvm_arch_get_registers(CPUState *env)
int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
{
+ /* 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);
+ }
+
/* Try to inject an interrupt if the guest can accept it */
if (run->ready_for_interrupt_injection &&
(env->interrupt_request & CPU_INTERRUPT_HARD) &&