From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A248C606A32C for ; Thu, 3 Dec 2026 13:05:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=GKEjqAwk; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=ziyao.cc header.i=@ziyao.cc header.a=rsa-sha256 header.s=zmail header.b=jTAY0NfJ Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7145A616B8; Thu, 3 Dec 2026 13:05:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id liMdp_R5qUbg; Thu, 3 Dec 2026 13:05:13 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 49E2661748 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796303113; b=AeMolrvbd5Bt5LsR4IVLNObD/ZuvU2xLc2OPgyHDCq9hwAx1yPnFvOhX1gtIkEzyj8XT t2xzR1Tfu+ahxl7O6Poocur2xXu7k1mQVDIrSaKPUVQMvO1SEo3PI+NQqNPijwhqTyA0d PY9FyXocagzOZ6zQTWJOFS3HUzF+qWviTYF4N7qPIFQ2Bo/5oy6GqelRwL7CIIeuw3g/k hbPplwWXzaMIP1P/gdlRe3jCPf2qKgB7M05MqwAzrxDmkI6BEHaIu/Rfslo+UU8snroCf EQ9gP75dXPbQiaN010+uU4wAKRjNgqXAr0p4epIu3/FbCC0C0KG+ngSh8RfN7w/iy/w== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796303113; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received: DKIM-Signature:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To:X-Zoho-Virus-Status: X-Zoho-AV-Stamp:X-ZohoMailClient:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=qr+uXs2nAvlGKvmT9VUbCMpaJHEfM2eJevblV0MrqEA=; b=g/Sv2OGZ7B3XvpEr+2Pn2N+UFzzKk56osTyTze8Ds2EFJQVBYml3UQ6b9s18oL6r9lk0 pPpEWjdHP14l+3PXfFW4+jMEUq4auhUfRQdU2Pmpgwc0L25OsmHmzoTz4HjQWR9A3adTz MqWkU+V3CXorNIhTKeDEZ8JBEFYH0KrMi1/6DerPyw5C4mWqomC0dIwBGBmYJSFk89jUD 1mG3XlZZMX6+ifoDdfo9McswMr5hREq0YVcCnNZHkIUfPi2HxZ/YkfAd6HSa3Qj/UaVm3 qFgPWeXQ8oXTIxih2mjuiKVf37zcGG0KCrqA4o3/2eROfxQXPGNKmr/JxCiE071ebzg== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1796303113; bh=qr+uXs2nAvlGKvmT9VUbCMpaJHEfM2eJevblV0MrqEA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GKEjqAwkY1UUiSXUEcWL41JO9a4OQpSYqDgtb1uaBbPFSxV/H8o+dW+NWJdcqipPr UpOcgWrMv+JL1xxub0boYkhdiaZ+dmiuKYMoHnzAGfMbjq8sf648L18Q95bbC2hh6q 0OWjPZAxtexvhkGqoe49G4naK0PpEUOW8mf5+nTS8YH1GMBOy0Mm3zy9Hn9HceumGu ASuv8xHM6rL2/sGLJ5miVXWlpajRN0k+CiTCUtiCOMtX1ASZWS5s9/rcWakkN38zAV W9TQxGF6UVD+t4Cj5Wg7r7XwlUKjVEYrivkb0vE/5kZFLFSovUzqfFtLp+mRVOH2SM FfSgxufeTupLQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 49E2661748; Thu, 3 Dec 2026 13:05:13 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id CA042109 for ; Thu, 3 Dec 2026 13:05:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B7FF986483 for ; Thu, 3 Dec 2026 13:05:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4Ip7Ip_xMvgT for ; Thu, 3 Dec 2026 13:05:10 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 4710A8647B Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.182.15 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=165.173.182.15; helo=sender5-op-o15.zoho.com; envelope-from=me@ziyao.cc; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=ziyao.cc Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=ziyao.cc header.i=@ziyao.cc header.a=rsa-sha256 header.s=zmail header.b=jTAY0NfJ Received: from sender5-op-o15.zoho.com (sender5-op-o15.zoho.com [165.173.182.15]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4710A8647B for ; Thu, 3 Dec 2026 13:05:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; b=jTAY0NfJ64u24lw11PjJ7RpUpTBecL/JhSrNviGXzRPRad49FL9oSDTD2t6xBAyqfgkl6T0arFAoJhggk7PxUkgiQD0l/6VWNgQgt/J+u5IHqhp70E2uO2raNOP4W+jt76/iZN7XyoLhePimHeRlLc4FbFslCLf64LkbiYIbow0=; c=relaxed/relaxed; s=zmail; d=ziyao.cc; v=1; bh=qr+uXs2nAvlGKvmT9VUbCMpaJHEfM2eJevblV0MrqEA=; h=Content-Description:Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Sender:Resent-Cc:Resent-Date:Resent-To:Reply-To:Resent-Message-ID:Resent-From:Sender:Subject:To:Date:From:Message-Id:Reply-To:Subject:To:Cc; Received: by smtp.zohomail.com with SMTPS id 1796302956747443.70025239673225; Thu, 3 Dec 2026 05:02:36 -0800 (PST) Date: Thu, 3 Dec 2026 13:02:25 +0000 From: Yao Zi To: Anirudh Srinivasan , Yao Zi Cc: Anup Patel , u-boot@lists.u-boot-project.org, Tim Ouyang , Leo Liang , Tom Rini , E Shattow , Troy Mitchell Subject: Re: [PATCH v3] riscv: Disable M-IMSIC and M-APLIC nodes in DT passed to next stage in S mode Message-ID: References: <20261119-mimsic_maplic_fixup-v3-1-e028e28fb958@oss.tenstorrent.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Zoho-Virus-Status: 1 X-Zoho-AV-Stamp: zmail-av-0.2.28.1.5.5/296.294.99 X-ZohoMailClient: External X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, Dec 02, 2026 at 08:43:48PM -0600, Anirudh Srinivasan wrote: > Hi Yao, > > On Wed, Nov 25, 2026 at 10:58 AM Yao Zi wrote: > > > > On Wed, Nov 25, 2026 at 08:47:40PM +0530, Anup Patel wrote: > > > On Fri, Nov 20, 2026 at 10:54 PM Anirudh Srinivasan > > > wrote: > > > > > > > > Hi Yao, > > > > > > > > +Anup to this thread > > > > > > > > On Fri, Nov 20, 2026 at 11:07 AM Yao Zi wrote: > > > > > > > > > > On Fri, Nov 20, 2026 at 10:09:49AM -0600, Anirudh Srinivasan wrote: > > > > > > Hi Yao, > > > > > > > > > > > > On Fri, Nov 20, 2026 at 4:47 AM Yao Zi wrote: > > > > > > > > > > > > > > On Thu, Nov 19, 2026 at 09:47:07AM -0600, Anirudh Srinivasan wrote: > > > > > > > > When U-Boot is running in S mode, the DT passed to the next S mode stage > > > > > > > > can either be the bundled in DT U-Boot and the previous M mode stage > > > > > > > > use, or be loaded by U-Boot from some boot media. In the former case, > > > > > > > > the M mode stage can fix up the DT to disable the M-IMSIC and M-APLIC > > > > > > > > nodes on an AIA system (for example, OpenSBI does this fixup). These > > > > > > > > controllers are to be managed by M-mode software, so this is done to > > > > > > > > prevent S mode software from trying to probe them. > > > > > > > > > > > > > > > > This fixup doesn't happen in the latter case because U-Boot loads a > > > > > > > > fresh DT from boot media. Add a fdt fixup to do this similar to OpenSBI. > > > > > > > > This gets rid of prints like this during linux boots. > > > > > > > > > > > > > > > > [ 0.000000] riscv-imsic: interrupt-controller@a0000000: no parent irqs available > > > > > > > > [ 0.000000] riscv-imsic: interrupt-controller@a0000000: failed to setup state (error -22) > > > > > > > > [ 0.000000] OF: of_irq_init: Failed to init /soc/interrupt-controller@a0000000 ((____ptrval____)), parent (____ptrval____) > > > > > > > > > > > > > > > > [ 10.727605] platform cc000000.interrupt-controller: deferred probe pending: platform: supplier a0000000.interrupt-controller not ready > > > > > > > > > > > > > > > > Reviewed-by: E Shattow > > > > > > > > Signed-off-by: Anirudh Srinivasan > > > > > > > > --- > > > > > > > > Changes in v3: > > > > > > > > - Reword commit title to say M-APLIC/M-IMSIC and drop references to M Mode to avoid any confusion > > > > > > > > - Link to v2: https://patch.msgid.link/20261119-mimsic_maplic_fixup-v2-1-e29e04bf1b76@oss.tenstorrent.com > > > > > > > > > > > > > > > > Changes in v2: > > > > > > > > - Rename riscv_aia_mmode_aplic_imsic_fixup to riscv_aia_mimsic_maplic_fixup > > > > > > > > - Drop most references to OpenSBI/Linux in commit message and just use M-mode/s-mode software > > > > > > > > - Link to v1: https://patch.msgid.link/20261118-mimsic_maplic_fixup-v1-1-52dea8f39779@oss.tenstorrent.com > > > > > > > > --- > > > > > > > > arch/riscv/lib/fdt_fixup.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++ > > > > > > > > 1 file changed, 86 insertions(+) > > > > > > > > > > ... > > > > > > > > > > > > > + * riscv_aia_mimsic_maplic_fixup() - Disable M-APLIC and M-IMSIC nodes in DT > > > > > > > > + * @fdt: Pointer to the device tree in which nodes are to be disabled > > > > > > > > + * > > > > > > > > + * On RISC-V AIA systems, M-mode software manages the M-APLIC and M-IMSIC. > > > > > > > > + * If S-mode U-Boot loads a device tree from boot media, the DT nodes for these > > > > > > > > + * could still be enabled, so fixup the DT to disable these nodes before passing > > > > > > > > + * it to the next S-mode stage. > > > > > > > > + * > > > > > > > > + * Return: 0 on success or error otherwise. > > > > > > > > + */ > > > > > > > > +static int riscv_aia_mimsic_maplic_fixup(void *fdt) > > > > > > > > +{ > > > > > > > > + int offset, err; > > > > > > > > + > > > > > > > > + /* Disable M-IMSIC in APLIC-IMSIC configuration */ > > > > > > > > + fdt_for_each_node_by_compatible(offset, fdt, -1, "riscv,imsics") { > > > > > > > > + if (riscv_node_handles_mmode_external_interrupts(fdt, offset)) { > > > > > > > > + err = fdt_status_disabled(fdt, offset); > > > > > > > > > > > > > > Should we use "reserved" instead of "disabled"? Quoting the devicetree > > > > > > > specification, > > > > > > > > > > > > > > > "disabled" > > > > > > > > Indicates that the device is not presently operational, but it > > > > > > > > might become operational in the future (for example, something > > > > > > > > is not plugged in, or switched off). > > > > > > > > > > > > > > > > "reserved" > > > > > > > > Indicates that the device is operational, but should not be > > > > > > > > used. Typically this is used for devices that are controlled by > > > > > > > > another software component, such as platform firmware. > > > > > > > > > > > > > > Another possible problem is that these loops overrides the status > > > > > > > unconditionally, turning already "reserved" devices into "disabled". > > > > > > > > > > > > I don't think we should be using reserved here. OpenSBI sets the node > > > > > > to disabled, so we should be doing the same thing. > > > > > > > > > > > > I'll add a check to see if the node is enabled and disable it only then. > > > > > > > > > > I think this is probably an OpenSBI defect, please try raising this to > > > > > OpenSBI upstream. > > > > > > > > Hello Anup, I've added you to this thread as you had added the code to > > > > OpenSBI that marks M-APLIC and M-IMSIC nodes as disabled. This current > > > > patch does the same for a DT that U-boot loads from boot media (hence > > > > is missing the fixup OpenSBI does) and passes to linux. > > > > > > > > Do think these nodes should be marked as "reserved" instead? It seems > > > > that "reserved" is to be used for devices controlled by different a sw > > > > component, which seems to line up with what's happening here. > > > > > > The next stage after OpenSBI is S-mode so that's why OpenSBI disables > > > M-APLIC and M-IMSIC DT nodes because S-mode access to these > > > devices is blocked (or disabled). For DRAM where OpenSBI runs, the > > > situation is different because typically we have on DT node for covering > > > all DRAM banks so disabling this DT node does not make sense. Due > > > to this, OpenSBI marks portion of DRAM as reserved where OpenSBI > > > runs from. > > > > > > To summarize: > > > 1) Disable the DT nodes of devices which are not accessible in S-mode > > > 2) Reserve the portion of DRAM which is not accessible in S-mode > > > > I think you might misunderstand the things which we're talking about. > > "Marked as reserved" here means change values of their status property > > to "reserved", which has nothing to do with reserved-memory nodes. > > > > "reserved" is defined to be a possible choice of status property in the > > devicetree specification[1], and represents > > > > > > > > > > "reserved" > > > > > > > > Indicates that the device is operational, but should not be > > > > > > > > used. Typically this is used for devices that are controlled by > > > > > > > > another software component, such as platform firmware. > > In the end, which option we pick here doesn't matter (as long as it's > not status = "okay"). To keep this series moving, I'll submit a new > version where I set the nodes to "reserved". Hope that is that okay, > Yao. Yes, thanks. I could instead try to get this discussed (and probably changed) at the OpenSBI side. > Regards > Anirudh Srinivasan -- Thanks, Yao Zi Meow-mrrp-mrow, I'm a cat.