[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH V2 7/8] xen: introduce interfaces to register N-level event channel
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |