Allow a guest to send NMIs to its VCPUs.
authorKeir Fraser <keir@xensource.com>
Mon, 22 Oct 2007 10:11:04 +0000 (11:11 +0100)
committerKeir Fraser <keir@xensource.com>
Mon, 22 Oct 2007 10:11:04 +0000 (11:11 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/compat/domain.c
xen/common/domain.c
xen/include/public/vcpu.h

index a7f2d8ff435bc408ca70486da96c5083924a9cb5..002a8a8362229da656a1d8f54ed4492b95ff0b8f 100644 (file)
@@ -59,6 +59,7 @@ int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
     case VCPUOP_stop_periodic_timer:
     case VCPUOP_set_singleshot_timer:
     case VCPUOP_stop_singleshot_timer:
+    case VCPUOP_send_nmi:
         rc = do_vcpu_op(cmd, vcpuid, arg);
         break;
 
index 55152a3953fe88712110a1b139566f8cdc3f5abb..6c26363c65b5f37057e699c52dede940b0c3475e 100644 (file)
@@ -708,11 +708,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
     }
 
     case VCPUOP_stop_periodic_timer:
-    {
         v->periodic_period = 0;
         vcpu_force_reschedule(v);
         break;
-    }
 
     case VCPUOP_set_singleshot_timer:
     {
@@ -740,13 +738,21 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
     }
 
     case VCPUOP_stop_singleshot_timer:
-    {
         if ( v != current )
             return -EINVAL;
 
         stop_timer(&v->singleshot_timer);
+
+        break;
+
+    case VCPUOP_send_nmi:
+        if ( !guest_handle_is_null(arg) )
+            return -EINVAL;
+
+        if ( !test_and_set_bool(v->nmi_pending) )
+            vcpu_kick(v);
+
         break;
-    }
 
     default:
         rc = arch_do_vcpu_op(cmd, v, arg);
index a84eb51310a51e78f9f58ff7f55aed2d7c9b0c56..4cd4229d915dfd241f85f5ac370ac4ce8f816c7d 100644 (file)
@@ -179,6 +179,9 @@ struct vcpu_register_vcpu_info {
 typedef struct vcpu_register_vcpu_info vcpu_register_vcpu_info_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_register_vcpu_info_t);
 
+/* Send an NMI to the specified VCPU. @extra_arg == NULL. */
+#define VCPUOP_send_nmi             11
+
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 
 /*