aboutsummaryrefslogtreecommitdiff
path: root/include/hw/xen/xen-bus.h
diff options
context:
space:
mode:
authorPaul Durrant <paul.durrant@citrix.com>2019-01-08 14:48:51 +0000
committerAnthony PERARD <anthony.perard@citrix.com>2019-01-14 13:45:40 +0000
commit4b34b5b14054edded15888448b0aad3723b99c29 (patch)
treebaa841f01aec8366601f4a8b9051db7d96b2a6a0 /include/hw/xen/xen-bus.h
parent82a29e304841e464ddb6a8a2c0240196b0ee3887 (diff)
xen: add grant table interface for XenDevice-s
The legacy PV backend infrastructure provides functions to map, unmap and copy pages granted by frontends. 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>
Diffstat (limited to 'include/hw/xen/xen-bus.h')
-rw-r--r--include/hw/xen/xen-bus.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h
index df73674fcd..63a09b67ee 100644
--- a/include/hw/xen/xen-bus.h
+++ b/include/hw/xen/xen-bus.h
@@ -24,6 +24,8 @@ typedef struct XenDevice {
enum xenbus_state backend_state, frontend_state;
Notifier exit;
XenWatch *frontend_state_watch;
+ xengnttab_handle *xgth;
+ bool feature_grant_copy;
} XenDevice;
typedef char *(*XenDeviceGetName)(XenDevice *xendev, Error **errp);
@@ -79,4 +81,27 @@ void xen_device_backend_set_state(XenDevice *xendev,
enum xenbus_state state);
enum xenbus_state xen_device_backend_get_state(XenDevice *xendev);
+void xen_device_set_max_grant_refs(XenDevice *xendev, unsigned int nr_refs,
+ Error **errp);
+void *xen_device_map_grant_refs(XenDevice *xendev, uint32_t *refs,
+ unsigned int nr_refs, int prot,
+ Error **errp);
+void xen_device_unmap_grant_refs(XenDevice *xendev, void *map,
+ unsigned int nr_refs, Error **errp);
+
+typedef struct XenDeviceGrantCopySegment {
+ union {
+ void *virt;
+ struct {
+ uint32_t ref;
+ off_t offset;
+ } foreign;
+ } source, dest;
+ size_t len;
+} XenDeviceGrantCopySegment;
+
+void xen_device_copy_grant_refs(XenDevice *xendev, bool to_domain,
+ XenDeviceGrantCopySegment segs[],
+ unsigned int nr_segs, Error **errp);
+
#endif /* HW_XEN_BUS_H */