From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 3/6] xen/grant-table: Support mappings required by blkback Date: Mon, 24 Oct 2011 18:00:18 -0400 Message-ID: <20111024220018.GM2441@phenom.dumpdata.com> References: <1318969583-23902-1-git-send-email-dgdegra@tycho.nsa.gov> <1319124957-32269-1-git-send-email-dgdegra@tycho.nsa.gov> <1319124957-32269-4-git-send-email-dgdegra@tycho.nsa.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1319124957-32269-4-git-send-email-dgdegra@tycho.nsa.gov> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel De Graaf Cc: xen-devel@lists.xensource.com, Ian.Campbell@citrix.com, david.vrabel@citrix.com List-Id: xen-devel@lists.xenproject.org On Thu, Oct 20, 2011 at 11:35:54AM -0400, Daniel De Graaf wrote: > Allow mappings without GNTMAP_contains_pte and allow unmapping to > specify if the PTEs should be cleared. > > Signed-off-by: Daniel De Graaf > --- > drivers/xen/gntdev.c | 3 ++- > drivers/xen/grant-table.c | 23 ++++------------------- > include/xen/grant_table.h | 2 +- > 3 files changed, 7 insertions(+), 21 deletions(-) > > diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c > index 3987132..5227506 100644 > --- a/drivers/xen/gntdev.c > +++ b/drivers/xen/gntdev.c > @@ -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; > > diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c > index bf1c094..a02d139 100644 > --- a/drivers/xen/grant-table.c > +++ b/drivers/xen/grant-table.c > @@ -472,24 +472,9 @@ 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. Can you mention how you are addressing the !GNTMAP_contains_pte on unmap issue? (or how it is already addressed). > - * > - * 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; > } > @@ -499,7 +484,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; > > @@ -511,7 +496,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; > } > diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h > index 11e2dfc..37da54d 100644 > --- a/include/xen/grant_table.h > +++ b/include/xen/grant_table.h > @@ -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__ */ > -- > 1.7.6.4 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel