]> xenbits.xensource.com Git - people/sstabellini/linux-pvhvm-deprecated.git/commitdiff
xen/grant-table: Support mappings required by blkback
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Wed, 14 Dec 2011 20:12:11 +0000 (15:12 -0500)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 2 Jul 2012 14:13:30 +0000 (14:13 +0000)
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>
drivers/xen/gntdev.c
drivers/xen/grant-table.c
include/xen/grant_table.h

index afca14d9042e6cd2ae03f238143ac8188aaf35fb..baf11ae06d29038c47eff5ce9bc1f3f0eedd34ed 100644 (file)
@@ -312,7 +312,8 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
                }
        }
 
-       err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset, pages);
+       err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset,
+                               pages, true);
        if (err)
                return err;
 
index a675f59120ca8a4adbc43d712035d59e5e1e7ad9..db3964bb9f69012289a3d5bf5035aa988ab628ff 100644 (file)
@@ -473,24 +473,10 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
                                (map_ops[i].host_addr & ~PAGE_MASK));
                        mfn = pte_mfn(*pte);
                } else {
-                       /* If you really wanted to do this:
-                        * mfn = PFN_DOWN(map_ops[i].dev_bus_addr);
-                        *
-                        * The reason we do not implement it is b/c on the
-                        * unmap path (gnttab_unmap_refs) we have no means of
-                        * checking whether the page is !GNTMAP_contains_pte.
-                        *
-                        * That is without some extra data-structure to carry
-                        * the struct page, bool clear_pte, and list_head next
-                        * tuples and deal with allocation/delallocation, etc.
-                        *
-                        * The users of this API set the GNTMAP_contains_pte
-                        * flag so lets just return not supported until it
-                        * becomes neccessary to implement.
-                        */
-                       return -EOPNOTSUPP;
+                       mfn = PFN_DOWN(map_ops[i].dev_bus_addr);
                }
-               ret = m2p_add_override(mfn, pages[i], &kmap_ops[i]);
+               ret = m2p_add_override(mfn, pages[i], kmap_ops ?
+                                      &kmap_ops[i] : NULL);
                if (ret)
                        return ret;
        }
@@ -500,7 +486,7 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
 EXPORT_SYMBOL_GPL(gnttab_map_refs);
 
 int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
-                     struct page **pages, unsigned int count)
+                     struct page **pages, unsigned int count, bool clear_pte)
 {
        int i, ret;
 
@@ -512,7 +498,7 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
                return ret;
 
        for (i = 0; i < count; i++) {
-               ret = m2p_remove_override(pages[i], true /* clear the PTE */);
+               ret = m2p_remove_override(pages[i], clear_pte);
                if (ret)
                        return ret;
        }
index ee143e38c3f1bf20f2292c92eb43be9c62e8b4e9..ca53dd550ebc7d97c827c9d70303a65acad6e604 100644 (file)
@@ -158,6 +158,6 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
                    struct gnttab_map_grant_ref *kmap_ops,
                    struct page **pages, unsigned int count);
 int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
-                     struct page **pages, unsigned int count);
+                     struct page **pages, unsigned int count, bool clear_pte);
 
 #endif /* __ASM_GNTTAB_H__ */