summaryrefslogtreecommitdiffstats
path: root/include/xen
diff options
context:
space:
mode:
authorJulien Grall <julien.grall@citrix.com>2015-06-19 13:05:06 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2015-10-23 09:20:34 -0400
commit3922f32c1e6db2e096ff095a5b8af0b940b97508 (patch)
tree5170cad0c1b2e55c7332aeed768423e145a31952 /include/xen
parent008c320a96d218712043f8db0111d5472697785c (diff)
xen/grant: Add helper gnttab_page_grant_foreign_access_ref_one
Many PV drivers contain the idiom: pfn = page_to_gfn(...) /* Or similar */ gnttab_grant_foreign_access_ref Replace it by a new helper. Note that when Linux is using a different page granularity than Xen, the helper only gives access to the first 4KB grant. This is useful where drivers are allocating a full Linux page for each grant. Also include xen/interface/grant_table.h rather than xen/grant_table.h in asm/page.h for x86 to fix a compilation issue [1]. Only the former is useful in order to get the structure definition. [1] Interdependency between asm/page.h and xen/grant_table.h which result to page_mfn not being defined when necessary. Signed-off-by: Julien Grall <julien.grall@citrix.com> Reviewed-by: David Vrabel <david.vrabel@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')
-rw-r--r--include/xen/grant_table.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 05b5b08c2afc..e17a4b381a16 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -131,6 +131,15 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
131void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, 131void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
132 unsigned long frame, int readonly); 132 unsigned long frame, int readonly);
133 133
134/* Give access to the first 4K of the page */
135static inline void gnttab_page_grant_foreign_access_ref_one(
136 grant_ref_t ref, domid_t domid,
137 struct page *page, int readonly)
138{
139 gnttab_grant_foreign_access_ref(ref, domid, xen_page_to_gfn(page),
140 readonly);
141}
142
134void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 143void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
135 unsigned long pfn); 144 unsigned long pfn);
136 145