All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: konrad.wilk@oracle.com
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	xen-devel@lists.xensource.com, david.vrabel@citrix.com,
	JBeulich@suse.com, Ian.Campbell@citrix.com
Subject: [PATCH 03/12] xen/grant-table: Support mappings required by blkback
Date: Mon, 28 Nov 2011 11:49:02 -0500	[thread overview]
Message-ID: <1322498951-4392-4-git-send-email-dgdegra@tycho.nsa.gov> (raw)
In-Reply-To: <1322498951-4392-1-git-send-email-dgdegra@tycho.nsa.gov>

Allow mappings without GNTMAP_contains_pte and allow unmapping to
specify if the PTEs should be cleared.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
 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 afca14d..65bff07 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.
-			 *
-			 * 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.7.3

  parent reply	other threads:[~2011-11-28 16:49 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 11:51 [PATCH] mm: sync vmalloc address space page tables in alloc_vm_area() David Vrabel
2011-09-01 16:11 ` [Revert] " Konrad Rzeszutek Wilk
2011-09-01 16:11   ` Konrad Rzeszutek Wilk
2011-09-01 20:37   ` Jeremy Fitzhardinge
2011-09-01 20:37     ` Jeremy Fitzhardinge
2011-09-01 21:17     ` Andrew Morton
2011-09-01 21:17       ` Andrew Morton
2011-09-02 11:39       ` David Vrabel
2011-09-02 11:39         ` David Vrabel
2011-09-02 11:39         ` David Vrabel
2011-09-02 22:32         ` Andrew Morton
2011-09-02 22:32           ` Andrew Morton
2011-09-02 23:04           ` Jeremy Fitzhardinge
2011-09-02 23:04             ` Jeremy Fitzhardinge
2011-09-06 16:35           ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-09-06 16:35             ` Konrad Rzeszutek Wilk
2011-11-05 13:38             ` Konrad Rzeszutek Wilk
2011-11-05 13:38               ` Konrad Rzeszutek Wilk
2011-11-05 13:38               ` Konrad Rzeszutek Wilk
2011-11-07 20:36               ` Konrad Rzeszutek Wilk
2011-11-07 20:36                 ` Konrad Rzeszutek Wilk
2011-11-08 23:01                 ` Andrew Morton
2011-11-08 23:01                   ` Andrew Morton
2011-11-08 23:31                   ` Konrad Rzeszutek Wilk
2011-11-08 23:31                     ` Konrad Rzeszutek Wilk
2011-11-08 23:36                     ` Andrew Morton
2011-11-08 23:36                       ` Andrew Morton
2011-11-28  9:36                 ` Jan Beulich
2011-11-28 10:19                   ` Ian Campbell
2011-11-28 11:36                     ` David Vrabel
2011-11-28 11:48                       ` Ian Campbell
2011-11-28 15:20                       ` Konrad Rzeszutek Wilk
2011-11-28 16:48                         ` [PATCH 00/12] HVM backends and gnt/event fixups Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 01/12] xenbus: Support HVM backends Daniel De Graaf
2011-12-14 19:03                             ` Konrad Rzeszutek Wilk
2011-12-14 19:53                               ` Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 02/12] xenbus: Use grant-table wrapper functions Daniel De Graaf
2011-11-28 16:49                           ` Daniel De Graaf [this message]
2011-11-28 16:49                           ` [PATCH 04/12] xen/blkback: use grant-table.c hypercall wrappers Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 05/12] xen/netback: Enable netback on HVM guests Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 06/12] xen/blkback: Enable blkback " Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 07/12] xen/event: Add reference counting to event channels Daniel De Graaf
2011-12-14 18:56                             ` Konrad Rzeszutek Wilk
2011-12-14 19:52                               ` Daniel De Graaf
2011-12-16 19:35                                 ` Konrad Rzeszutek Wilk
2011-11-28 16:49                           ` [PATCH 08/12] xen/gntalloc: Change gref_lock to a mutex Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 09/12] xen/gnt{dev, alloc}: reserve event channels for notify Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 10/12] xen/events: prevent calling evtchn_get on invalid channels Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 11/12] xen/gntalloc: release grant references on page free Daniel De Graaf
2011-11-28 16:49                           ` [PATCH 12/12] xen/gntalloc: fix reference counts on multi-page mappings Daniel De Graaf
2011-09-02  7:22     ` [Xen-devel] Re: [Revert] Re: [PATCH] mm: sync vmalloc address space page tables in alloc_vm_area() Ian Campbell
2011-09-02  7:22       ` Ian Campbell
2011-09-02  7:31       ` Keir Fraser
2011-09-02  7:31         ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322498951-4392-4-git-send-email-dgdegra@tycho.nsa.gov \
    --to=dgdegra@tycho.nsa.gov \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.