2015-07-10 17:21:29 +02:00
|
|
|
# Commit a622b5ade2bdf79ad95e6088a4041e75253c43f3
|
|
|
|
# Date 2015-06-16 12:30:16 +0200
|
|
|
|
# Author David Vrabel <david.vrabel@citrix.com>
|
|
|
|
# Committer Jan Beulich <jbeulich@suse.com>
|
|
|
|
evtchn: factor out freeing an event channel
|
|
|
|
|
|
|
|
We're going to want to free an event channel from two places. Factor out
|
|
|
|
the code into a free_evtchn() function.
|
|
|
|
|
|
|
|
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
|
|
|
|
|
2015-08-27 00:28:15 +02:00
|
|
|
--- a/xen/common/event_channel.c
|
|
|
|
+++ b/xen/common/event_channel.c
|
2015-07-10 17:21:29 +02:00
|
|
|
@@ -194,6 +194,17 @@ static int get_free_port(struct domain *
|
|
|
|
return port;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void free_evtchn(struct domain *d, struct evtchn *chn)
|
|
|
|
+{
|
|
|
|
+ /* Clear pending event to avoid unexpected behavior on re-bind. */
|
|
|
|
+ evtchn_port_clear_pending(d, chn);
|
|
|
|
+
|
|
|
|
+ /* Reset binding to vcpu0 when the channel is freed. */
|
|
|
|
+ chn->state = ECS_FREE;
|
|
|
|
+ chn->notify_vcpu_id = 0;
|
|
|
|
+
|
|
|
|
+ xsm_evtchn_close_post(chn);
|
|
|
|
+}
|
|
|
|
|
|
|
|
static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
|
|
|
|
{
|
2015-08-27 00:28:15 +02:00
|
|
|
@@ -568,14 +579,7 @@ static long __evtchn_close(struct domain
|
2015-07-10 17:21:29 +02:00
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
|
|
|
|
- /* Clear pending event to avoid unexpected behavior on re-bind. */
|
|
|
|
- evtchn_port_clear_pending(d1, chn1);
|
|
|
|
-
|
|
|
|
- /* Reset binding to vcpu0 when the channel is freed. */
|
|
|
|
- chn1->state = ECS_FREE;
|
|
|
|
- chn1->notify_vcpu_id = 0;
|
|
|
|
-
|
|
|
|
- xsm_evtchn_close_post(chn1);
|
|
|
|
+ free_evtchn(d1, chn1);
|
|
|
|
|
|
|
|
out:
|
|
|
|
if ( d2 != NULL )
|