xen: Provide XEN_DMOP_remote_shutdown
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 15 Sep 2017 16:16:37 +0000 (17:16 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 11 Oct 2017 11:51:22 +0000 (12:51 +0100)
SCHEDOP_remote_shutdown should be a DMOP so that a deprivileged qemu
can do the propery tidying up.

We need to keep SCHEDOP_remote_shutdown for ABI stability reasons and
because it is needed for PV guests.

CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Tim Deegan <tim@xen.org>
CC: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
xen/arch/x86/hvm/dm.c
xen/include/public/hvm/dm_op.h
xen/include/xlat.lst

index 9cf53b551c7db8b3135cd17b98e742e5d9e4e604..acabde1b58f7209fc08e4f553a1c9ed3d347589c 100644 (file)
@@ -629,6 +629,15 @@ static int dm_op(const struct dmop_args *op_args)
         break;
     }
 
+    case XEN_DMOP_remote_shutdown:
+    {
+        const struct xen_dm_op_remote_shutdown *data =
+            &op.u.remote_shutdown;
+
+        domain_shutdown(d, data->reason);
+        break;
+    }
+
     default:
         rc = -EOPNOTSUPP;
         break;
@@ -657,6 +666,7 @@ CHECK_dm_op_modified_memory;
 CHECK_dm_op_set_mem_type;
 CHECK_dm_op_inject_event;
 CHECK_dm_op_inject_msi;
+CHECK_dm_op_remote_shutdown;
 
 int compat_dm_op(domid_t domid,
                  unsigned int nr_bufs,
index 6bbab5fca38f875f230e7d7f41effb5085c53456..e17308575a67fd903b4c69963b11b3d39602eb4f 100644 (file)
@@ -357,6 +357,17 @@ struct xen_dm_op_map_mem_type_to_ioreq_server {
                            has to be set to zero by the caller */
 };
 
+/*
+ * XEN_DMOP_remote_shutdown : Declare a shutdown for another domain
+ *                            Identical to SCHEDOP_remote_shutdown
+ */
+#define XEN_DMOP_remote_shutdown 16
+
+struct xen_dm_op_remote_shutdown {
+    uint32_t reason;       /* SHUTDOWN_* => enum sched_shutdown_reason */
+                           /* (Other reason values are not blocked) */
+};
+
 struct xen_dm_op {
     uint32_t op;
     uint32_t pad;
@@ -377,6 +388,7 @@ struct xen_dm_op {
         struct xen_dm_op_inject_msi inject_msi;
         struct xen_dm_op_map_mem_type_to_ioreq_server
                 map_mem_type_to_ioreq_server;
+        struct xen_dm_op_remote_shutdown remote_shutdown;
     } u;
 };
 
index 0f17000ea7f28d822494b5009aca4e387952852c..4346cbedcf2bd121d4010ad7847147203994292e 100644 (file)
@@ -64,6 +64,7 @@
 ?      dm_op_inject_msi                hvm/dm_op.h
 ?      dm_op_ioreq_server_range        hvm/dm_op.h
 ?      dm_op_modified_memory           hvm/dm_op.h
+?      dm_op_remote_shutdown           hvm/dm_op.h
 ?      dm_op_set_ioreq_server_state    hvm/dm_op.h
 ?      dm_op_set_isa_irq_level         hvm/dm_op.h
 ?      dm_op_set_mem_type              hvm/dm_op.h