Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230853
b: refs/heads/master
c: 289b777
h: refs/heads/master
i:
  230851: 37907eb
v: v3
  • Loading branch information
Stefano Stabellini authored and Konrad Rzeszutek Wilk committed Jan 11, 2011
1 parent 0ad4f42 commit 7a051a5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b705f0e98c489b18ba22a6eab9d694b546c8552
refs/heads/master: 289b777eac19c811b474593b4d2fd14e46340c23
36 changes: 36 additions & 0 deletions trunk/drivers/xen/grant-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,42 @@ unsigned int gnttab_max_grant_frames(void)
}
EXPORT_SYMBOL_GPL(gnttab_max_grant_frames);

int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
struct page **pages, unsigned int count)
{
int i, ret;
pte_t *pte;
unsigned long mfn;

ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map_ops, count);

for (i = 0; i < count; i++) {
/* m2p override only supported for GNTMAP_contains_pte mappings */
if (!(map_ops[i].flags & GNTMAP_contains_pte))
continue;
pte = (pte_t *) (mfn_to_virt(PFN_DOWN(map_ops[i].host_addr)) +
(map_ops[i].host_addr & ~PAGE_MASK));
mfn = pte_mfn(*pte);
m2p_add_override(mfn, pages[i]);
}

return ret;
}
EXPORT_SYMBOL_GPL(gnttab_map_refs);

int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
struct page **pages, unsigned int count)
{
int i, ret;

ret = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap_ops, count);
for (i = 0; i < count; i++)
m2p_remove_override(pages[i]);

return ret;
}
EXPORT_SYMBOL_GPL(gnttab_unmap_refs);

static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
{
struct gnttab_setup_table setup;
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/xen/grant_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,9 @@ unsigned int gnttab_max_grant_frames(void);

#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))

int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
struct page **pages, unsigned int count);
int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
struct page **pages, unsigned int count);

#endif /* __ASM_GNTTAB_H__ */

0 comments on commit 7a051a5

Please sign in to comment.