diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2009-02-09 15:05:49 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-01-11 14:30:34 -0500 |
commit | f07745325cbd93afc5d8bcf7539a063d33134075 (patch) | |
tree | e75f7d15f3559e00708bfdd33b67fdd1637eac69 /include/xen | |
parent | 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff) |
xen: define gnttab_set_map_op/unmap_op
Impact: hypercall definitions
These functions populate the gnttab data structures used by the
granttab map and unmap ops and are used in the backend drivers.
Originally xen-unstable.hg 9625:c3bb51c443a7
[ Include Stefano's fix for phys_addr_t ]
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/grant_table.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 9a731706a016..1821aa103d82 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, | |||
107 | void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, | 113 | void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, |
108 | unsigned long pfn); | 114 | unsigned long pfn); |
109 | 115 | ||
116 | static inline void | ||
117 | gnttab_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 | |||
132 | static inline void | ||
133 | gnttab_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 | |||
110 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | 147 | int 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); |