diff options
author | Jennifer Herbert <jennifer.herbert@citrix.com> | 2014-12-24 09:17:06 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2015-01-28 09:03:12 -0500 |
commit | 8da7633f168b5428e2cfb7342408b2c44088f5df (patch) | |
tree | 33e17f065d1aa9bf8a57ac03b737154bac0d3468 /include/xen/grant_table.h | |
parent | ff4b156f166b3931894d2a8b5cdba6cdf4da0618 (diff) |
xen: mark grant mapped pages as foreign
Use the "foreign" page flag to mark pages that have a grant map. Use
page->private to store information of the grant (the granting domain
and the grant reference).
Signed-off-by: Jennifer Herbert <jennifer.herbert@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'include/xen/grant_table.h')
-rw-r--r-- | include/xen/grant_table.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 949803e20872..d3bef563e8da 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 | ||
@@ -185,4 +187,22 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | |||
185 | void gnttab_batch_map(struct gnttab_map_grant_ref *batch, unsigned count); | 187 | void gnttab_batch_map(struct gnttab_map_grant_ref *batch, unsigned count); |
186 | void gnttab_batch_copy(struct gnttab_copy *batch, unsigned count); | 188 | void gnttab_batch_copy(struct gnttab_copy *batch, unsigned count); |
187 | 189 | ||
190 | |||
191 | struct xen_page_foreign { | ||
192 | domid_t domid; | ||
193 | grant_ref_t gref; | ||
194 | }; | ||
195 | |||
196 | static inline struct xen_page_foreign *xen_page_foreign(struct page *page) | ||
197 | { | ||
198 | if (!PageForeign(page)) | ||
199 | return NULL; | ||
200 | #if BITS_PER_LONG < 64 | ||
201 | return (struct xen_page_foreign *)page->private; | ||
202 | #else | ||
203 | BUILD_BUG_ON(sizeof(struct xen_page_foreign) > BITS_PER_LONG); | ||
204 | return (struct xen_page_foreign *)&page->private; | ||
205 | #endif | ||
206 | } | ||
207 | |||
188 | #endif /* __ASM_GNTTAB_H__ */ | 208 | #endif /* __ASM_GNTTAB_H__ */ |