Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2198206/?format=api
{ "id": 2198206, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2198206/?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": "<20260219143332.3316679-5-ruslichenko.r@gmail.com>", "date": "2026-02-19T14:33:03", "name": "[v2,04/33] hw/core: introduce generic FDT device model registry", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "16651d9965f7c5681fd17175d87c16c79854e2cc", "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/20260219143332.3316679-5-ruslichenko.r@gmail.com/mbox/", "series": [ { "id": 492690, "url": "http://patchwork.ozlabs.org/api/1.0/series/492690/?format=api", "date": "2026-02-19T14:33:04", "name": "hw/arm: Introduce generic FDT-driven machine", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/492690/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2198206/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=20230601 header.b=kecuM3vb;\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 4fGx020l0Cz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 20 Feb 2026 01:41:22 +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 1vt57A-0008WC-Rr; Thu, 19 Feb 2026 09:34:48 -0500", "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 1vt578-0008Tq-Av\n for qemu-devel@nongnu.org; Thu, 19 Feb 2026 09:34:46 -0500", "from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c])\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 1vt576-0002w7-AR\n for qemu-devel@nongnu.org; Thu, 19 Feb 2026 09:34:46 -0500", "by mail-wr1-x42c.google.com with SMTP id\n ffacd0b85a97d-4362197d174so685712f8f.3\n for <qemu-devel@nongnu.org>; Thu, 19 Feb 2026 06:34:43 -0800 (PST)", "from thinkpad-t470s.. (93-143-129-182.adsl.net.t-com.hr.\n [93.143.129.182]) by smtp.googlemail.com with ESMTPSA id\n ffacd0b85a97d-43796abd259sm52022770f8f.24.2026.02.19.06.34.40\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 19 Feb 2026 06:34:41 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1771511682; x=1772116482; 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=MEJ+cQW0XDvgt8fKdFK82Ac1+oKK3ySwvUaxyxGmSvw=;\n b=kecuM3vbUDbUxA2qAzdl4aKmtzLojYRKCVvsaZLzjLOwYKxxSkcyWgLhdrBJJ0kSrT\n Yy+VRGIRJhpCFTl6DLkxFf2igrWhBBO1r2dMBTjU7LWvK9ojRgbXxLL9mpn18aMWEQ41\n Vu9HBrN4x5+xuvmGgDGtp09YyEePMBEfPlPyA3OKbd8kXG4uoZTK3vchzW25fMcj3DtD\n A2yjOsrYrWmGjxEDfsmzAIyeiuSutpLpXl82xKzN4xxrFT9/9MWtKc0gCv26Kitqub7O\n /UpTqv99fvev9+ShIYXEZcm0Ns1yixjyb7Mrzs8U49wQkAKH7IxzxBZdt/MK9ZE+uFoq\n d+vA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1771511682; x=1772116482;\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=MEJ+cQW0XDvgt8fKdFK82Ac1+oKK3ySwvUaxyxGmSvw=;\n b=NiVET8jP3QUMKIqD5QnrJFUPdQD1MK5yleaYYZtI7dku/v3uIUR19DqffquhZLrM9B\n pXZHeMNl+dGstYCareev8nbSysZ/B9+G3hmZX470qHvGriFYUXrUvN4mA0lN0Sns1w96\n JEYnpTuTSfoBBhW7J6/w85S5XW+QI+lgx6J6s9puKCsfeRGrovB7HiemBhuzs3bKs3tG\n shbByU5Xh907usPuwFEH0Fyk6j989MZyR21b2LArY70AGrvjCm3xngq/5/caXYiTmoMN\n +5d/cxr3rppkiTyXCyetiFj87bNsjATilqY8qSSFXua+8GWh6XFUyuYudoDUfIReEbbg\n nfdA==", "X-Gm-Message-State": "AOJu0YyW3kWAPFJUYoWmK5Snbby/XlqXwDKF5fQ6xUHGS7yTRbUvgwB3\n 5v8XwXW5o1Gb8iwp7XKpTwiSvDfaBhgyPgBSmoiifnI2FZx8W7NQYZsVx7iQdWRd", "X-Gm-Gg": "AZuq6aLpRvPQ5REpE8Go00ewqN6xPOj1aL2X6P0uGupUW2Xyn//ntyNG4RfH0yt8IvC\n eLGLE+r+ywIue9nWucJNpViA+8nowEPwYLC4+R4abBnJkxP12MfTTtG+0OB0Ee3fbCcuWVy/wkz\n SQjsjTotdNXXHHsrRH4dxpiD/9reoQOBkRMqZLtB8ZnoBSguSjcLr3yc0eLEFGW85GeExhfDr/m\n uILkJoef/jsxXRT80si6mjrykAiu36D4Dkt+V6pUafhHDqkgVjMdsrlLrwFi4mNl/25QGuf2gVf\n OKSY831IIAdgbLienMMJucTepwZaqxYi+i916ufeGej3OQzmRqjuiSP87srYvHaBZ6T78Axntpe\n xvbUbDqpnBZfR5vYdSEEB2BHBKhfApQPmAYInor6UenA/EqwzRlVTWO2llrtHFHpFZTHtLKgbJ7\n mizBSOv8amtdvl5Cw+f4i8SYMa5w4ggSyytPV/ibQvzGRyZv3munN0cpqqotZJPf4m69Lt", "X-Received": "by 2002:a05:6000:4283:b0:435:e520:d1d7 with SMTP id\n ffacd0b85a97d-43958e554a3mr9872115f8f.63.1771511682257;\n Thu, 19 Feb 2026 06:34:42 -0800 (PST)", "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 v2 04/33] hw/core: introduce generic FDT device model registry", "Date": "Thu, 19 Feb 2026 15:33:03 +0100", "Message-ID": "<20260219143332.3316679-5-ruslichenko.r@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260219143332.3316679-1-ruslichenko.r@gmail.com>", "References": "<20260219143332.3316679-1-ruslichenko.r@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2a00:1450:4864:20::42c;\n envelope-from=ruslichenko.r@gmail.com; helo=mail-wr1-x42c.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\nIntroduce infrastructure to instantiate device models\ndirectly from the device tree.\n\nThis includes the registry of known device models with\nassociated init functions and key API methods to\noperate it.\n\nThe MIT license of fdt_generic.c preserved as in original\nfile from https://github.com/Xilinx/qemu.git repo.\n\nThe license for fdt_generic.h derived from matching\nfdt_generic.c file.\n\nSigned-off-by: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>\n---\n hw/core/fdt_generic.c | 139 ++++++++++++++++++++++++++++++++++\n include/hw/core/fdt_generic.h | 78 +++++++++++++++++++\n 2 files changed, 217 insertions(+)\n create mode 100644 hw/core/fdt_generic.c\n create mode 100644 include/hw/core/fdt_generic.h", "diff": "diff --git a/hw/core/fdt_generic.c b/hw/core/fdt_generic.c\nnew file mode 100644\nindex 0000000000..d3ab8f9132\n--- /dev/null\n+++ b/hw/core/fdt_generic.c\n@@ -0,0 +1,139 @@\n+// SPDX-License-Identifier: MIT\n+/*\n+ * Tables of FDT device models and their init functions. Keyed by compatibility\n+ * strings, device instance names.\n+ *\n+ * Copyright (c) 2010 PetaLogix Qld Pty Ltd.\n+ * Copyright (c) 2010 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.h\"\n+#include \"hw/core/qdev-properties.h\"\n+#include \"qemu/log.h\"\n+\n+#ifndef FDT_GENERIC_ERR_DEBUG\n+#define FDT_GENERIC_ERR_DEBUG 0\n+#endif\n+#define DB_PRINT(lvl, ...) do { \\\n+ if (FDT_GENERIC_ERR_DEBUG > (lvl)) { \\\n+ qemu_log_mask(LOG_FDT, \": %s: \", __func__); \\\n+ qemu_log_mask(LOG_FDT, ## __VA_ARGS__); \\\n+ } \\\n+} while (0)\n+\n+#define FDT_GENERIC_MAX_PATTERN_LEN 1024\n+\n+typedef struct TableListNode {\n+ struct TableListNode *next;\n+ char key[FDT_GENERIC_MAX_PATTERN_LEN];\n+ FDTInitFn fdt_init;\n+ void *opaque;\n+} TableListNode;\n+\n+/* add a node to the table specified by *head_p */\n+\n+static void add_to_table(\n+ FDTInitFn fdt_init,\n+ const char *key,\n+ void *opaque,\n+ TableListNode **head_p)\n+{\n+ TableListNode *nn = malloc(sizeof(*nn));\n+ nn->next = *head_p;\n+ strcpy(nn->key, key);\n+ nn->fdt_init = fdt_init;\n+ nn->opaque = opaque;\n+ *head_p = nn;\n+}\n+\n+/* FIXME: add return codes that differentiate between not found and error */\n+\n+/*\n+ * search a table for a key string and call the fdt init function if found.\n+ * Returns 0 if a match is found, 1 otherwise\n+ */\n+\n+static int fdt_init_search_table(\n+ char *node_path,\n+ FDTMachineInfo *fdti,\n+ const char *key, /* string to match */\n+ TableListNode **head) /* head of the list to search */\n+{\n+ TableListNode *iter;\n+\n+ for (iter = *head; iter != NULL; iter = iter->next) {\n+ if (!strcmp(key, iter->key)) {\n+ if (iter->fdt_init) {\n+ return iter->fdt_init(node_path, fdti, iter->opaque);\n+ }\n+ return 0;\n+ }\n+ }\n+\n+ return 1;\n+}\n+\n+TableListNode *compat_list_head;\n+\n+void add_to_compat_table(FDTInitFn fdt_init, const char *compat, void *opaque)\n+{\n+ add_to_table(fdt_init, compat, opaque, &compat_list_head);\n+}\n+\n+int fdt_init_compat(char *node_path, FDTMachineInfo *fdti, const char *compat)\n+{\n+ return fdt_init_search_table(node_path, fdti, compat, &compat_list_head);\n+}\n+\n+TableListNode *inst_bind_list_head;\n+\n+void add_to_inst_bind_table(FDTInitFn fdt_init, const char *name, void *opaque)\n+{\n+ add_to_table(fdt_init, name, opaque, &inst_bind_list_head);\n+}\n+\n+int fdt_init_inst_bind(char *node_path, FDTMachineInfo *fdti,\n+ const char *name)\n+{\n+ return fdt_init_search_table(node_path, fdti, name, &inst_bind_list_head);\n+}\n+\n+static void dump_table(TableListNode *head)\n+{\n+ TableListNode *iter;\n+\n+ for (iter = head; iter != NULL; iter = iter->next) {\n+ printf(\"key : %s, opaque data %p\\n\", head->key, head->opaque);\n+ }\n+}\n+\n+void dump_compat_table(void)\n+{\n+ printf(\"FDT COMPATIBILITY TABLE:\\n\");\n+ dump_table(compat_list_head);\n+}\n+\n+void dump_inst_bind_table(void)\n+{\n+ printf(\"FDT INSTANCE BINDING TABLE:\\n\");\n+ dump_table(inst_bind_list_head);\n+}\ndiff --git a/include/hw/core/fdt_generic.h b/include/hw/core/fdt_generic.h\nnew file mode 100644\nindex 0000000000..614a234868\n--- /dev/null\n+++ b/include/hw/core/fdt_generic.h\n@@ -0,0 +1,78 @@\n+// SPDX-License-Identifier: MIT\n+/*\n+ * Tables of FDT device models and their init functions. Keyed by compatibility\n+ * strings, device instance names.\n+ */\n+\n+#ifndef FDT_GENERIC_H\n+#define FDT_GENERIC_H\n+\n+#include \"qemu/help-texts.h\"\n+#include \"system/device_tree.h\"\n+\n+typedef struct FDTMachineInfo FDTMachineInfo;\n+\n+typedef int (*FDTInitFn)(char *, FDTMachineInfo *, void *);\n+\n+/* associate a FDTInitFn with a FDT compatibility */\n+\n+void add_to_compat_table(FDTInitFn, const char *, void *);\n+\n+/*\n+ * try and find a device model for a particular compatibility. If found,\n+ * the FDTInitFn associated with the compat will be called and 0 will\n+ * be returned. Returns non-zero on not found or error\n+ */\n+\n+int fdt_init_compat(char *, FDTMachineInfo *, const char *);\n+\n+/* same as above, but associates with a FDT node name (rather than compat) */\n+\n+void add_to_inst_bind_table(FDTInitFn, const char *, void *);\n+int fdt_init_inst_bind(char *, FDTMachineInfo *, const char *);\n+\n+void dump_compat_table(void);\n+void dump_inst_bind_table(void);\n+\n+/*\n+ * Called from FDTInitFn's to inform the framework that a dependency is\n+ * unresolved and the calling context needs to wait for another device to\n+ * instantiate first. The calling thread will suspend until a change in state\n+ * in the argument fdt machine is detected.\n+ */\n+\n+void fdt_init_yield(FDTMachineInfo *);\n+\n+/* set, check and get per device opaques. Keyed by fdt node_paths */\n+\n+void fdt_init_set_opaque(FDTMachineInfo *fdti, char *node_path, void *opaque);\n+int fdt_init_has_opaque(FDTMachineInfo *fdti, char *node_path);\n+void *fdt_init_get_opaque(FDTMachineInfo *fdti, char *node_path);\n+\n+/* statically register a FDTInitFn as being associate with a compatibility */\n+\n+#define fdt_register_compatibility_opaque(function, compat, n, opaque) \\\n+static void __attribute__((constructor)) \\\n+function ## n ## _register_imp(void) { \\\n+ add_to_compat_table(function, compat, opaque); \\\n+}\n+\n+#define fdt_register_compatibility_n(function, compat, n) \\\n+fdt_register_compatibility_opaque(function, compat, n, NULL)\n+\n+#define fdt_register_compatibility(function, compat) \\\n+fdt_register_compatibility_n(function, compat, 0)\n+\n+#define fdt_register_instance_opaque(function, inst, n, opaque) \\\n+static void __attribute__((constructor)) \\\n+function ## n ## _register_imp(void) { \\\n+ add_to_inst_bind_table(function, inst, opaque); \\\n+}\n+\n+#define fdt_register_instance_n(function, inst, n) \\\n+fdt_register_instance_opaque(function, inst, n, NULL)\n+\n+#define fdt_register_instance(function, inst) \\\n+fdt_register_instance_n(function, inst, 0)\n+\n+#endif /* FDT_GENERIC_H */\n", "prefixes": [ "v2", "04/33" ] }