aboutsummaryrefslogtreecommitdiff
path: root/include/hw/xen
diff options
context:
space:
mode:
authorPaul Durrant <paul.durrant@citrix.com>2019-01-08 14:48:52 +0000
committerAnthony PERARD <anthony.perard@citrix.com>2019-01-14 13:45:40 +0000
commita3d669c8bd1a93ad588d4dce5c70ea6405fa9bb9 (patch)
tree196905ed7a9eb35b1b4d0f4303216126226550a8 /include/hw/xen
parent4b34b5b14054edded15888448b0aad3723b99c29 (diff)
xen: add event channel interface for XenDevice-s
The legacy PV backend infrastructure provides functions to bind, unbind and send notifications to event channnels. Similar functionality will be required by XenDevice implementations so this patch adds the necessary support. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Reviewed-by: Anthony Perard <anthony.perard@citrix.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Patch squashed with: Patch "xen: add event channel interface for XenDevice-s" makes use of the type xenevtchn_port_or_error_t, but this isn't avaiable before Xen 4.7. Also the function xen_device_bind_event_channel assign the return value of xenevtchn_bind_interdomain to channel->local_port but check the result for error with xendev->local_port. Fix by: - removing local_port from struct XenDevice as it isn't use anywere. - adding a compatibility typedef for xenevtchn_port_or_error_t for Xen 4.6 and earlier. As extra, replace the type of XenEventChannel->local_port by evtchn_port_t. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Diffstat (limited to 'include/hw/xen')
-rw-r--r--include/hw/xen/xen-bus.h17
-rw-r--r--include/hw/xen/xen_common.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h
index 63a09b67ee..b554559e5b 100644
--- a/include/hw/xen/xen-bus.h
+++ b/include/hw/xen/xen-bus.h
@@ -26,6 +26,8 @@ typedef struct XenDevice {
XenWatch *frontend_state_watch;
xengnttab_handle *xgth;
bool feature_grant_copy;
+ xenevtchn_handle *xeh;
+ NotifierList event_notifiers;
} XenDevice;
typedef char *(*XenDeviceGetName)(XenDevice *xendev, Error **errp);
@@ -104,4 +106,19 @@ void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain,
XenDeviceGrantCopySegment segs[],
unsigned int nr_segs, Error **errp);
+typedef struct XenEventChannel XenEventChannel;
+
+typedef void (*XenEventHandler)(void *opaque);
+
+XenEventChannel *xen_device_bind_event_channel(XenDevice *xendev,
+ unsigned int port,
+ XenEventHandler handler,
+ void *opaque, Error **errp);
+void xen_device_notify_event_channel(XenDevice *xendev,
+ XenEventChannel *channel,
+ Error **errp);
+void xen_device_unbind_event_channel(XenDevice *xendev,
+ XenEventChannel *channel,
+ Error **errp);
+
#endif /* HW_XEN_BUS_H */
diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h
index 93f631e5bf..9c3ac07d78 100644
--- a/include/hw/xen/xen_common.h
+++ b/include/hw/xen/xen_common.h
@@ -32,6 +32,7 @@ extern xc_interface *xen_xc;
typedef xc_interface xenforeignmemory_handle;
typedef xc_evtchn xenevtchn_handle;
typedef xc_gnttab xengnttab_handle;
+typedef evtchn_port_or_error_t xenevtchn_port_or_error_t;
#define xenevtchn_open(l, f) xc_evtchn_open(l, f);
#define xenevtchn_close(h) xc_evtchn_close(h)