Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2219347/?format=api
{ "id": 2219347, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2219347/?format=api", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.0/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260402215629.745866-8-ruslichenko.r@gmail.com>", "date": "2026-04-02T21:55:52", "name": "[v3,07/33] hw/core/fdt_generic_util: implement main fdt parse routine", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6fd3508e01a4085bd95d42216012132fcf484884", "submitter": { "id": 92275, "url": "http://patchwork.ozlabs.org/api/1.0/people/92275/?format=api", "name": "Ruslan Ruslichenko", "email": "ruslichenko.r@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260402215629.745866-8-ruslichenko.r@gmail.com/mbox/", "series": [ { "id": 498555, "url": "http://patchwork.ozlabs.org/api/1.0/series/498555/?format=api", "date": "2026-04-02T21:55:47", "name": "hw/arm: Introduce generic FDT-driven machine", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/498555/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219347/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=dT7VhH+m;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmwjR5gCSz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 08:58:51 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w8Q28-0008IK-OF; Thu, 02 Apr 2026 17:57:00 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <ruslichenko.r@gmail.com>)\n id 1w8Q26-0008HA-2Y\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:56:58 -0400", "from mail-ej1-x636.google.com ([2a00:1450:4864:20::636])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <ruslichenko.r@gmail.com>)\n id 1w8Q23-00074q-W7\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:56:57 -0400", "by mail-ej1-x636.google.com with SMTP id\n a640c23a62f3a-b886fc047d5so215721366b.3\n for <qemu-devel@nongnu.org>; Thu, 02 Apr 2026 14:56:55 -0700 (PDT)", "from thinkpad-t470s.. (93-143-182-244.adsl.net.t-com.hr.\n [93.143.182.244]) by smtp.googlemail.com with ESMTPSA id\n a640c23a62f3a-b9c3cac0e1asm134009166b.27.2026.04.02.14.56.52\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 02 Apr 2026 14:56:53 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775167014; x=1775771814; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=s2VB2KnW0z4RzTP8lm44NrAlc23AvjlzFHSTzJSgaMs=;\n b=dT7VhH+maMdQnEJyyjkivkP8ududpkdHYEzmED5jlxC2kFmCxw1NkCgrRY+CxW4oKU\n jSaSmMAcpAI4p2LfgWUekO2GRcgLZZJ9RpIVXzj1JJ9uJvccuizUcMxke8ZPT/xLMfSJ\n vWZ3+SbXTk3eEWfH6IXhfMwqfBRh1LqZAoQfUgEuMHv3yugAH0V+vnVITwpnwatD+4Uj\n lf25Cx5as6tLI1w00VEYFPLurDL9ACz4FcMdGvEzCmxcHXi7R1Q3wqyawixvOtFXV34g\n GAHIgknnwlrzKjlFWIyJqugDVPiZs29xJkbaz7yUx5gtzyDd0fGCH7TLaTAltVDuSsmz\n 9Ygw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775167014; x=1775771814;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=s2VB2KnW0z4RzTP8lm44NrAlc23AvjlzFHSTzJSgaMs=;\n b=J15QlmkZgjwl08cugVtP1JubC9+DlmjG+6YLA1XTKCgyEDW1pFKmrhgi89dLovQqq8\n WVphJ18rglsEycWYqIrUwB6kqw3whn1rPZW90tk1JfQPe+AHFl0H9BTgliLGpdCNhovt\n whj4ZrqfKCcpqb+I7dIGwB1rkDE4u/sroyZ0zMy6xSKihCQcHYsJkIGMSKPFSdQX2QVK\n 75VH0YJXiwSu0LKRl+GZIkU3MNTGE24UkgHzmbYNeY9vsnbrHfH9S7mXgNupHqM9glW/\n fLUzakNhgmm2mYu/i+BVbv12hmC5NwuqaAl8RTjjo+zsUkCKRI5LQK4iL8SjLUKRUK9k\n +gbw==", "X-Gm-Message-State": "AOJu0YyFvdaGSg32uDOV7ZmT0RuEJWEAHuGfDb8Y4Dd7n+W3N2fbA41v\n u57ceWHv6jSFPAO7dt55bjQE1K7fPD5YXClYDQLbX0PSOPSTa7VCrUUFDx3Vkxph", "X-Gm-Gg": "ATEYQzwE7DgJCnMObvyiIw+xgxHLRU+Ch+MUW6QIOzoXFGtuDYM7cwUkq6Oul5nS1/K\n HH5ryWKDgYCj78lNTfpg6AQpnYCJnaBxu0v6dMKPj6QQCVA/iCr5k3y+gSrtbvQ21+G7NlmEe6G\n rkmC7MozWFcdwx+mgfDxH2ctecRmXeENEJ54Zfrs91gbTzNJy2bOE5S5YqkhWkbqDd3VQukvV4z\n lB1K69a31yveBsY18kXEYInle8lA/XSBJorhWMJZWqjwgNhvWvy46y3JGAzdnoIwXFigYHBaRSH\n O5BV6wuyk/1qmOEm9WM3zPSBKYyVBXowbNzSWWFw4uQcTIgyLkwr64WDJmTbvQcWs936OVli0DB\n Wi/ZUu8PDjPT3xn/Vj85LTo2n5KkD0WbUfiWLROm+jZXDVq1z9KTyouCjPq9sU7sqOVCGJcjhF/\n WOusNlxcsAXJ2nzBUnorCSRwkiZMV+rJ+7KLWoG1fVByb9q8zh2SjwKyWcnCgwCidmpvkW0Q==", "X-Received": "by 2002:a17:906:f581:b0:b9b:1b9e:1e99 with SMTP id\n a640c23a62f3a-b9c679580b6mr27709066b.34.1775167013952;\n Thu, 02 Apr 2026 14:56:53 -0700 (PDT)", "From": "Ruslan Ruslichenko <ruslichenko.r@gmail.com>", "To": "qemu-devel@nongnu.org", "Cc": "qemu-arm@nongnu.org, alex.bennee@linaro.org, peter.maydell@linaro.org,\n artem_mygaiev@epam.com, volodymyr_babchuk@epam.com,\n takahiro.nakata.wr@renesas.com,\n \"Edgar E . Iglesias\" <edgar.iglesias@gmail.com>,\n Ruslan_Ruslichenko@epam.com, balaton@eik.bme.hu", "Subject": "[PATCH v3 07/33] hw/core/fdt_generic_util: implement main fdt parse\n routine", "Date": "Thu, 2 Apr 2026 23:55:52 +0200", "Message-ID": "<20260402215629.745866-8-ruslichenko.r@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260402215629.745866-1-ruslichenko.r@gmail.com>", "References": "<20260402215629.745866-1-ruslichenko.r@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2a00:1450:4864:20::636;\n envelope-from=ruslichenko.r@gmail.com; helo=mail-ej1-x636.google.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>\n\nImplement main fdt_generic_create_machine() routine.\n\nAs of now do the following:\n\n- parse each node and subnode in device tree\n- check node has correct compatible or device types\n- call fdt_init_qdev() which will eventually create\n device object.\n\nThe MIT license of fdt_generic_util.c preserved as in original\nfile from https://github.com/Xilinx/qemu.git repo.\n\nThe license for fdt_generic_util.h derived from matching\nfdt_generic_util.c file.\n\nSigned-off-by: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>\n---\n hw/core/fdt_generic_util.c | 233 +++++++++++++++++++++++++++++\n include/hw/core/fdt_generic_util.h | 19 +++\n 2 files changed, 252 insertions(+)\n create mode 100644 hw/core/fdt_generic_util.c\n create mode 100644 include/hw/core/fdt_generic_util.h", "diff": "diff --git a/hw/core/fdt_generic_util.c b/hw/core/fdt_generic_util.c\nnew file mode 100644\nindex 0000000000..2f7a3fc3dd\n--- /dev/null\n+++ b/hw/core/fdt_generic_util.c\n@@ -0,0 +1,233 @@\n+/*\n+ * SPDX-License-Identifier: MIT\n+ *\n+ * Utility functions for fdt generic framework\n+ *\n+ * Copyright (c) 2009 Edgar E. Iglesias.\n+ * Copyright (c) 2009 Michal Simek.\n+ * Copyright (c) 2011 PetaLogix Qld Pty Ltd.\n+ * Copyright (c) 2011 Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>.\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"hw/core/fdt_generic_util.h\"\n+#include \"system/memory.h\"\n+#include \"system/address-spaces.h\"\n+#include \"hw/core/sysbus.h\"\n+#include \"qapi/error.h\"\n+#include \"qemu/error-report.h\"\n+#include \"system/system.h\"\n+#include \"system/reset.h\"\n+#include \"qemu/cutils.h\"\n+#include \"qemu/log.h\"\n+#include \"qemu/config-file.h\"\n+#include \"hw/core/boards.h\"\n+#include \"qemu/option.h\"\n+\n+#define fdt_debug(...) do { \\\n+ qemu_log_mask(LOG_FDT, \": %s: \", __func__); \\\n+ qemu_log_mask(LOG_FDT, ## __VA_ARGS__); \\\n+} while (0)\n+\n+#define fdt_debug_np(...) do { \\\n+ qemu_log_mask(LOG_FDT, \"%s\", node_path); \\\n+ fdt_debug(__VA_ARGS__); \\\n+} while (0)\n+\n+/* FIXME: wrap direct calls into libfdt */\n+\n+#include <libfdt.h>\n+#include <stdlib.h>\n+\n+static int fdt_generic_num_cpus;\n+\n+static int simple_bus_fdt_init(const char *bus_node_path, FDTMachineInfo *fdti);\n+\n+FDTMachineInfo *fdt_generic_create_machine(void *fdt, qemu_irq *cpu_irq)\n+{\n+ FDTMachineInfo *fdti = fdt_init_new_fdti(fdt);\n+\n+ fdti->irq_base = cpu_irq;\n+\n+ /* parse the device tree */\n+ memory_region_transaction_begin();\n+ fdt_init_set_opaque(fdti, \"/\", NULL);\n+ simple_bus_fdt_init(\"/\", fdti);\n+ while (qemu_co_enter_next(fdti->cq, NULL)) {\n+ ;\n+ }\n+ memory_region_transaction_commit();\n+\n+ /* FIXME: Populate these from DTS and create CPU clusters. */\n+ current_machine->smp.cores = fdt_generic_num_cpus;\n+ current_machine->smp.cpus = fdt_generic_num_cpus;\n+ current_machine->smp.max_cpus = fdt_generic_num_cpus;\n+\n+ fdt_debug(\"FDT: Device tree scan complete\\n\");\n+ return fdti;\n+}\n+\n+struct FDTInitNodeArgs {\n+ char *node_path;\n+ char *parent_path;\n+ FDTMachineInfo *fdti;\n+};\n+\n+static int fdt_init_qdev(char *node_path, FDTMachineInfo *fdti, char *compat);\n+\n+static int check_compat(const char *prefix, const char *compat,\n+ char *node_path, FDTMachineInfo *fdti)\n+{\n+ char *compat_prefixed = g_strconcat(prefix, compat, NULL);\n+ const int done = !fdt_init_compat(node_path, fdti, compat_prefixed);\n+ g_free(compat_prefixed);\n+ return done;\n+}\n+\n+static void fdt_init_node(void *args)\n+{\n+ struct FDTInitNodeArgs *a = args;\n+ char *node_path = a->node_path;\n+ FDTMachineInfo *fdti = a->fdti;\n+ g_free(a);\n+\n+ simple_bus_fdt_init(node_path, fdti);\n+\n+ const char *prop;\n+ char *all_compats = NULL, *node_name;\n+ char *device_type = NULL;\n+ int prop_len;\n+\n+ fdt_debug_np(\"enter\\n\");\n+\n+ /* try instance binding first */\n+ node_name = strrchr(node_path, '/') + 1;\n+ fdt_debug_np(\"node with name: %s\\n\", node_name ? node_name : \"(none)\");\n+ if (!node_name) {\n+ fdt_debug(\"FDT: ERROR: nameless node: %s\\n\", node_path);\n+ }\n+ if (!fdt_init_inst_bind(node_path, fdti, node_name)) {\n+ fdt_debug_np(\"instance bind successful\\n\");\n+ goto exit;\n+ }\n+\n+ /* fallback to compatibility binding */\n+ prop = qemu_fdt_getprop(fdti->fdt, node_path, \"compatible\",\n+ &prop_len, NULL);\n+ all_compats = g_memdup2(prop, prop_len);\n+ if (all_compats) {\n+ char *compat = all_compats;\n+ char * const end = &all_compats[prop_len - 1]; /* points to nul */\n+\n+ while (compat < end) {\n+ if (check_compat(\"compatible:\", compat, node_path, fdti)) {\n+ goto exit;\n+ }\n+\n+ if (!fdt_init_qdev(node_path, fdti, compat)) {\n+ check_compat(\"postinit:\", compat, node_path, fdti);\n+ goto exit;\n+ }\n+\n+ /* Scan forward to the end of the current compat. */\n+ while (compat < end && *compat) {\n+ ++compat;\n+ }\n+\n+ /* Replace nul with space for the debug printf below. */\n+ if (compat < end) {\n+ *compat++ = ' ';\n+ }\n+ };\n+ } else {\n+ fdt_debug_np(\"no compatibility found\\n\");\n+ }\n+\n+ /*\n+ * Try to create the device using device_type property\n+ * Not every device tree node has compatible property, so\n+ * try with device_type.\n+ */\n+ prop = qemu_fdt_getprop(fdti->fdt, node_path,\n+ \"device_type\", &prop_len, NULL);\n+ device_type = g_memdup2(prop, prop_len);\n+ if (device_type) {\n+ if (check_compat(\"device_type:\", device_type, node_path, fdti)) {\n+ goto exit;\n+ }\n+\n+ if (!fdt_init_qdev(node_path, fdti, device_type)) {\n+ goto exit;\n+ }\n+ }\n+\n+ if (all_compats) {\n+ fdt_debug_np(\"FDT: Unsupported peripheral invalidated - \"\n+ \"compatibilities %s\\n\", all_compats);\n+ qemu_fdt_setprop_string(fdti->fdt, node_path, \"compatible\",\n+ \"invalidated\");\n+ }\n+exit:\n+\n+ fdt_debug_np(\"exit\\n\");\n+\n+ if (!fdt_init_has_opaque(fdti, node_path)) {\n+ fdt_init_set_opaque(fdti, node_path, NULL);\n+ }\n+ g_free(node_path);\n+ g_free(all_compats);\n+ g_free(device_type);\n+ return;\n+}\n+\n+static int simple_bus_fdt_init(const char *node_path, FDTMachineInfo *fdti)\n+{\n+ int i;\n+ char **children;\n+ int num_children = qemu_devtree_get_num_children(fdti->fdt, node_path);\n+\n+ if (num_children <= 0) {\n+ return 0;\n+ }\n+\n+ children = g_malloc0(sizeof(*children) * num_children);\n+\n+ num_children = qemu_devtree_get_children(fdti->fdt, node_path, num_children,\n+ children);\n+\n+ fdt_debug_np(\"num child devices: %d\\n\", num_children);\n+\n+ for (i = 0; i < num_children; i++) {\n+ struct FDTInitNodeArgs *init_args = g_malloc0(sizeof(*init_args));\n+ init_args->node_path = children[i];\n+ init_args->fdti = fdti;\n+ qemu_coroutine_enter(qemu_coroutine_create(fdt_init_node, init_args));\n+ }\n+\n+ g_free(children);\n+ return 0;\n+}\n+\n+static int fdt_init_qdev(char *node_path, FDTMachineInfo *fdti, char *compat)\n+{\n+ return 0;\n+}\n+\ndiff --git a/include/hw/core/fdt_generic_util.h b/include/hw/core/fdt_generic_util.h\nnew file mode 100644\nindex 0000000000..71bedb6631\n--- /dev/null\n+++ b/include/hw/core/fdt_generic_util.h\n@@ -0,0 +1,19 @@\n+/* SPDX-License-Identifier: MIT */\n+\n+#ifndef FDT_GENERIC_UTIL_H\n+#define FDT_GENERIC_UTIL_H\n+\n+#include \"qemu/help-texts.h\"\n+#include \"fdt_generic.h\"\n+#include \"system/memory.h\"\n+#include \"qom/object.h\"\n+\n+/*\n+ * create a fdt_generic machine. the top level cpu irqs are required for\n+ * systems instantiating interrupt devices. The client is responsible for\n+ * destroying the returned FDTMachineInfo (using fdt_init_destroy_fdti)\n+ */\n+\n+FDTMachineInfo *fdt_generic_create_machine(void *fdt, qemu_irq *cpu_irq);\n+\n+#endif /* FDT_GENERIC_UTIL_H */\n", "prefixes": [ "v3", "07/33" ] }