[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 10/10] xen/arm: create another /memory node for static shm



Static shared memory region shall be described both under /memory and
/reserved-memory.

We introduce export_shm_memory_node() to create another /memory node to
contain the static shared memory ranges.

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>

---
v3 -> v4:
new commit
---
 xen/arch/arm/domain_build.c | 43 +++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index dad234e4b5..21e5c622a3 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1714,6 +1714,25 @@ static int __init make_memory_node(const struct domain 
*d,
 }
 
 #ifdef CONFIG_STATIC_SHM
+static int __init export_shm_memory_node(const struct domain *d,
+                                         const struct kernel_info *kinfo,
+                                         int addrcells, int sizecells)
+{
+    unsigned int i = 0;
+    struct meminfo shm_meminfo;
+
+    /* Extract meminfo from kinfo.shminfo */
+    for ( ; i < kinfo->shminfo.nr_banks; i++ )
+    {
+        shm_meminfo.bank[i].start = kinfo->shminfo.bank[i].membank.start;
+        shm_meminfo.bank[i].size = kinfo->shminfo.bank[i].membank.size;
+        shm_meminfo.bank[i].type = MEMBANK_DEFAULT;
+    }
+    shm_meminfo.nr_banks = kinfo->shminfo.nr_banks;
+
+    return make_memory_node(d, kinfo->fdt, addrcells, sizecells, &shm_meminfo);
+}
+
 static int __init make_shm_memory_node(const struct domain *d,
                                        void *fdt,
                                        int addrcells, int sizecells,
@@ -1782,6 +1801,14 @@ static int __init make_shm_memory_node(const struct 
domain *d,
     return res;
 }
 #else
+static int __init export_shm_memory_node(const struct domain *d,
+                                         const struct kernel_info *kinfo,
+                                         int addrcells, int sizecells)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}
+
 static int __init make_shm_memory_node(const struct domain *d,
                                        void *fdt,
                                        int addrcells, int sizecells,
@@ -2877,6 +2904,14 @@ static int __init handle_node(struct domain *d, struct 
kernel_info *kinfo,
                 return res;
         }
 
+        /* Create a memory node to store the static shared memory regions */
+        if ( kinfo->shminfo.nr_banks != 0 )
+        {
+            res = export_shm_memory_node(d, kinfo, addrcells, sizecells);
+            if ( res )
+                return res;
+        }
+
         /* Avoid duplicate /reserved-memory nodes in Device Tree */
         if ( !kinfo->resv_mem )
         {
@@ -3437,6 +3472,14 @@ static int __init prepare_dtb_domU(struct domain *d, 
struct kernel_info *kinfo)
     if ( ret )
         goto err;
 
+    /* Create a memory node to store the static shared memory regions */
+    if ( kinfo->shminfo.nr_banks != 0 )
+    {
+        ret = export_shm_memory_node(d, kinfo, addrcells, sizecells);
+        if ( ret )
+            goto err;
+    }
+
     ret = make_resv_memory_node(d, kinfo->fdt, addrcells, sizecells, kinfo);
     if ( ret )
         goto err;
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.