xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xen.org
Cc: david.vrabel@citrix.com, Wei Liu <wei.liu2@citrix.com>,
	ian.campbell@citrix.com, jbeulich@suse.com,
	konrad.wilk@oracle.com
Subject: [RFC PATCH V2 7/8] xen: introduce interfaces to register N-level event channel
Date: Mon, 21 Jan 2013 14:58:27 +0000	[thread overview]
Message-ID: <1358780308-30425-8-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1358780308-30425-1-git-send-email-wei.liu2@citrix.com>

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 drivers/xen/events.c |   46 +++++++++++++++++++++++++++++++++++-----------
 include/xen/events.h |    6 ++++++
 2 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index cbb10ed..76ff48c 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -2178,6 +2178,26 @@ static struct evtchn_ops evtchn_ops_l3 __read_mostly = {
 	.debug_interrupt   = debug_interrupt_l3,
 };
 
+void xen_set_event_channel_nlevel(unsigned int level)
+{
+	switch (level) {
+	case 2:
+		evtchn_level = 2;
+		nr_event_channels = NR_EVENT_CHANNELS_L2;
+		eops = &evtchn_ops_l2;
+		break;
+	case 3:
+		evtchn_level = 3;
+		nr_event_channels = NR_EVENT_CHANNELS_L3;
+		eops = &evtchn_ops_l3;
+		break;
+	default:
+		printk(KERN_EMERG "Trying to set unsupported %d-level event channel\n",
+		       level);
+		BUG();
+	}
+}
+
 static int xen_event_channel_register_3level(void)
 {
 	evtchn_register_nlevel_t reg;
@@ -2249,24 +2269,28 @@ out:
 	return rc;
 }
 
-void __init xen_init_IRQ(void)
+int xen_event_channel_register_nlevel(unsigned int level)
 {
-	int i, rc;
-	int cpu;
+	int rc;
 
-	switch (evtchn_level) {
-	case 2:
-		nr_event_channels = NR_EVENT_CHANNELS_L2;
-		eops = &evtchn_ops_l2;
-		break;
+	switch (level) {
 	case 3:
-		nr_event_channels = NR_EVENT_CHANNELS_L3;
-		eops = &evtchn_ops_l3;
+		rc = xen_event_channel_register_3level();
 		break;
 	default:
-		BUG();
+		printk(KERN_INFO "Trying to register unsupported %d-level event channel\n",
+		       level);
+		rc = -EINVAL;
 	}
 
+	return rc;
+}
+
+void __init xen_init_IRQ(void)
+{
+	int i, rc;
+	int cpu;
+
 	/* Setup 2-level event channel */
 	evtchn_to_irq = kcalloc(nr_event_channels, sizeof(*evtchn_to_irq),
 				GFP_KERNEL);
diff --git a/include/xen/events.h b/include/xen/events.h
index 04399b2..3c1708f 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -109,4 +109,10 @@ int xen_irq_from_gsi(unsigned gsi);
 /* Determine whether to ignore this IRQ if it is passed to a guest. */
 int xen_test_irq_shared(int irq);
 
+/* Register N-level event channel. */
+int xen_event_channel_register_nlevel(unsigned int level);
+
+/* Set event channel to N-level if registration succeed. */
+void xen_set_event_channel_nlevel(unsigned int level);
+
 #endif	/* _XEN_EVENTS_H */
-- 
1.7.10.4

  parent reply	other threads:[~2013-01-21 14:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 14:58 [RFC PATCH V2 0/8] Implement 3-level event channel in Linux Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 1/8] xen: fix output of xen_debug_interrupt Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 2/8] xen: sync public headers Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 3/8] xen: generalized event channel operations Wei Liu
2013-01-22  9:00   ` Jan Beulich
2013-01-21 14:58 ` [RFC PATCH V2 4/8] xen: dynamically allocate cpu_evtchn_mask Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 5/8] xen: implement 3-level event channel routines Wei Liu
2013-01-22  9:12   ` Jan Beulich
2013-01-21 14:58 ` [RFC PATCH V2 6/8] xen: introduce xen_event_channel_register_3level Wei Liu
2013-01-21 14:58 ` Wei Liu [this message]
2013-01-21 14:58 ` [RFC PATCH V2 8/8] xen: register 3-level event channel Wei Liu

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=1358780308-30425-8-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --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).