From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 302C9606A31F for ; Sat, 5 Dec 2026 21:54:55 +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=f7KsTQtu; 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=OrqSnNuE Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9FDB9406BD; Sat, 5 Dec 2026 21:54:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PkxTot9yfhf2; Sat, 5 Dec 2026 21:54:53 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org A20B3405EF Authentication-Results: smtp4.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=1796507693; b=M3ujeAiX2eyeSP5ep5OzvUJi3/mfqsXK+XD4LSm7EaSDG6vBZk/7N81928ExxKBejMvy NceansaLOnBQ4i1qE5IQzXFjOomU3WHpwy+Z6VtAL4OjjqpsllbOZtw+wC1gFDuLM1xO1 nq7F7PTASh6RQpJ1S9X3KZB1EuxDJKcn10xMt5ZHNcwNGImjUrc39w9SazRWyVwnzMeLa /iaE6gOgA+ArtfgkV0aOokEhE2BQDvmeAIr7SPRVsH5AWbIkGnrqFlBkR66zj2PuwqgM4 DkfEC3GABHuWM9e2lijfk0P1HCQvGN7+z1Iv+ZGFdzSQ4M9xqpX3CGxk9Ajvyo8LtIg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796507693; 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=/lCJjl/FHzMp23vnoxLmQuj8POv82rbDaxGO7NcbylA=; b=nRvDphQh6TFwGrYvpBL/2AodE2aMb8LuuXHk0ejv72ZE6AHtg+0092vefrvJbTrWP3zV hRhO3UMZdV2BCEK/jXRv8lx+xmkKYYYEYMt68RrDTXPV1ss6XCRxgaZXuhBpfiHjnYZgr MMPtDfLTQFehqJRlQQk6BGoZ9yM5pdnOv/hfokdsLehYbAMWZyWjtDtoP5UfYOVMZ4xtK sqpZZHkCQ3rgaSSTrdBRu9toF6881GBeey5LI600KY5sMQRQ/ajQZLG7kdVVwvKei7d6C wSDkUKxFZ2n++Qq2GWupzJPXtArKwpBShYJdQgHEm5BS6KQ5bOYaAV96EK2esFPGyiQ== ARC-Authentication-Results: i=1; smtp4.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=1796507693; bh=/lCJjl/FHzMp23vnoxLmQuj8POv82rbDaxGO7NcbylA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=f7KsTQtuxbOWwz1LTZbHnOJMxffuDpBeIspETqFVfUBjxk0gT7AhidOb0vxCOmDWW uX29kMdjDViYq+gu0sbdqwE/pe52fuUHRuq0yujeeWFxqNI9i+m0/oGBRjLNKQefT4 nVFeEnlFEhWt5Mt6u4tVJU7LI+EoqjB7NmnZxePrI9wxhYRJI4lO4RItmVShzw6XmG 9L6KUQtY5wBqqnR6KGOk1jUaR3oROAl1AY/TspAZDbCcVpef8IDNFjqW5JgqM/+Fb1 E3FIYmooagAZix+cC55J5nkS8Lemd8v99nT1lf8yfM1+gOt+7a8UmhW5qHbLUvhyVq ln2v7Mr6DZVPQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id A20B3405EF; Sat, 5 Dec 2026 21:54:53 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 27A7A325 for ; Sat, 5 Dec 2026 21:54:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 192BF60632 for ; Sat, 5 Dec 2026 21:54:52 +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 I18kuUouS9oq for ; Sat, 5 Dec 2026 21:54:51 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 2648660609 Authentication-Results: smtp3.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.15 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=165.173.180.15; helo=sender6-op-o15.zoho.com; envelope-from=me@ziyao.cc; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=ziyao.cc Authentication-Results: smtp3.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=OrqSnNuE Received: from sender6-op-o15.zoho.com (sender6-op-o15.zoho.com [165.173.180.15]) by smtp3.osuosl.org (Postfix) with ESMTPS id 2648660609 for ; Sat, 5 Dec 2026 21:54:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; b=OrqSnNuED1z+oXQeqB7dpcXJBcMcYAKCHbDnCDBKbEaBsLDqrxp6ij6k24MthCIYH/gR+lOlIaidIQ9NZYOpH2yJdzraS3HD0gWAZkSEXrqPnEq47Uyt3I9krDzjqARmEsHfVhJDleriuV4lYqNrDREs+zH4bJ7H1107VJDwRRM=; c=relaxed/relaxed; s=zmail; d=ziyao.cc; v=1; bh=/lCJjl/FHzMp23vnoxLmQuj8POv82rbDaxGO7NcbylA=; 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 1796507663219411.793036329091; Sat, 5 Dec 2026 13:54:23 -0800 (PST) Date: Sat, 5 Dec 2026 21:54:10 +0000 From: Yao Zi To: E Shattow , Anirudh Srinivasan Cc: Yao Zi , u-boot@lists.u-boot-project.org, Tim Ouyang , Leo Liang , Tom Rini , Troy Mitchell Subject: Re: [PATCH v4] riscv: Mark M-IMSIC and M-APLIC nodes as reserved in DT passed to next stage in S mode Message-ID: References: <20261203-mimsic_maplic_fixup-v4-1-41acf30f9b68@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.487.71 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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=no 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 Sat, Dec 05, 2026 at 09:40:16AM -0800, E Shattow wrote: > Hi Anirudh, > > Thanks for your patience :) replying my questions. > > On 12/4/26 06:25, Anirudh Srinivasan wrote: > > Hi E, > > > > On Fri, Dec 4, 2026 at 5:10 AM E Shattow wrote: > >> > >> Hi Anirudh, > >> > >> On 12/3/26 08:56, 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. > >>> > >> > >> The way it reads now (in my point of view) is as: > >> > >> "M-IMSIC and M-APLIC controllers are to be managed by M-mode software, > >> and so enforce any M-mode M-IMSIC and M-APLIC nodes are effectively > >> status 'reserved' in S-mode U-Boot with a fixup to the received control > > > > This is what OpenSBI does. > > > >> Fdt from preceding M-Mode software (e.g. OpenSBI). Enforce again this > >> same fixup when entering the next S-mode kernel to prevent S-mode > >> software from trying to probe them. > > > > We're doing this again here cause we may possibly not use the DT > > passed by OpenSBI and use a fresh DT from boot media. > > > > Regards > > Anirudh srinivasan > > If we did not call out to an M-Mode SBI for the transition to S-Mode > then we would be managing these with a fix-up at M-Mode U-Boot SPL when > handing off to S-Mode U-Boot main app; I see the problem now, M-Mode > U-Boot SPL loads U-Boot main multi-fit image which begins code execution > with M-Mode SBI (e.g. OpenSBI or RustSBI, etc.) and we have no domain > over the Fdt control state as S-Mode U-Boot main app is loaded and > begins code execution because that is done by the 3rd party M-Mode SBI. > We again incur this problem exiting from S-Mode U-Boot Main app because > there are provisions for a user to again load data to the Fdt for > hand-off to the next boot phase. > > I think it would be appropriate to log a warning (or even log "info" > level) that this particular M-mode <=> S-Mode fix-up consistency > enforcement is being done, as for example: > > "Enforce reserved M-mode Fdt property status for handoff to S-Mode kernel: > * M-IMSIC okay => reserved > * M-APLIC okay => reserved" > > or when the fix-up is activated but no nodes are changed then as: > > "Enforce reserved M-mode Fdt property status for handoff to S-Mode > kernel: (n/a)" A message at warning or info level sounds too verbose. A message at debug level would indeed help debugging when problems occur. > Also for consistency we should enforce this twice, at both S-Mode U-Boot > main app initialization and at hand-off exiting S-Mode U-Boot main app. What do you mean by "enforce this twice"? Do you mean to fix up the FDT both on entry of the U-Boot proper and on hand-off to the OS? If my understanding is correct, this doesn't make sense. U-Boot makes no use of interrupts, thus imsic/aplic means nothing to it. > I would like an explicit opt-in / opt-out strategy for the M-mode <=> > S-mode Fdt fix-up. A compile-time option is fine, here, and to make this > implicit for all RISC-V makes sense to me unless disabled explicitly > with "=n".... something so it appears in the .config but that it is a > sensible default so we don't require an opt-in. Presumably this is only > applicable to RISC-V platform? It makes sense to have a configurable option, but it should probably be off by default. At the time of writing, we don't have a lot of RISC-V SoCs implementing IMSIC/APLIC. AFAIK all in-tree RISC-V platforms except SpacemiT K3 don't require this fixup, so disabling it by default would avoid increase their binary size while keeping the code change minimal. > I think this also would apply to U-Boot SPL, in terms of consistency > this fix-up should be instrumented so that you can require it to run > when exiting the SPL (but this would of course be disabled when there is > an SBI). This should not incur any code size overhead as a config option > it would simply not be compiled-in. This gives it an explicit > application at build time and be visible in the .config arch_fixup_fdt() is already invoked in SPL when transferring control to Linux. We should probably also do so when transferring control to OpenSBI, but this has nothing to do with this patch. Code included in this patch only gets executed in S-mode, in which case OpenSBI couldn't be invoked at all. > With the above suggestions implemented, I think the commit message does > not require to mention "OpenSBI" at all. It simply becomes a matter of > informing the user and being a consistency enforcement SPL and Main app > boot phases. No, introducing this fixup to both SPL and U-Boot proper has nothing to do with the issue it solves. The original problem is that fixups performed by M-mode firmware are lost when loading a fresh devicetree, and it's good to describe the issue clearly in the commit message. I'm fine with this commit message. > -E -- Thanks, Yao Zi Meow-mrrp-mrow, I'm a cat.