{"id":2219364,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2219364/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","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-15-ruslichenko.r@gmail.com>","date":"2026-04-02T21:55:59","name":"[v3,14/33] hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_INTC","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"106f750d381fbb8ee45fe9aa6d11b19d2b7bd88f","submitter":{"id":92275,"url":"http://patchwork.ozlabs.org/api/1.0/people/92275/?format=json","name":"Ruslan Ruslichenko","email":"ruslichenko.r@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260402215629.745866-15-ruslichenko.r@gmail.com/mbox/","series":[{"id":498555,"url":"http://patchwork.ozlabs.org/api/1.0/series/498555/?format=json","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/2219364/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=mR21d4FO;\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 4fmwn41sdLz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 09:02:00 +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 1w8Q2O-0008RB-Q9; Thu, 02 Apr 2026 17:57:16 -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 1w8Q2I-0008LN-HJ\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:57:12 -0400","from mail-ej1-x633.google.com ([2a00:1450:4864:20::633])\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 1w8Q2G-00078a-SP\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:57:10 -0400","by mail-ej1-x633.google.com with SMTP id\n a640c23a62f3a-b97e6e48b24so206763066b.2\n for <qemu-devel@nongnu.org>; Thu, 02 Apr 2026 14:57:08 -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.57.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 02 Apr 2026 14:57:06 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775167027; x=1775771827; 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=IEv5arXU/isUBZYgJvgLUA50xxPvAFJsx4xFvYCWEAU=;\n b=mR21d4FOvID1MUg94nwqPuUyx2BhLE8VdN2kCpHE6bDejwOegxI8jCpUcmSQWfIoJx\n 7vciB0fXAbJDvVmvA4D2+VpCu8yTYFZVO5GfHhbT1aFmutefqX3r/OoGLKQjGICnfjbc\n /kv2KUMT4xt023Ztw/5Y6j6bqqOSdlYTgh8ZvfcINoRPkZrwA5z1yQUU/uVncU03J4nl\n eXT1BSJj5ZrvXswApqXo7IoFHTRbrIL7vZYjkWnaRRQgRaHorTN919Gex971D4GvmOZo\n +6HEyUNOG9RwUgt0w/iyb6KB1Y+9jhBbYMTc8E7Hu2W1gWlfoziulwhiImD2nLY1rIRS\n fYSw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775167027; x=1775771827;\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=IEv5arXU/isUBZYgJvgLUA50xxPvAFJsx4xFvYCWEAU=;\n b=H2W2GiztKZTJ5LNDZSHMsLSjxIwuugi5j4+t3jIFiW35PDxpyP2W6PIlmNX4K+Pd9j\n BHT2O7gBOEmi1DUJbX4zLsvnmeiE0mfgE6k69rE3Osx49lgh/O6CWLIYrAHpc/7ucZek\n hLVRLbY6nJthLg+mKA13NDx6aUVFhmsgW4eDU1gmKbj+h2J5Z/C0jqxeXH3U0Gw5RYBn\n jj4flr3PXuuKeonFMgikxrfsok4U2sLidkThWurFU/yipd9DQy+JtUWvuLYSU3BNSfAI\n kq3td0P78nctcGI89kgOZ/R+HBvN2hEyl1HPVqudOortDxt2eBlUvjXov8ASEo++40Li\n imCw==","X-Gm-Message-State":"AOJu0YwZoyL+6qwpu2Kc/7FhZHOj5W7haO6Fk7rqlIKfeYtvyCpVaXS+\n OK3FiqerDixnuniqCOqalUBXy2noJn6bEHx9ZDrP268JMEwnlC/ru9HkFA52F7Xh","X-Gm-Gg":"ATEYQzy3i3VXjwlZ9bRGyJ9XWmAyT/26WyXORVHKsqjh0CKGm1GXjZJc8aD3gif6gEA\n MDPVOhNjYsKbWFfAUqkrowsBf0u73iA895RJ4jChZac+bPH+rJkEvgPpLiaXaQMUtZ6EuyGK7Hb\n Gmiz/V5ks8oLt5DJ3wATV4/6BZew80NODu3z8PzG806Xz/azSPzgjfU4Oho01utbVjqB7AbY59G\n F8sLhZjP123TkBAlZt2pC0ohX4/kzCh48rz3/JA8zHFc4PT7DO5dF87CVsEOxy5mtNJao2nVWlu\n MvNzd0YgixYFV8BUkI6MRt5BlBbboG92xcLJ6DFK7ODzlfSf7rVYxbzRMDjlAQSC9sFe8m+XOju\n tm9GOrbeddPUYuFwnSFRofuJ3prIpNryEnIVD9gSTE3gUXyTGmYKMU+BKnkSJ9RF+vqAceJsWjd\n 7G5KUURxJmYIkYD6bUAazeSxMu+Q0zIH7vNH0G2saaDpbUGWuj4ty74XKVFbpZjauFpiuSMA==","X-Received":"by 2002:a17:907:86ab:b0:b99:1074:74f with SMTP id\n a640c23a62f3a-b9c67978769mr28859866b.34.1775167026951;\n Thu, 02 Apr 2026 14:57:06 -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 14/33] hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_INTC","Date":"Thu,  2 Apr 2026 23:55:59 +0200","Message-ID":"<20260402215629.745866-15-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::633;\n envelope-from=ruslichenko.r@gmail.com; helo=mail-ej1-x633.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\nAdd TYPE_FDT_GENERIC_INTC class and interface to allow\ninterrupt controllers to register callback which can\nbe used to get IRQ's from this controller.\n\nOptionally, interrupt controllers may also provide\nauto_parent() callabck which can be used to attach\nit to corresponding CPU's or other interrupt parent.\n\nSigned-off-by: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>\n---\n hw/core/fdt_generic_util.c         |  7 ++++\n include/hw/core/fdt_generic_util.h | 59 ++++++++++++++++++++++++++++++\n 2 files changed, 66 insertions(+)","diff":"diff --git a/hw/core/fdt_generic_util.c b/hw/core/fdt_generic_util.c\nindex 8f91bcb66c..d816e395fd 100644\n--- a/hw/core/fdt_generic_util.c\n+++ b/hw/core/fdt_generic_util.c\n@@ -617,6 +617,12 @@ static int fdt_init_qdev(char *node_path, FDTMachineInfo *fdti, char *compat)\n     return 0;\n }\n \n+static const TypeInfo fdt_generic_intc_info = {\n+    .name          = TYPE_FDT_GENERIC_INTC,\n+    .parent        = TYPE_INTERFACE,\n+    .class_size = sizeof(FDTGenericIntcClass),\n+};\n+\n static const TypeInfo fdt_generic_mmap_info = {\n     .name          = TYPE_FDT_GENERIC_MMAP,\n     .parent        = TYPE_INTERFACE,\n@@ -625,6 +631,7 @@ static const TypeInfo fdt_generic_mmap_info = {\n \n static void fdt_generic_register_types(void)\n {\n+    type_register_static(&fdt_generic_intc_info);\n     type_register_static(&fdt_generic_mmap_info);\n }\n type_init(fdt_generic_register_types)\ndiff --git a/include/hw/core/fdt_generic_util.h b/include/hw/core/fdt_generic_util.h\nindex e3671990ad..c92c79dd12 100644\n--- a/include/hw/core/fdt_generic_util.h\n+++ b/include/hw/core/fdt_generic_util.h\n@@ -16,6 +16,65 @@\n \n FDTMachineInfo *fdt_generic_create_machine(void *fdt, qemu_irq *cpu_irq);\n \n+#define TYPE_FDT_GENERIC_INTC \"fdt-generic-intc\"\n+\n+#define FDT_GENERIC_INTC_CLASS(klass) \\\n+     OBJECT_CLASS_CHECK(FDTGenericIntcClass, (klass), TYPE_FDT_GENERIC_INTC)\n+#define FDT_GENERIC_INTC_GET_CLASS(obj) \\\n+    OBJECT_GET_CLASS(FDTGenericIntcClass, (obj), TYPE_FDT_GENERIC_INTC)\n+#define FDT_GENERIC_INTC(obj) \\\n+     INTERFACE_CHECK(FDTGenericIntc, (obj), TYPE_FDT_GENERIC_INTC)\n+\n+typedef struct FDTGenericIntc {\n+    /*< private >*/\n+    Object parent_obj;\n+} FDTGenericIntc;\n+\n+typedef struct FDTGenericIntcClass {\n+    /*< private >*/\n+    InterfaceClass parent_class;\n+\n+    /*< public >*/\n+    /**\n+     * get irq - Based on the FDT generic interrupt binding for this device\n+     * grab the irq(s) for the given interrupt cells description. In some device\n+     * tree bindings (E.G. ARM GIC with its PPI) a single interrupt cell-tuple\n+     * can describe more than one connection. So populates an array with all\n+     * relevant IRQs.\n+     *\n+     * @obj - interrupt controller to get irqs input for (\"interrupt-parent\")\n+     * @irqs - array to populate with irqs (must be >= @max length\n+     * @cells - interrupt cells values. Must be >= ncells length\n+     * @ncells - number of cells in @cells\n+     * @max - maximum number of irqs to return\n+     * @errp - Error condition\n+     *\n+     * @returns the number of interrupts populated in irqs. Undefined on error\n+     * (use errp for error checking). If it is valid for the interrupt\n+     * controller binding to specify no (or a disabled) connections it may\n+     * return 0 as a non-error.\n+     */\n+\n+    int (*get_irq)(FDTGenericIntc *obj, qemu_irq *irqs, uint32_t *cells,\n+                   int ncells, int max, Error **errp);\n+\n+    /**\n+     * auto_parent. An interrupt controller often infers its own interrupt\n+     * parent (usually a CPU or CPU cluster. This function allows an interrupt\n+     * controller to implement its own auto-connections. Is called if an\n+     * interrupt controller itself (detected via \"interrupt-controller\") has no\n+     * \"interrupt-parent\" node.\n+     *\n+     * @obj - Interrupt controller top attempt autoconnection\n+     * @errp - Error condition\n+     *\n+     * FIXME: More arguments need to be added for partial descriptions\n+     */\n+\n+    void (*auto_parent)(FDTGenericIntc *obj, Error **errp);\n+\n+} FDTGenericIntcClass;\n+\n #define TYPE_FDT_GENERIC_MMAP \"fdt-generic-mmap\"\n \n #define FDT_GENERIC_MMAP_CLASS(klass) \\\n","prefixes":["v3","14/33"]}