From 28d13f5d508e765a8061299873000c43e4c35531 Mon Sep 17 00:00:00 2001 From: Joao Martins Date: Fri, 28 Sep 2018 13:05:22 -0400 Subject: [PATCH] i386/xen: register exit notifier This allows us to free resources and/or connections to other resources/domains. Signed-off-by: Joao Martins --- target/i386/xen-proto.h | 1 + target/i386/xen.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/target/i386/xen-proto.h b/target/i386/xen-proto.h index 2c5acd443f..0965ea7624 100644 --- a/target/i386/xen-proto.h +++ b/target/i386/xen-proto.h @@ -54,6 +54,7 @@ typedef struct XenState { int domid; int port; QemuMutex port_lock; + Notifier exit; struct XenGrantTable gnttab; } XenState; diff --git a/target/i386/xen.c b/target/i386/xen.c index 959c4cf9fc..ce3062b974 100644 --- a/target/i386/xen.c +++ b/target/i386/xen.c @@ -21,6 +21,7 @@ #include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "qapi/qmp/qdict.h" +#include "qapi/error.h" #include "qom/cpu.h" #include "hw/xen/xen.h" @@ -140,6 +141,10 @@ int kvm_xen_set_hypercall_page(CPUState *env) return kvm_vm_ioctl(env->kvm_state, KVM_XEN_HVM_CONFIG, &cfg); } +static void kvm_xen_exit(Notifier *n, void *data) +{ +} + void kvm_xen_init(XenState *xen) { kvm_xen_set_domid(kvm_state, xen); @@ -147,6 +152,9 @@ void kvm_xen_init(XenState *xen) qemu_mutex_init(&xen_global_mutex); qemu_mutex_init(&xen->port_lock); + xen->exit.notify = kvm_xen_exit; + qemu_add_exit_notifier(&xen->exit); + kvm_xen_evtchn_init(xen); } -- 2.50.1