From: Stefano Stabellini <sstabellini@kernel.org>
To: xen-devel@lists.xen.org
Cc: Stefano Stabellini <stefanos@xilinx.com>,
sstabellini@kernel.org, wei.liu2@citrix.com,
blackskygg@gmail.com, ian.jackson@eu.citrix.com,
julien.grall@arm.com
Subject: [PATCH v7 8/8] xen/arm: add xen,dmabuf nodes
Date: Fri, 10 Aug 2018 17:00:16 -0700 [thread overview]
Message-ID: <1533945616-14915-8-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1808101430480.32304@sstabellini-ThinkPad-X260>
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@xilinx.com>
---
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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-08-11 0:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 23:59 [PATCH v7 0/8] Allow setting up shared memory areas between VMs from xl config files Stefano Stabellini
2018-08-11 0:00 ` [PATCH v7 1/8] xen: xsm: flask: introduce XENMAPSPACE_gmfn_share for memory sharing Stefano Stabellini
2018-08-28 17:10 ` Julien Grall
2018-09-11 23:15 ` Stefano Stabellini
2018-08-11 0:00 ` [PATCH v7 2/8] libxl: introduce a new structure to represent static shared memory regions Stefano Stabellini
2018-08-28 17:18 ` Julien Grall
2018-09-11 23:09 ` Stefano Stabellini
2018-09-12 10:29 ` Julien Grall
2018-10-31 15:17 ` Wei Liu
2018-08-11 0:00 ` [PATCH v7 3/8] libxl: support mapping static shared memory areas during domain creation Stefano Stabellini
2018-08-11 0:00 ` [PATCH v7 4/8] libxl: support unmapping static shared memory areas during domain destruction Stefano Stabellini
2018-08-11 0:00 ` [PATCH v7 5/8] libxl:xl: add parsing code to parse "libxl_static_sshm" from xl config files Stefano Stabellini
2018-08-11 0:00 ` [PATCH v7 6/8] docs: documentation about static shared memory regions Stefano Stabellini
2018-08-11 0:00 ` [PATCH v7 7/8] xen/arm: export shared memory regions as reserved-memory on device tree Stefano Stabellini
2018-08-28 17:26 ` Julien Grall
2018-09-11 23:10 ` Stefano Stabellini
2018-08-11 0:00 ` Stefano Stabellini [this message]
2018-08-28 17:37 ` [PATCH v7 8/8] xen/arm: add xen,dmabuf nodes Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1533945616-14915-8-git-send-email-sstabellini@kernel.org \
--to=sstabellini@kernel.org \
--cc=blackskygg@gmail.com \
--cc=ian.jackson@eu.citrix.com \
--cc=julien.grall@arm.com \
--cc=stefanos@xilinx.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).