diff mbox series

[v1,04/13] xen/arm: add P2M type parameter in guest_physmap_add_pages

Message ID 20220311061123.1883189-5-Penny.Zheng@arm.com (mailing list archive)
State New, archived
Headers show
Series Static shared memory on dom0less system | expand

Commit Message

Penny Zheng March 11, 2022, 6:11 a.m. UTC
From: Penny Zheng <penny.zheng@arm.com>

In order to cover the scenario where users intend to set up guest
p2m foreign mapping with nr_pages, this commit adds a new P2M type
parameter in guest_physmap_add_pages.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
 xen/arch/arm/domain_build.c    | 5 +++--
 xen/arch/arm/include/asm/p2m.h | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 6e6349caac..984e70e5fc 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -507,7 +507,7 @@  static bool __init append_static_memory_to_bank(struct domain *d,
     else
         sgfn = gaddr_to_gfn(mfn_to_maddr(smfn));
 
-    res = guest_physmap_add_pages(d, sgfn, smfn, nr_pages);
+    res = guest_physmap_add_pages(d, sgfn, smfn, nr_pages, p2m_ram_rw);
     if ( res )
     {
         dprintk(XENLOG_ERR, "Failed to map pages to DOMU: %d", res);
@@ -787,7 +787,8 @@  static int __init allocate_shared_memory(struct domain *d,
     if ( mfn_eq(smfn, INVALID_MFN) )
         return -EINVAL;
 
-    ret = guest_physmap_add_pages(d, gaddr_to_gfn(gbase), smfn, PFN_DOWN(psize));
+    ret = guest_physmap_add_pages(d, gaddr_to_gfn(gbase), smfn, PFN_DOWN(psize),
+                                  p2m_ram_rw);
     if ( ret )
     {
         dprintk(XENLOG_ERR, "Failed to map shared memory to %pd.\n", d);
diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h
index 8cce459b67..58590145b0 100644
--- a/xen/arch/arm/include/asm/p2m.h
+++ b/xen/arch/arm/include/asm/p2m.h
@@ -317,9 +317,10 @@  guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
 static inline int guest_physmap_add_pages(struct domain *d,
                                           gfn_t gfn,
                                           mfn_t mfn,
-                                          unsigned int nr_pages)
+                                          unsigned int nr_pages,
+                                          p2m_type_t t)
 {
-    return p2m_insert_mapping(d, gfn, nr_pages, mfn, p2m_ram_rw);
+    return p2m_insert_mapping(d, gfn, nr_pages, mfn, t);
 }
 
 mfn_t gfn_to_mfn(struct domain *d, gfn_t gfn);