From nobody Wed Apr 8 04:28:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773162591; cv=none; d=zohomail.com; s=zohoarc; b=idgKCjNKbjsQfNMZLPhRyf65ETuJOxUSlFtM894DPD3v/Tiv8VZhYA+yoRKGOS9BNrN3pIYUvUaCanBmnFBLP+0Q3TJxght2wvX6jGk3uxqI3TqZMA8S9h7THcVgdMNXvQN7oHY270139QJ4yiR3OnwWciKqmN478ad4N5jTp1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773162591; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rURaUWIfuvEbzAV4qRTHMl8D0NEHhwV33eVW20ka7rs=; b=CkqBLYNn/JaGlIMsA4yNKmnh56IqVgup7KqCcvz2aacT4KQbw9Ojw+t3O8lU+xUXm9+QhApbW0nv9OMH+E8O9uwDuB+P0mUDtvvW+3e8JmfnfP/Q48dPe21+u4s3jXiOtJb2n+duWc3aFSgP6v12u9FQNUfMr9mD3gN/J2wdj1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773162591829445.6544491969988; Tue, 10 Mar 2026 10:09:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1250395.1547943 (Exim 4.92) (envelope-from ) id 1w00aE-000446-0y; Tue, 10 Mar 2026 17:09:26 +0000 Received: by outflank-mailman (output) from mailman id 1250395.1547943; Tue, 10 Mar 2026 17:09:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w00aD-000434-TE; Tue, 10 Mar 2026 17:09:25 +0000 Received: by outflank-mailman (input) for mailman id 1250395; Tue, 10 Mar 2026 17:09:25 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w00aC-0001QA-TF for xen-devel@lists.xenproject.org; Tue, 10 Mar 2026 17:09:24 +0000 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [2a00:1450:4864:20::332]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e2848d12-1ca3-11f1-9ccf-f158ae23cfc8; Tue, 10 Mar 2026 18:09:23 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4838c15e3cbso119285105e9.3 for ; Tue, 10 Mar 2026 10:09:23 -0700 (PDT) Received: from fedora (user-109-243-67-101.play-internet.pl. [109.243.67.101]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485359bf807sm119619845e9.2.2026.03.10.10.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 10:09:21 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e2848d12-1ca3-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773162562; x=1773767362; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rURaUWIfuvEbzAV4qRTHMl8D0NEHhwV33eVW20ka7rs=; b=C5U75V08T2eumDwAH2EDZUc5bj3oRmeew2Y8x38i48ivsuCKn21B/0v96m3Mtxhgws MCKzwHFbQb96EHhpiDRYl/4ALkWdwIMjH5jL1aUgO2NNyv23eVZiIH5rm60hjyiSaDcd vbEOyhdmaoQweN0RmZv7kavQNUJon81I6Rg8nK1ptDZieyfL6UO4JMfNO9PG79Xhyihn nTxbssDYlIlv5NtEVlwF536WO210wCvkX1jPhB8iJ+Gyb71vSkXsRJO+aavadaxxYNut hNujCpr+4nuOYZtQPYu4E9K8NeOS5gxArN5NwTCesrqzlNV50llGtBKHszC8tbHfGkCI RTww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773162562; x=1773767362; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rURaUWIfuvEbzAV4qRTHMl8D0NEHhwV33eVW20ka7rs=; b=ogNp1xnCpeGsInlGTEbrwYdrUQttKeLwssmxAZlRQrh8R1UfZkwgqkA8lyaVJ12L9r krdkSFpZJVYYM20LupnK9w5Z2muJs+m+IofcAJxb+Q0udpTiBTSkYdpj/tK45Cu5KHm5 Uoq1MFzGk+tYipRchxSFy9g3DLUa9KuFFfbTxMnTLfoXIIN2d2RNMsU/l+otlyUZVBk4 crv7zzBoTNp4DG8m2Cj7Q8kLJ1IO0Wa0eJS2AgIfnI9GbHoHxbr1M5l6ar8mmeOY5VSQ ARrLn1V3kvdf+x0N1Xto1/uDml93xsYECdjARImCMBM1dcSZLJLkZpASXpAeEkQvdXxC xMNg== X-Gm-Message-State: AOJu0Yy1aklCbKiRzRZgZChYZKnI5q5cSLjM0l6dXuIJd3/RAzdaUPLv KzYvax1YkSVo2GjZw6PX5v6q+rJ3uJTtiXbmFbxZIQcvPy16SOBBeBgpY8ckx2U+ X-Gm-Gg: ATEYQzy7aiaeyT+65hUHg4QmGtwL8aLajPl5mGHpPgZFKj7xkuip5ucbQiV+9ZtueUb Lld2ztB+pHEFf/idDJOVXNWCHp3pztjw8bg/vNJDuiUaEyE9vyOctYWos6sb5DBnlAQZ917xAgw HLQR+uA4NAAanQjFMAplHEvmjjvP2FUel70poEX4rSiXz5vrgZRSYeh+Kle+/dRhVskAmtNL1j1 n0ou2lGXIobBnBeDSFPRB3qFcoFbbRE/Q9b+m0qqVhkXed6jehzDrTJv3/EYXaKqtuyPOVXNApu ICI4JXidB20ubwCsXI0JuEiHKf5uY1wWfba7e+gBHkWuOZhU5k96DZBCPkeb8QYBZXuY9g18fa/ ThoIwqsvzxn11ZtpA38dZZu/MYfivJjgHF+1/Gt/kn/cNrMA3I/NndNHj3+6BY5+MUJW1Ouu05L 5M4Z5aTRa2/xzHz9YYn6lM/hQmMSPKHmITkFP8aYovovclJ3aRQkyShoaIW1Tz/+ghQRpkBA== X-Received: by 2002:a05:600c:528c:b0:485:3d3e:167b with SMTP id 5b1f17b1804b1-4853d3e20d2mr103614505e9.5.1773162562331; Tue, 10 Mar 2026 10:09:22 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Romain Caritey , Oleksii Kurochko , Alistair Francis , Connor Davis , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v1 11/27] xen/riscv: create APLIC DT node for guest domains Date: Tue, 10 Mar 2026 18:08:44 +0100 Message-ID: <462b5f7dbe4e5084a35fb869b59327c6c92d1fbf.1773157782.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1773162592500158500 Content-Type: text/plain; charset="utf-8" Guests require a Device Tree description of the interrupt controller topology. Add support for creating an APLIC node when building the guest DT. The node is derived from the host DT and linked to the guest IMSIC via the msi-parent property, allowing guests to discover and use the APLIC interrupt controller. Co-developed-by: Romain Caritey Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/aplic.c | 82 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/xen/arch/riscv/aplic.c b/xen/arch/riscv/aplic.c index 739e8dab3498..e139946a05a0 100644 --- a/xen/arch/riscv/aplic.c +++ b/xen/arch/riscv/aplic.c @@ -12,8 +12,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -295,6 +297,85 @@ static void cf_check aplic_set_irq_type(struct irq_des= c *desc, spin_unlock(&aplic.lock); } =20 +static int __init cf_check aplic_make_dom_dt_node( + const struct kernel_info *kinfo, + const struct dt_device_node *aplic_nod= e) +{ + uint32_t len; + const __be32 *regs; + const void *data =3D NULL; + int res =3D 0; + void *fdt =3D kinfo->fdt; + + res =3D imsic_make_dt_node(kinfo); + if ( res ) + return res; + + res =3D fdt_begin_node(fdt, aplic_node->full_name); + if (res) + return res; + + data =3D dt_get_property(aplic_node, "#interrupt-cells", &len); + if ( !data ) + { + printk("%s: Can't find '#interrupt-cells' property\n", + aplic_node->full_name); + return -FDT_ERR_XEN(ENOENT); + } + + res =3D fdt_property(fdt, "#interrupt-cells", data, len); + if ( res ) + return res; + + regs =3D dt_get_property(aplic_node, "reg", &len); + if ( !regs ) + { + printk("%s: Can't find 'reg' property\n", aplic_node->full_name); + return -FDT_ERR_XEN(ENOENT); + } + + res =3D fdt_property(fdt, "reg", regs, len); + if ( res ) + return res; + + data =3D dt_get_property(aplic_node, "riscv,num-sources", &len); + if ( !data ) + { + printk("%s: Can't find 'riscv,num-sources' property\n", + aplic_node->full_name); + return -FDT_ERR_XEN(ENOENT); + } + + res =3D fdt_property(fdt, "riscv,num-sources", data, len); + if ( res ) + return res; + + res =3D fdt_property(fdt, "interrupt-controller", NULL, 0); + if ( res ) + return res; + + data =3D dt_get_property(aplic_node, "compatible", &len); + if ( !data ) + { + printk("%s: Can't find 'compatible' property\n", aplic_node->full_= name); + return -FDT_ERR_XEN(ENOENT); + } + + res =3D fdt_property(fdt, "compatible", data, len); + if ( res ) + return res; + + res =3D fdt_property_cell(fdt, "msi-parent", aplic.imsic_cfg->phandle); + if ( res ) + return res; + + res =3D fdt_property_cell(fdt, "phandle", kinfo->phandle_intc); + if ( res ) + return res; + + return fdt_end_node(fdt); +} + static const hw_irq_controller aplic_xen_irq_type =3D { .typename =3D "aplic", .startup =3D aplic_irq_startup, @@ -310,6 +391,7 @@ static const struct intc_hw_operations aplic_ops =3D { .host_irq_type =3D &aplic_xen_irq_type, .handle_interrupt =3D aplic_handle_interrupt, .set_irq_type =3D aplic_set_irq_type, + .make_dom_dt_node =3D aplic_make_dom_dt_node, }; =20 static int cf_check aplic_irq_xlate(const uint32_t *intspec, --=20 2.53.0