From 9c23ed56d7979ae9e20cff8d0fa01b750427036d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 15 Sep 2017 17:16:37 +0100 Subject: [PATCH] xen: Provide XEN_DMOP_remote_shutdown 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 CC: Andrew Cooper CC: George Dunlap CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu Reviewed-by: Jan Beulich Reviewed-by: Wei Liu Signed-off-by: Ian Jackson --- xen/arch/x86/hvm/dm.c | 10 ++++++++++ xen/include/public/hvm/dm_op.h | 12 ++++++++++++ xen/include/xlat.lst | 1 + 3 files changed, 23 insertions(+) diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c index 9cf53b551c..acabde1b58 100644 --- a/xen/arch/x86/hvm/dm.c +++ b/xen/arch/x86/hvm/dm.c @@ -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, diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h index 6bbab5fca3..e17308575a 100644 --- a/xen/include/public/hvm/dm_op.h +++ b/xen/include/public/hvm/dm_op.h @@ -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; }; diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst index 0f17000ea7..4346cbedcf 100644 --- a/xen/include/xlat.lst +++ b/xen/include/xlat.lst @@ -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 -- 2.30.2