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.h44
1 files changed, 43 insertions, 1 deletions
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 9a731706a016..b1fab6b5b3ef 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -37,10 +37,16 @@
37#ifndef __ASM_GNTTAB_H__ 37#ifndef __ASM_GNTTAB_H__
38#define __ASM_GNTTAB_H__ 38#define __ASM_GNTTAB_H__
39 39
40#include <asm/xen/hypervisor.h> 40#include <asm/page.h>
41
42#include <xen/interface/xen.h>
41#include <xen/interface/grant_table.h> 43#include <xen/interface/grant_table.h>
44
45#include <asm/xen/hypervisor.h>
42#include <asm/xen/grant_table.h> 46#include <asm/xen/grant_table.h>
43 47
48#include <xen/features.h>
49
44/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */ 50/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
45#define NR_GRANT_FRAMES 4 51#define NR_GRANT_FRAMES 4
46 52
@@ -107,6 +113,37 @@ void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
107void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 113void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
108 unsigned long pfn); 114 unsigned long pfn);
109 115
116static inline void
117gnttab_set_map_op(struct gnttab_map_grant_ref *map, phys_addr_t addr,
118 uint32_t flags, grant_ref_t ref, domid_t domid)
119{
120 if (flags & GNTMAP_contains_pte)
121 map->host_addr = addr;
122 else if (xen_feature(XENFEAT_auto_translated_physmap))
123 map->host_addr = __pa(addr);
124 else
125 map->host_addr = addr;
126
127 map->flags = flags;
128 map->ref = ref;
129 map->dom = domid;
130}
131
132static inline void
133gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
134 uint32_t flags, grant_handle_t handle)
135{
136 if (flags & GNTMAP_contains_pte)
137 unmap->host_addr = addr;
138 else if (xen_feature(XENFEAT_auto_translated_physmap))
139 unmap->host_addr = __pa(addr);
140 else
141 unmap->host_addr = addr;
142
143 unmap->handle = handle;
144 unmap->dev_bus_addr = 0;
145}
146
110int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, 147int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
111 unsigned long max_nr_gframes, 148 unsigned long max_nr_gframes,
112 struct grant_entry **__shared); 149 struct grant_entry **__shared);
@@ -118,4 +155,9 @@ unsigned int gnttab_max_grant_frames(void);
118 155
119#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) 156#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
120 157
158int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
159 struct page **pages, unsigned int count);
160int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
161 struct page **pages, unsigned int count);
162
121#endif /* __ASM_GNTTAB_H__ */ 163#endif /* __ASM_GNTTAB_H__ */