public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Samuel Holland <samuel@sholland.org>
Cc: Rob Herring <robh+dt@kernel.org>, Marc Zyngier <maz@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Frank Rowand <frowand.list@gmail.com>
Subject: Re: [PATCH v3] of/irq: Use interrupts-extended to find parent
Date: Tue, 12 Apr 2022 13:21:29 -0500	[thread overview]
Message-ID: <YlXDKQld00eYlXdI@robh.at.kernel.org> (raw)
In-Reply-To: <20220412051529.6293-1-samuel@sholland.org>

On Tue, 12 Apr 2022 00:15:28 -0500, Samuel Holland wrote:
> The RISC-V PLIC binding uses interrupts-extended to specify its parent
> domain(s). That binding does not allow the interrupt-parent property to
> appear in the irqchip node. This prevents of_irq_init from properly
> detecting the irqchip hierarchy.
> 
> If no interrupt-parent property is present in the enclosing bus or root
> node, then desc->interrupt_parent will be NULL for both the per-CPU
> RISC-V INTC (the actual root domain) and the RISC-V PLIC. Similarly, if
> the bus or root node specifies `interrupt-parent = <&plic>`, then
> of_irq_init will hit the `desc->interrupt_parent == np` check, and again
> all parents will be NULL. So things happen to work today for some boards
> due to Makefile ordering.
> 
> However, things break when another irqchip ("foo") is stacked on top of
> the PLIC. The bus or root node will have `interrupt-parent = <&foo>`,
> since that is what all of the other peripherals need. When of_irq_init
> runs, it will try to find the PLIC's parent domain. of_irq_find_parent
> will fall back to using the interrupt-parent property of the PLIC's
> parent node (i.e. the bus or root node), and of_irq_init will see "foo"
> as the PLIC's parent domain. But this is wrong, because "foo" is
> actually the PLIC's child domain!
> 
> So of_irq_init wrongly attempts to init the stacked irqchip before the
> PLIC. This fails and breaks booting.
> 
> Fix this by using the first node referenced by interrupts-extended as
> the parent when that property is present. This allows of_irq_init to see
> the relationship between the PLIC and the per-CPU RISC-V INTC, and thus
> only the RISC-V INTC is (correctly) considered a root domain.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
> Changes in v3:
>  - Move the check into of_irq_init. Do not touch of_irq_find_parent.
> 
> Changes in v2:
>  - Add comments noting the assumptions made here
> 
>  drivers/of/irq.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 

Applied, thanks!

      reply	other threads:[~2022-04-12 18:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12  5:15 [PATCH v3] of/irq: Use interrupts-extended to find parent Samuel Holland
2022-04-12 18:21 ` Rob Herring [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=YlXDKQld00eYlXdI@robh.at.kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=samuel@sholland.org \
    --cc=tglx@linutronix.de \
    /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