diff options
author | David Woodhouse <dwmw@amazon.co.uk> | 2022-12-14 19:36:15 +0000 |
---|---|---|
committer | David Woodhouse <dwmw@amazon.co.uk> | 2023-03-01 08:22:50 +0000 |
commit | a15b10978fe62411936e577288f28184a41754a9 (patch) | |
tree | d82c63191d9f43db47ca708fcddbb3f7712c46d5 /hw/i386/kvm | |
parent | 306670461bb19e7af42b3d68d007d7690efd2334 (diff) | |
download | qemu-a15b10978fe62411936e577288f28184a41754a9.zip qemu-a15b10978fe62411936e577288f28184a41754a9.tar.gz qemu-a15b10978fe62411936e577288f28184a41754a9.tar.bz2 |
hw/xen: Implement EVTCHNOP_reset
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Diffstat (limited to 'hw/i386/kvm')
-rw-r--r-- | hw/i386/kvm/xen_evtchn.c | 30 | ||||
-rw-r--r-- | hw/i386/kvm/xen_evtchn.h | 3 |
2 files changed, 33 insertions, 0 deletions
diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index cbaf4f5..c804a31 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu/host-utils.h" #include "qemu/module.h" +#include "qemu/lockable.h" #include "qemu/main-loop.h" #include "qemu/log.h" #include "qapi/error.h" @@ -747,6 +748,35 @@ static int close_port(XenEvtchnState *s, evtchn_port_t port) return 0; } +int xen_evtchn_soft_reset(void) +{ + XenEvtchnState *s = xen_evtchn_singleton; + int i; + + if (!s) { + return -ENOTSUP; + } + + assert(qemu_mutex_iothread_locked()); + + QEMU_LOCK_GUARD(&s->port_lock); + + for (i = 0; i < s->nr_ports; i++) { + close_port(s, i); + } + + return 0; +} + +int xen_evtchn_reset_op(struct evtchn_reset *reset) +{ + if (reset->dom != DOMID_SELF && reset->dom != xen_domid) { + return -ESRCH; + } + + return xen_evtchn_soft_reset(); +} + int xen_evtchn_close_op(struct evtchn_close *close) { XenEvtchnState *s = xen_evtchn_singleton; diff --git a/hw/i386/kvm/xen_evtchn.h b/hw/i386/kvm/xen_evtchn.h index 486b031..5d3e035 100644 --- a/hw/i386/kvm/xen_evtchn.h +++ b/hw/i386/kvm/xen_evtchn.h @@ -13,6 +13,7 @@ #define QEMU_XEN_EVTCHN_H void xen_evtchn_create(void); +int xen_evtchn_soft_reset(void); int xen_evtchn_set_callback_param(uint64_t param); struct evtchn_status; @@ -24,6 +25,7 @@ struct evtchn_send; struct evtchn_alloc_unbound; struct evtchn_bind_interdomain; struct evtchn_bind_vcpu; +struct evtchn_reset; int xen_evtchn_status_op(struct evtchn_status *status); int xen_evtchn_close_op(struct evtchn_close *close); int xen_evtchn_unmask_op(struct evtchn_unmask *unmask); @@ -33,5 +35,6 @@ int xen_evtchn_send_op(struct evtchn_send *send); int xen_evtchn_alloc_unbound_op(struct evtchn_alloc_unbound *alloc); int xen_evtchn_bind_interdomain_op(struct evtchn_bind_interdomain *interdomain); int xen_evtchn_bind_vcpu_op(struct evtchn_bind_vcpu *vcpu); +int xen_evtchn_reset_op(struct evtchn_reset *reset); #endif /* QEMU_XEN_EVTCHN_H */ |