[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH V5 11/14] xen: introduce xen_event_channel_query_extended_abis



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 drivers/xen/events.c |   37 +++++++++++++++++++++++++++++++++++++
 include/xen/events.h |    3 +++
 2 files changed, 40 insertions(+)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index ee33421..270821d 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -2109,6 +2109,43 @@ void xen_callback_vector(void)
 void xen_callback_vector(void) {}
 #endif
 
+/*
+ * This function returns the extended AIBs a guest can use.
+ * When
+ *  1) hypervisor doesn't support extended ABIs (EVTCHNOP_* not implemented)
+ *  2) hypervisor supports extended ABIs but this guest cannot use them
+ * it returns EVTCHN_EXTENDED_NONE
+ * otherwise it returns a or'ed bitmap of enabled ABIs
+ */
+uint64_t xen_event_channel_query_extended_abis(void)
+{
+       struct evtchn_query_extended_abis query;
+       int rc;
+
+       memset(&query, 0, sizeof(query));
+
+       rc = HYPERVISOR_event_channel_op(EVTCHNOP_query_extended_abis, &query);
+
+       if (rc < 0) {
+               printk(KERN_INFO
+                      "Hypervisor does not support extended event channel 
ABIs.");
+               return EVTCHN_EXTENDED_NONE;
+       }
+
+       printk(KERN_INFO "Hypervisor supports extended event channel ABIs.\n");
+
+       printk(KERN_INFO
+              "Extended event channel AIBs enabled for this guest:\n");
+       if (query.abis == EVTCHN_EXTENDED_NONE /* 0 */)
+               printk(KERN_INFO "  None (disabled by host administrator)\n");
+       else {
+               if (query.abis & EVTCHN_EXTENDED_L3)
+                       printk(KERN_INFO "  3-level event channel ABI\n");
+       }
+
+       return query.abis;
+}
+
 const struct evtchn_ops evtchn_l2_ops = {
        .unmask = __unmask_local_port_l2,
        .debug_interrupt = xen_debug_interrupt_l2,
diff --git a/include/xen/events.h b/include/xen/events.h
index 24cf421..49d54ac 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -114,4 +114,7 @@ void xen_init_IRQ(void);
 extern unsigned int xen_nr_event_channels;
 extern uint64_t xen_evtchn_extended;
 
+/* Query hypervisor for supported / enabled extended event channel ABIs. */
+uint64_t xen_event_channel_query_extended_abis(void);
+
 #endif /* _XEN_EVENTS_H */
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.