From: Jean Guyader <jean.guyader@citrix.com>
To: xen-devel@lists.xen.org
Cc: tim@xen.org, Jean Guyader <jean.guyader@citrix.com>, JBeulich@suse.com
Subject: [PATCH 3/4] xen: events, exposes evtchn_alloc_unbound_domain
Date: Thu, 13 Sep 2012 19:09:31 +0100 [thread overview]
Message-ID: <1347559772-21817-4-git-send-email-jean.guyader@citrix.com> (raw)
In-Reply-To: <1347559772-21817-1-git-send-email-jean.guyader@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
Exposes evtchn_alloc_unbound_domain to the rest of
Xen so we can create allocated unbound evtchn within Xen.
Signed-off-by: Jean Guyader <jean.guyader@citrix.com>
---
xen/common/event_channel.c | 39 +++++++++++++++++++++++++++------------
xen/include/xen/event.h | 3 +++
2 files changed, 30 insertions(+), 12 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-xen-events-exposes-evtchn_alloc_unbound_domain.patch --]
[-- Type: text/x-patch; name="0003-xen-events-exposes-evtchn_alloc_unbound_domain.patch", Size: 2529 bytes --]
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 53777f8..6a0e342 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -159,36 +159,51 @@ static int get_free_port(struct domain *d)
static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
{
- struct evtchn *chn;
struct domain *d;
- int port;
- domid_t dom = alloc->dom;
long rc;
- rc = rcu_lock_target_domain_by_id(dom, &d);
+ rc = rcu_lock_target_domain_by_id(alloc->dom, &d);
if ( rc )
return rc;
+ rc = evtchn_alloc_unbound_domain(d, &alloc->port, alloc->remote_dom);
+ if ( rc )
+ ERROR_EXIT_DOM((int)rc, d);
+
+ out:
+ rcu_unlock_domain(d);
+
+ return rc;
+}
+
+int evtchn_alloc_unbound_domain(struct domain *d, evtchn_port_t *port,
+ domid_t remote_domid)
+{
+ struct evtchn *chn;
+ int rc;
+ int free_port;
+
spin_lock(&d->event_lock);
- if ( (port = get_free_port(d)) < 0 )
- ERROR_EXIT_DOM(port, d);
- chn = evtchn_from_port(d, port);
+ rc = free_port = get_free_port(d);
+ if ( free_port < 0 )
+ goto out;
- rc = xsm_evtchn_unbound(d, chn, alloc->remote_dom);
+ chn = evtchn_from_port(d, free_port);
+ rc = xsm_evtchn_unbound(d, chn, remote_domid);
if ( rc )
goto out;
chn->state = ECS_UNBOUND;
- if ( (chn->u.unbound.remote_domid = alloc->remote_dom) == DOMID_SELF )
+ if ( (chn->u.unbound.remote_domid = remote_domid) == DOMID_SELF )
chn->u.unbound.remote_domid = current->domain->domain_id;
- alloc->port = port;
+ *port = free_port;
+ /* Everything is fine, returns 0 */
+ rc = 0;
out:
spin_unlock(&d->event_lock);
- rcu_unlock_domain(d);
-
return rc;
}
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 71c3e92..1a0c832 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -69,6 +69,9 @@ int guest_enabled_event(struct vcpu *v, uint32_t virq);
/* Notify remote end of a Xen-attached event channel.*/
void notify_via_xen_event_channel(struct domain *ld, int lport);
+int evtchn_alloc_unbound_domain(struct domain *d, evtchn_port_t *port,
+ domid_t remote_domid);
+
/* Internal event channel object accessors */
#define bucket_from_port(d,p) \
((d)->evtchn[(p)/EVTCHNS_PER_BUCKET])
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2012-09-13 18:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 18:09 [RFC][PATCH 0/4] Add V4V to Xen Jean Guyader
2012-09-13 18:09 ` [PATCH 1/4] xen: Introduce guest_handle_for_field Jean Guyader
2012-09-13 18:12 ` Jean Guyader
2012-09-13 18:09 ` [PATCH 2/4] xen: virq, remove VIRQ_XC_RESERVED Jean Guyader
2012-09-13 18:09 ` Jean Guyader [this message]
2012-09-13 18:09 ` [PATCH 4/4] xen: Add V4V implementation Jean Guyader
2012-09-14 9:54 ` Jan Beulich
-- strict thread matches above, loose matches on Subject: below --
2012-09-20 9:47 [PATCH 0/4] Add V4V to Xen v5 Jean Guyader
2012-09-20 9:47 ` [PATCH 3/4] xen: events, exposes evtchn_alloc_unbound_domain Jean Guyader
2012-09-20 11:41 [PATCH 0/4] Add V4V to Xen (v6) Jean Guyader
2012-09-20 11:42 ` [PATCH 3/4] xen: events, exposes evtchn_alloc_unbound_domain Jean Guyader
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1347559772-21817-4-git-send-email-jean.guyader@citrix.com \
--to=jean.guyader@citrix.com \
--cc=JBeulich@suse.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).