aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-12-14 15:12:11 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-12-20 17:07:27 -0500
commit7d17e84bb8356b1d9f4402dd82a0e270a3d59a4f (patch)
tree52e6dfc37a288e7181503d3f6596ce569d725b89 /drivers/xen
parent2946a52ac7d57c9d02db477e3684259d86446ea7 (diff)
xen/grant-table: Support mappings required by blkback
Add support for mappings without GNTMAP_contains_pte. This was not supported because the unmap operation assumed that this flag was being used; adding a parameter to the unmap operation to allow the PTE clearing to be disabled is sufficient to make unmap capable of supporting either mapping type. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> [v1: Fix cleanpatch warnings] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/gntdev.c3
-rw-r--r--drivers/xen/grant-table.c24
2 files changed, 7 insertions, 20 deletions
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index f52f661f8f82..99d8151c824a 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -314,7 +314,8 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
314 } 314 }
315 } 315 }
316 316
317 err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset, pages); 317 err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset,
318 pages, true);
318 if (err) 319 if (err)
319 return err; 320 return err;
320 321
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index a3d0e1e278c1..1cd94daa71db 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -761,24 +761,10 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
761 (map_ops[i].host_addr & ~PAGE_MASK)); 761 (map_ops[i].host_addr & ~PAGE_MASK));
762 mfn = pte_mfn(*pte); 762 mfn = pte_mfn(*pte);
763 } else { 763 } else {
764 /* If you really wanted to do this: 764 mfn = PFN_DOWN(map_ops[i].dev_bus_addr);
765 * mfn = PFN_DOWN(map_ops[i].dev_bus_addr);
766 *
767 * The reason we do not implement it is b/c on the
768 * unmap path (gnttab_unmap_refs) we have no means of
769 * checking whether the page is !GNTMAP_contains_pte.
770 *
771 * That is without some extra data-structure to carry
772 * the struct page, bool clear_pte, and list_head next
773 * tuples and deal with allocation/delallocation, etc.
774 *
775 * The users of this API set the GNTMAP_contains_pte
776 * flag so lets just return not supported until it
777 * becomes neccessary to implement.
778 */
779 return -EOPNOTSUPP;
780 } 765 }
781 ret = m2p_add_override(mfn, pages[i], &kmap_ops[i]); 766 ret = m2p_add_override(mfn, pages[i], kmap_ops ?
767 &kmap_ops[i] : NULL);
782 if (ret) 768 if (ret)
783 return ret; 769 return ret;
784 } 770 }
@@ -788,7 +774,7 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
788EXPORT_SYMBOL_GPL(gnttab_map_refs); 774EXPORT_SYMBOL_GPL(gnttab_map_refs);
789 775
790int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, 776int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
791 struct page **pages, unsigned int count) 777 struct page **pages, unsigned int count, bool clear_pte)
792{ 778{
793 int i, ret; 779 int i, ret;
794 780
@@ -800,7 +786,7 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
800 return ret; 786 return ret;
801 787
802 for (i = 0; i < count; i++) { 788 for (i = 0; i < count; i++) {
803 ret = m2p_remove_override(pages[i], true /* clear the PTE */); 789 ret = m2p_remove_override(pages[i], clear_pte);
804 if (ret) 790 if (ret)
805 return ret; 791 return ret;
806 } 792 }