[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 11/13] xen: introduce xen_event_channel_register_nlevel
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- drivers/xen/events.c | 46 ++++++++++++++++++++++++++++++++++++++++------ include/xen/events.h | 6 ++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 9038211..f77909d 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -2217,17 +2217,51 @@ err: return rc; } +int xen_event_channel_register_nlevel(unsigned int level) +{ + int rc; + + switch (level) { + case 3: + rc = xen_event_channel_register_3level(); + break; + default: + printk(KERN_INFO "Trying to register unsupported %d-level event channel\n", + level); + rc = -EINVAL; + } + + return rc; +} + +void xen_set_event_channel_nlevel(unsigned int level) +{ + struct shared_info *s = HYPERVISOR_shared_info; + switch (level) { + case 2: + evtchn_pending = s->evtchn_pending; + evtchn_mask = s->evtchn_mask; + evtchn_level = 2; + nr_event_channels = NR_EVENT_CHANNELS_L2; + break; + case 3: + /* evtchn_pending/mask already set */ + evtchn_level = 3; + nr_event_channels = NR_EVENT_CHANNELS_L3; + break; + default: + printk(KERN_EMERG "Trying to set unsupported %d-level event channel\n", + level); + BUG(); + } +} + void __init xen_init_IRQ(void) { int i, rc; int cpu; - struct shared_info *s = HYPERVISOR_shared_info; - - evtchn_pending = s->evtchn_pending; - evtchn_mask = s->evtchn_mask; - evtchn_level = 2; - nr_event_channels = NR_EVENT_CHANNELS_L2; + xen_set_event_channel_nlevel(2); 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 6b117ac..cbc1b71 100644 --- a/include/xen/events.h +++ b/include/xen/events.h @@ -111,4 +111,10 @@ int xen_test_irq_shared(int irq); extern unsigned int nr_event_channels; +/* 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 |