aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen/grant_table.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/xen/grant_table.h')
-rw-r--r--include/xen/grant_table.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 3387465b9caa..143ca5ffab7a 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -45,6 +45,8 @@
45#include <asm/xen/hypervisor.h> 45#include <asm/xen/hypervisor.h>
46 46
47#include <xen/features.h> 47#include <xen/features.h>
48#include <linux/mm_types.h>
49#include <linux/page-flags.h>
48 50
49#define GNTTAB_RESERVED_XENSTORE 1 51#define GNTTAB_RESERVED_XENSTORE 1
50 52
@@ -58,6 +60,22 @@ struct gnttab_free_callback {
58 u16 count; 60 u16 count;
59}; 61};
60 62
63struct gntab_unmap_queue_data;
64
65typedef void (*gnttab_unmap_refs_done)(int result, struct gntab_unmap_queue_data *data);
66
67struct gntab_unmap_queue_data
68{
69 struct delayed_work gnttab_work;
70 void *data;
71 gnttab_unmap_refs_done done;
72 struct gnttab_unmap_grant_ref *unmap_ops;
73 struct gnttab_unmap_grant_ref *kunmap_ops;
74 struct page **pages;
75 unsigned int count;
76 unsigned int age;
77};
78
61int gnttab_init(void); 79int gnttab_init(void);
62int gnttab_suspend(void); 80int gnttab_suspend(void);
63int gnttab_resume(void); 81int gnttab_resume(void);
@@ -163,12 +181,17 @@ void gnttab_free_auto_xlat_frames(void);
163 181
164#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) 182#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
165 183
184int gnttab_alloc_pages(int nr_pages, struct page **pages);
185void gnttab_free_pages(int nr_pages, struct page **pages);
186
166int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, 187int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
167 struct gnttab_map_grant_ref *kmap_ops, 188 struct gnttab_map_grant_ref *kmap_ops,
168 struct page **pages, unsigned int count); 189 struct page **pages, unsigned int count);
169int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, 190int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
170 struct gnttab_map_grant_ref *kunmap_ops, 191 struct gnttab_unmap_grant_ref *kunmap_ops,
171 struct page **pages, unsigned int count); 192 struct page **pages, unsigned int count);
193void gnttab_unmap_refs_async(struct gntab_unmap_queue_data* item);
194
172 195
173/* Perform a batch of grant map/copy operations. Retry every batch slot 196/* Perform a batch of grant map/copy operations. Retry every batch slot
174 * for which the hypervisor returns GNTST_eagain. This is typically due 197 * for which the hypervisor returns GNTST_eagain. This is typically due
@@ -182,4 +205,22 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
182void gnttab_batch_map(struct gnttab_map_grant_ref *batch, unsigned count); 205void gnttab_batch_map(struct gnttab_map_grant_ref *batch, unsigned count);
183void gnttab_batch_copy(struct gnttab_copy *batch, unsigned count); 206void gnttab_batch_copy(struct gnttab_copy *batch, unsigned count);
184 207
208
209struct xen_page_foreign {
210 domid_t domid;
211 grant_ref_t gref;
212};
213
214static inline struct xen_page_foreign *xen_page_foreign(struct page *page)
215{
216 if (!PageForeign(page))
217 return NULL;
218#if BITS_PER_LONG < 64
219 return (struct xen_page_foreign *)page->private;
220#else
221 BUILD_BUG_ON(sizeof(struct xen_page_foreign) > BITS_PER_LONG);
222 return (struct xen_page_foreign *)&page->private;
223#endif
224}
225
185#endif /* __ASM_GNTTAB_H__ */ 226#endif /* __ASM_GNTTAB_H__ */