[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v1] libxl: Add DTB compatible list to config file
From: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> 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@xxxxxxxxxxxxxxx> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |