From: Oleksandr Grytsov <al1img@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Oleksandr Grytsov <oleksandr_grytsov@epam.com>,
Iurii Konovalenko <iurii.konovalenko@globallogic.com>,
ian.jackson@eu.citrix.com, wl@xen.org,
Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Subject: [Xen-devel] [PATCH v1] libxl: Add DTB compatible list to config file
Date: Thu, 10 Oct 2019 17:12:31 +0300 [thread overview]
Message-ID: <20191010141231.25363-1-al1img@gmail.com> (raw)
From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Some platforms need more compatible property values in device
tree root node in addition to "xen,xenvm-%d.%d" and "xen,xenvm"
values that are given by Xen by default.
Specify in domain configuration file which values should be added
by providing "dtb_compatible" list of strings separated by comas.
Signed-off-by: Iurii Konovalenko <iurii.konovalenko@globallogic.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
tools/libxl/libxl_arm.c | 42 ++++++++++++++++++++++++++++++-------
tools/libxl/libxl_types.idl | 1 +
tools/xl/xl_parse.c | 7 +++++++
3 files changed, 42 insertions(+), 8 deletions(-)
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index bf31b9b3ca..b956a6356c 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -270,20 +270,46 @@ static int fdt_property_regs(libxl__gc *gc, void *fdt,
static int make_root_properties(libxl__gc *gc,
const libxl_version_info *vers,
- void *fdt)
+ void *fdt,
+ const libxl_domain_build_info *info)
{
- int res;
+ const char *compat0 = GCSPRINTF("xen,xenvm-%d.%d",
+ vers->xen_version_major,
+ vers->xen_version_minor);
+ const char *compat1 = "xen,xenvm";
+ const char **compats;
+ char *compat, *p;
+ size_t sz = 0;
+ int i, res, num_compats;
res = fdt_property_string(fdt, "model", GCSPRINTF("XENVM-%d.%d",
vers->xen_version_major,
vers->xen_version_minor));
if (res) return res;
- res = fdt_property_compat(gc, fdt, 2,
- GCSPRINTF("xen,xenvm-%d.%d",
- vers->xen_version_major,
- vers->xen_version_minor),
- "xen,xenvm");
+ num_compats = 2 + libxl_string_list_length(&info->dt_compatible);
+ compats = libxl__zalloc(gc, num_compats * sizeof(*compats));
+ if (!compats)
+ return -FDT_ERR_INTERNAL;
+
+ compats[0] = compat0;
+ compats[1] = compat1;
+ sz = strlen(compat0) + strlen(compat1) + 2;
+ for (i = 0; info->dt_compatible && info->dt_compatible[i] != NULL; i++) {
+ compats[2 + i] = info->dt_compatible[i];
+ sz += strlen(info->dt_compatible[i]) + 1;
+ }
+
+ p = compat = libxl__zalloc(gc, sz);
+ if (!p)
+ return -FDT_ERR_INTERNAL;
+
+ for (i = 0; i < num_compats; i++) {
+ strcpy(p, compats[i]);
+ p += strlen(compats[i]) + 1;
+ }
+
+ res = fdt_property(fdt, "compatible", compat, sz);
if (res) return res;
res = fdt_property_cell(fdt, "interrupt-parent", GUEST_PHANDLE_GIC);
@@ -930,7 +956,7 @@ next_resize:
FDT( fdt_begin_node(fdt, "") );
- FDT( make_root_properties(gc, vers, fdt) );
+ FDT( make_root_properties(gc, vers, fdt, info) );
FDT( make_chosen_node(gc, fdt, !!dom->modules[0].blob, state, info) );
FDT( make_cpus_node(gc, fdt, info->max_vcpus, ainfo) );
FDT( make_psci_node(gc, fdt) );
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 3ac9494b80..08ffb65904 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -544,6 +544,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
# Note that the partial device tree should avoid to use the phandle
# 65000 which is reserved by the toolstack.
("device_tree", string),
+ ("dt_compatible", libxl_string_list),
("acpi", libxl_defbool),
("bootloader", string),
("bootloader_args", libxl_string_list),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 03a2c54dd2..db9821c765 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2408,6 +2408,13 @@ skip_vfb:
}
}
+ e = xlu_cfg_get_list_as_string_list(config, "dt_compatible",
+ &b_info->dt_compatible, 1);
+ if (e && e != ESRCH) {
+ fprintf(stderr,"xl: Unable to parse dt_compatible\n");
+ exit(-ERROR_FAIL);
+ }
+
if (!xlu_cfg_get_list(config, "usbctrl", &usbctrls, 0, 0)) {
d_config->num_usbctrls = 0;
d_config->usbctrls = NULL;
--
2.17.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2019-10-10 14:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 14:12 Oleksandr Grytsov [this message]
2019-10-11 15:23 ` [Xen-devel] [XEN PATCH v1] libxl: Add DTB compatible list to config file Ian Jackson
2019-10-11 16:03 ` Julien Grall
2019-10-11 17:21 ` Stefano Stabellini
2019-10-16 14:04 ` Oleksandr Grytsov
2019-10-16 14:12 ` Julien Grall
2019-10-16 14:34 ` Oleksandr Grytsov
2019-10-16 15:04 ` Julien Grall
2019-10-23 16:11 ` Oleksandr
2019-10-23 17:01 ` 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=20191010141231.25363-1-al1img@gmail.com \
--to=al1img@gmail.com \
--cc=ian.jackson@eu.citrix.com \
--cc=iurii.konovalenko@globallogic.com \
--cc=oleksandr_andrushchenko@epam.com \
--cc=oleksandr_grytsov@epam.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.