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>
This commit is contained in:

committed by
David Vrabel

parent
ff4b156f16
commit
8da7633f16
@@ -681,12 +681,8 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
|
||||
}
|
||||
pfn = page_to_pfn(pages[i]);
|
||||
|
||||
WARN_ON(PagePrivate(pages[i]));
|
||||
WARN(pfn_to_mfn(pfn) != INVALID_P2M_ENTRY, "page must be ballooned");
|
||||
|
||||
SetPagePrivate(pages[i]);
|
||||
set_page_private(pages[i], mfn);
|
||||
|
||||
if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
@@ -716,9 +712,6 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
|
||||
goto out;
|
||||
}
|
||||
|
||||
set_page_private(pages[i], INVALID_P2M_ENTRY);
|
||||
WARN_ON(!PagePrivate(pages[i]));
|
||||
ClearPagePrivate(pages[i]);
|
||||
set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
|
||||
}
|
||||
if (kunmap_ops)
|
||||
|
Reference in New Issue
Block a user