diff mbox

[2/3] xen/arm: p2m: add guest_physmap_add_page_rw

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

Commit Message

Julien Grall Oct. 24, 2013, 9:02 a.m. UTC
This function allows Xen to map memory read/write or read-only to the
guest memory.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/p2m.c        | 11 +++++++++++
 xen/include/asm-arm/p2m.h |  5 +++++
 2 files changed, 16 insertions(+)

Comments

Ian Campbell Nov. 11, 2013, 1:30 p.m. UTC | #1
On Thu, 2013-10-24 at 10:02 +0100, Julien Grall wrote:
> This function allows Xen to map memory read/write or read-only to the
> guest memory.

x86's equivalent seems to be guest_physmap_add_entry() which is used by
guest_physmap_add_page. Unless there is a reason to diverge it would be
nice to keep the arch API similar I think.

x86 also passes a p2m type as I suggested in my previous reply.

Ian.
diff mbox

Patch

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index fdbb07b..0c515e1 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -267,6 +267,17 @@  int guest_physmap_add_page(struct domain *d,
                               mfn << PAGE_SHIFT, MATTR_MEM, 1);
 }
 
+int guest_physmap_add_page_rw(struct domain *d,
+                              unsigned long gpfn,
+                              unsigned long mfn,
+                              unsigned int page_order,
+                              bool_t rw)
+{
+    return create_p2m_entries(d, INSERT, gpfn << PAGE_SHIFT,
+                              (gpfn + (1 << page_order)) << PAGE_SHIFT,
+                              mfn << PAGE_SHIFT, MATTR_MEM, rw);
+}
+
 void guest_physmap_remove_page(struct domain *d,
                                unsigned long gpfn,
                                unsigned long mfn, unsigned int page_order)
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index c660820..250f916 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -54,6 +54,11 @@  int guest_physmap_add_page(struct domain *d,
                            unsigned long gfn,
                            unsigned long mfn,
                            unsigned int page_order);
+int guest_physmap_add_page_rw(struct domain *d,
+                              unsigned long gfn,
+                              unsigned long mfn,
+                              unsigned int page_order,
+                              bool_t rw);
 void guest_physmap_remove_page(struct domain *d,
                                unsigned long gpfn,
                                unsigned long mfn, unsigned int page_order);