From: Yao Zi <me@ziyao.cc>
To: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>,
Yao Zi <me@ziyao.cc>
Cc: Anup Patel <anup@brainfault.org>,
u-boot@lists.u-boot-project.org,
Tim Ouyang <tim609@andestech.com>,
Leo Liang <leo.liang@sifive.com>, Tom Rini <trini@konsulko.com>,
E Shattow <e@freeshell.de>,
Troy Mitchell <troy.mitchell@linux.spacemit.com>
Subject: Re: [PATCH v3] riscv: Disable M-IMSIC and M-APLIC nodes in DT passed to next stage in S mode
Date: Thu, 3 Dec 2026 13:02:25 +0000 [thread overview]
Message-ID: <axFoYe_nIWczSvNe@pie> (raw)
In-Reply-To: <CAEev2e-RUuBmmy2eJfaDZ6+T=M9cy-2W2EVEDv92n4-7-uJ+vA@mail.gmail.com>
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 <me@ziyao.cc> 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
> > > <asrinivasan@oss.tenstorrent.com> wrote:
> > > >
> > > > Hi Yao,
> > > >
> > > > +Anup to this thread
> > > >
> > > > On Fri, Nov 20, 2026 at 11:07 AM Yao Zi <me@ziyao.cc> 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 <me@ziyao.cc> 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 <e@freeshell.de>
> > > > > > > > Signed-off-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>
> > > > > > > > ---
> > > > > > > > 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.
prev parent reply other threads:[~2026-12-03 13:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 15:47 [PATCH v3] riscv: Disable M-IMSIC and M-APLIC nodes in DT passed to next stage in S mode Anirudh Srinivasan
2026-11-19 21:31 ` E Shattow
2026-11-20 1:04 ` Anirudh Srinivasan
2026-11-20 10:46 ` Yao Zi
2026-11-20 16:09 ` Anirudh Srinivasan
2026-11-20 17:07 ` Yao Zi
2026-11-20 17:24 ` Anirudh Srinivasan
2026-11-25 15:17 ` Anup Patel
2026-11-25 16:58 ` Yao Zi
2026-12-03 2:43 ` Anirudh Srinivasan
2026-12-03 13:02 ` Yao Zi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=axFoYe_nIWczSvNe@pie \
--to=me@ziyao.cc \
--cc=anup@brainfault.org \
--cc=asrinivasan@oss.tenstorrent.com \
--cc=e@freeshell.de \
--cc=leo.liang@sifive.com \
--cc=tim609@andestech.com \
--cc=trini@konsulko.com \
--cc=troy.mitchell@linux.spacemit.com \
--cc=u-boot@lists.u-boot-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox