From nobody Fri Mar 29 05:24:55 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1570716840; cv=none; d=zoho.com; s=zohoarc; b=ARQxAaLF04cqYtcmb9k6woRjN5Na+YGWZNAiSmkYL9o4zctcczP1J9eIVXM8NjW3rBhPGMJfX5C3Yhi+5NVOy3k79vQZp8DlaSYv0gVTEVJ6kGGzcoMmjyqQTRaPUuMA0IQjLM0vPRiV2WtJHaDVuIqiUJgeIi0YxcTTQKoIvRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570716840; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=j8qKVrRlGDRnoYAMoWLUvGuDSAYimyCyXiJViJj/lcI=; b=UyKeprlrBco2qBcEzU/5nBbJnaHfu8EVIswZCjzIJHRjmzh8rihLyPHeRMQVtXR5KlVTeBC9U7vJ451t1BOZ+hp4/xRWF7E42SCFl2mt8leJDL+zKz2JY0BSn+yhGBWZ9PGQWhnd5GRKVg7maXO8UFrAainvoQXTHXXqAm/WQbM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570716840091709.6549795601486; Thu, 10 Oct 2019 07:14:00 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iIZBN-00008k-Qs; Thu, 10 Oct 2019 14:12:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iIZBM-00008f-F1 for xen-devel@lists.xenproject.org; Thu, 10 Oct 2019 14:12:44 +0000 Received: from mail-lf1-x144.google.com (unknown [2a00:1450:4864:20::144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0675c5d4-eb68-11e9-a531-bc764e2007e4; Thu, 10 Oct 2019 14:12:43 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id t8so4478437lfc.13 for ; Thu, 10 Oct 2019 07:12:43 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-22.209.223.85.sovam.net.ua. [85.223.209.22]) by smtp.gmail.com with ESMTPSA id q5sm1387549lfm.93.2019.10.10.07.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 07:12:41 -0700 (PDT) X-Inumbo-ID: 0675c5d4-eb68-11e9-a531-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=tHVNfKcoCCgRGpHvQ2CBeSdDo+ljTpuAZA/KupRCU1s=; b=H2RJeAefbAriAht9HtmSwWxnZO7K/gmvqxZjaRBPLn9VaeYKBRPl441896dysH2Zw8 XWb8BR5/dLZbMgEPSnnU+i1toUdMZRpHNVCLE87/wUB6UNgSPxx0O5iMsYdQj++C+Zef evE5lz0RrHtg5HCfFNy1ny7e1FQ0M6+R7zRXZDSnyMAJgbynVD+J8Eo3UPdFVBgYrKlP 6sAZgs9nkDmtdVOZ9O+kVD5QD75z2DnEPYuYtUtepjKSqsVgM4XfGXHx3RLVz6Y7z7ex J5MEHDeBXyNOArHB4nFN4yJi75DxgkShpydt1p9vjplTEmbhHgilpTPgilNgeoWfy2/b whSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tHVNfKcoCCgRGpHvQ2CBeSdDo+ljTpuAZA/KupRCU1s=; b=MX7FZ2q9CAMDRoU4+dX2DDBMOaqbZdqpjtcTudNJUYkQqTbozlJ8dr5X6SZcWZOeTd GbKDZRQBwObKjjKqtbL1K/NvN+ED9INY66EwLMQqxCe1s4cGFbEgruxRKqrYcokBzq4n y0ybrOp3Xl/RyiHphF0AQPOtBCaUvQ5XquXiQY8n0JNI/NKOtx2Klp/7i/blKOmppBv/ ecsWqf3zf7X/n6DZrQL3/8jAVIf2MYfNbqDnupPEOJZ+GQ0pZoj90WZ/CYz1ZE9cMx4S RuDWvemUsmlEGUkAeO1rjaYYcciQtq3/BoioJ4dxI4fxwQN9w1Tg76azA1/8nYTLOmcO +W+g== X-Gm-Message-State: APjAAAW+7rchxQsRcUKMb1wlUSCq7QSoEfjbNRv5VmSI4hYT+avgnpVv mUw+hAuCjJSCBXU+JWWrXKe4xfCe6a5kmQ== X-Google-Smtp-Source: APXvYqyldasoVJgdJi02sBr1o7OYS0NKR0vfixwiws4qo5DbudetZOiqism0y9AxKBiZfgHCBRnaCw== X-Received: by 2002:ac2:533c:: with SMTP id f28mr6076035lfh.77.1570716762131; Thu, 10 Oct 2019 07:12:42 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Thu, 10 Oct 2019 17:12:31 +0300 Message-Id: <20191010141231.25363-1-al1img@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH v1] libxl: Add DTB compatible list to config file X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr Grytsov , Iurii Konovalenko , ian.jackson@eu.citrix.com, wl@xen.org, Oleksandr Andrushchenko MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Oleksandr Grytsov 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 Signed-off-by: Oleksandr Andrushchenko --- 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, =20 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 =3D GCSPRINTF("xen,xenvm-%d.%d", + vers->xen_version_major, + vers->xen_version_minor); + const char *compat1 =3D "xen,xenvm"; + const char **compats; + char *compat, *p; + size_t sz =3D 0; + int i, res, num_compats; =20 res =3D fdt_property_string(fdt, "model", GCSPRINTF("XENVM-%d.%d", vers->xen_version_ma= jor, vers->xen_version_mi= nor)); if (res) return res; =20 - res =3D fdt_property_compat(gc, fdt, 2, - GCSPRINTF("xen,xenvm-%d.%d", - vers->xen_version_major, - vers->xen_version_minor), - "xen,xenvm"); + num_compats =3D 2 + libxl_string_list_length(&info->dt_compatible); + compats =3D libxl__zalloc(gc, num_compats * sizeof(*compats)); + if (!compats) + return -FDT_ERR_INTERNAL; + + compats[0] =3D compat0; + compats[1] =3D compat1; + sz =3D strlen(compat0) + strlen(compat1) + 2; + for (i =3D 0; info->dt_compatible && info->dt_compatible[i] !=3D NULL;= i++) { + compats[2 + i] =3D info->dt_compatible[i]; + sz +=3D strlen(info->dt_compatible[i]) + 1; + } + + p =3D compat =3D libxl__zalloc(gc, sz); + if (!p) + return -FDT_ERR_INTERNAL; + + for (i =3D 0; i < num_compats; i++) { + strcpy(p, compats[i]); + p +=3D strlen(compats[i]) + 1; + } + + res =3D fdt_property(fdt, "compatible", compat, sz); if (res) return res; =20 res =3D fdt_property_cell(fdt, "interrupt-parent", GUEST_PHANDLE_GIC); @@ -930,7 +956,7 @@ next_resize: =20 FDT( fdt_begin_node(fdt, "") ); =20 - 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 =3D 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: } } =20 + e =3D xlu_cfg_get_list_as_string_list(config, "dt_compatible", + &b_info->dt_compatible, 1); + if (e && e !=3D 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 =3D 0; d_config->usbctrls =3D NULL; --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel