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

[Xen-devel] [PATCH v7 8/8] xen/arm: add xen,dmabuf nodes



Add a "xen-dmabuf" device node for every shared region, compatible
"xen,dmabuf". Each of these nodes refers to the corresponding
reserved-memory node using a phandle.

These device nodes can be used to bind drivers that export the region to
userspace, or do other operations based on the reserved memory region.

Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
---
Changes in v7:
- new patch
---
 tools/libxl/libxl_arm.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 72dd0d2..e09a049 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -466,6 +466,7 @@ static int make_reserved_nodes(libxl__gc *gc, void *fdt,
 {
     int res, i;
     const char *name;
+    uint32_t phandle;
 
     if (d_config->num_sshms == 0)
         return 0;
@@ -482,7 +483,9 @@ static int make_reserved_nodes(libxl__gc *gc, void *fdt,
     res = fdt_property(fdt, "ranges", NULL, 0);
     if (res) return res;
 
-    for (i = 0; i < d_config->num_sshms; i++) {
+    for (i = 0, phandle = PHANDLE_GIC - 1;
+         i < d_config->num_sshms;
+         i++, phandle--) {
         uint64_t start = d_config->sshms[i].begin;
         if (d_config->sshms[i].role == LIBXL_SSHM_ROLE_SLAVE)
             start += d_config->sshms[i].offset;
@@ -501,6 +504,9 @@ static int make_reserved_nodes(libxl__gc *gc, void *fdt,
         res = fdt_property_string(fdt, "id", d_config->sshms[i].id);
         if (res) return res;
 
+        res = fdt_property_cell(fdt, "phandle", phandle);
+        if (res) return res;
+
         res = fdt_end_node(fdt);
         if (res) return res;
     }
@@ -508,6 +514,27 @@ static int make_reserved_nodes(libxl__gc *gc, void *fdt,
     res = fdt_end_node(fdt);
     if (res) return res;
 
+    for (i = 0, phandle = PHANDLE_GIC - 1;
+         i < d_config->num_sshms;
+         i++, phandle--) {
+        uint64_t start = d_config->sshms[i].begin;
+        if (d_config->sshms[i].role == LIBXL_SSHM_ROLE_SLAVE)
+            start += d_config->sshms[i].offset;
+        name = GCSPRINTF("xen-dmabuf@%"PRIx64, start);
+
+        res = fdt_begin_node(fdt, name);
+        if (res) return res;
+
+        res = fdt_property_compat(gc, fdt, 1, "xen,dmabuf");
+        if (res) return res;
+
+        res = fdt_property_cell(fdt, "memory-region", phandle);
+        if (res) return res;
+
+        res = fdt_end_node(fdt);
+        if (res) return res;
+    }
+
     return 0;
 }
 
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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