[3/3] xen/arm: grant-table: Support read-only mapping

Message ID 1382605365-19244-4-git-send-email-julien.grall@linaro.org
State Superseded
Headers show

Commit Message

Julien Grall Oct. 24, 2013, 9:02 a.m.
Use guest_physmap_add_page_rw to map the page in the guest with a
specific read-write attribute.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/mm.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Patch

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index eaeb0c3..e45c6aa 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1262,19 +1262,15 @@  int create_grant_host_mapping(unsigned long addr, unsigned long frame,
                               unsigned int flags, unsigned int cache_flags)
 {
     int rc;
+    bool_t rw;
 
     if ( cache_flags  || (flags & ~GNTMAP_readonly) != GNTMAP_host_map )
         return GNTST_general_error;
 
-    /* XXX: read only mappings */
-    if ( flags & GNTMAP_readonly )
-    {
-        gdprintk(XENLOG_WARNING, "read only mappings not implemented yet\n");
-        return GNTST_general_error;
-    }
+    rw = !(flags & GNTMAP_readonly);
 
-    rc = guest_physmap_add_page(current->domain,
-                                 addr >> PAGE_SHIFT, frame, 0);
+    rc = guest_physmap_add_page_rw(current->domain,
+                                   addr >> PAGE_SHIFT, frame, 0, rw);
     if ( rc )
         return GNTST_general_error;
     else