diff mbox series

[v3,02/11] of/irq: Set FWNODE_FLAG_BEST_EFFORT for the interrupt controller DT nodes

Message ID 20230508142842.854564-3-apatel@ventanamicro.com (mailing list archive)
State Superseded
Delegated to: Palmer Dabbelt
Headers show
Series Linux RISC-V AIA Support | expand

Checks

Context Check Description
conchuod/tree_selection fail Failed to apply to next/pending-fixes or riscv/for-next

Commit Message

Anup Patel May 8, 2023, 2:28 p.m. UTC
The RISC-V APLIC interrupt controller driver is a regular platform
driver so we need to ensure that it is probed as soon as possible.
To achieve this, we mark the interrupt controller device nodes with
FWNODE_FLAG_BEST_EFFORT (just like console DT node).

Fixes: 8f486cab263c ("driver core: fw_devlink: Allow firmware to mark devices as best effort")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 drivers/of/irq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Rob Herring June 8, 2023, 6:28 p.m. UTC | #1
+Saravana

On Mon, May 08, 2023 at 07:58:33PM +0530, Anup Patel wrote:
> The RISC-V APLIC interrupt controller driver is a regular platform
> driver so we need to ensure that it is probed as soon as possible.
> To achieve this, we mark the interrupt controller device nodes with
> FWNODE_FLAG_BEST_EFFORT (just like console DT node).
> 
> Fixes: 8f486cab263c ("driver core: fw_devlink: Allow firmware to mark devices as best effort")

It is good practice to Cc the commit author of what you are fixing.

> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> ---
>  drivers/of/irq.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index 174900072c18..94e1d9245cff 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -535,6 +535,16 @@ void __init of_irq_init(const struct of_device_id *matches)
>  	INIT_LIST_HEAD(&intc_desc_list);
>  	INIT_LIST_HEAD(&intc_parent_list);
>  
> +	/*
> +	 * We need interrupt controller platform drivers to work as soon

If it's platform drivers/devices you care about, then perhaps this 
should be done when platform devices are created.

> +	 * as possible so mark the interrupt controller device nodes with
> +	 * FWNODE_FLAG_BEST_EFFORT so that fw_delink knows not to delay
> +	 * the probe of the interrupt controller device for suppliers
> +	 * without drivers.
> +	 */
> +	for_each_node_with_property(np, "interrupt-controller")

This function only operates on nodes matching 'matches', but this 
operates on everything.

It does make sense that if we init an interrupt controller here, then we 
will surely want to probe its driver later on. So maybe just move 
setting FWNODE_FLAG_BEST_EFFORT within 
for_each_matching_node_and_match() below.

> +		np->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT;
> +
>  	for_each_matching_node_and_match(np, matches, &match) {
>  		if (!of_property_read_bool(np, "interrupt-controller") ||
>  				!of_device_is_available(np))
> -- 
> 2.34.1
>
Saravana Kannan June 8, 2023, 8:04 p.m. UTC | #2
On Thu, Jun 8, 2023 at 11:28 AM Rob Herring <robh@kernel.org> wrote:
>
> +Saravana
>
> On Mon, May 08, 2023 at 07:58:33PM +0530, Anup Patel wrote:
> > The RISC-V APLIC interrupt controller driver is a regular platform
> > driver so we need to ensure that it is probed as soon as possible.
> > To achieve this, we mark the interrupt controller device nodes with
> > FWNODE_FLAG_BEST_EFFORT (just like console DT node).
> >
> > Fixes: 8f486cab263c ("driver core: fw_devlink: Allow firmware to mark devices as best effort")
>
> It is good practice to Cc the commit author of what you are fixing.
>
> > Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> > ---
> >  drivers/of/irq.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > index 174900072c18..94e1d9245cff 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -535,6 +535,16 @@ void __init of_irq_init(const struct of_device_id *matches)
> >       INIT_LIST_HEAD(&intc_desc_list);
> >       INIT_LIST_HEAD(&intc_parent_list);
> >
> > +     /*
> > +      * We need interrupt controller platform drivers to work as soon
>
> If it's platform drivers/devices you care about, then perhaps this
> should be done when platform devices are created.
>
> > +      * as possible so mark the interrupt controller device nodes with
> > +      * FWNODE_FLAG_BEST_EFFORT so that fw_delink knows not to delay
> > +      * the probe of the interrupt controller device for suppliers
> > +      * without drivers.
> > +      */
> > +     for_each_node_with_property(np, "interrupt-controller")
>
> This function only operates on nodes matching 'matches', but this
> operates on everything.
>
> It does make sense that if we init an interrupt controller here, then we
> will surely want to probe its driver later on. So maybe just move
> setting FWNODE_FLAG_BEST_EFFORT within
> for_each_matching_node_and_match() below.
>
> > +             np->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT;
> > +

Definite Nack. You are pretty much disabling fw_devlink for all
interrupt controllers. There are plenty of examples of the IRQ drivers
being needed very early on and still probing properly without the need
for this flag. Please fix your driver/DT.

-Saravana


> >       for_each_matching_node_and_match(np, matches, &match) {
> >               if (!of_property_read_bool(np, "interrupt-controller") ||
> >                               !of_device_is_available(np))
> > --
> > 2.34.1
> >
Anup Patel June 9, 2023, 11:40 a.m. UTC | #3
On Fri, Jun 9, 2023 at 1:35 AM Saravana Kannan <saravanak@google.com> wrote:
>
> On Thu, Jun 8, 2023 at 11:28 AM Rob Herring <robh@kernel.org> wrote:
> >
> > +Saravana
> >
> > On Mon, May 08, 2023 at 07:58:33PM +0530, Anup Patel wrote:
> > > The RISC-V APLIC interrupt controller driver is a regular platform
> > > driver so we need to ensure that it is probed as soon as possible.
> > > To achieve this, we mark the interrupt controller device nodes with
> > > FWNODE_FLAG_BEST_EFFORT (just like console DT node).
> > >
> > > Fixes: 8f486cab263c ("driver core: fw_devlink: Allow firmware to mark devices as best effort")
> >
> > It is good practice to Cc the commit author of what you are fixing.
> >
> > > Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> > > ---
> > >  drivers/of/irq.c | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > >
> > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > > index 174900072c18..94e1d9245cff 100644
> > > --- a/drivers/of/irq.c
> > > +++ b/drivers/of/irq.c
> > > @@ -535,6 +535,16 @@ void __init of_irq_init(const struct of_device_id *matches)
> > >       INIT_LIST_HEAD(&intc_desc_list);
> > >       INIT_LIST_HEAD(&intc_parent_list);
> > >
> > > +     /*
> > > +      * We need interrupt controller platform drivers to work as soon
> >
> > If it's platform drivers/devices you care about, then perhaps this
> > should be done when platform devices are created.
> >
> > > +      * as possible so mark the interrupt controller device nodes with
> > > +      * FWNODE_FLAG_BEST_EFFORT so that fw_delink knows not to delay
> > > +      * the probe of the interrupt controller device for suppliers
> > > +      * without drivers.
> > > +      */
> > > +     for_each_node_with_property(np, "interrupt-controller")
> >
> > This function only operates on nodes matching 'matches', but this
> > operates on everything.
> >
> > It does make sense that if we init an interrupt controller here, then we
> > will surely want to probe its driver later on. So maybe just move
> > setting FWNODE_FLAG_BEST_EFFORT within
> > for_each_matching_node_and_match() below.
> >
> > > +             np->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT;
> > > +
>
> Definite Nack. You are pretty much disabling fw_devlink for all
> interrupt controllers. There are plenty of examples of the IRQ drivers
> being needed very early on and still probing properly without the need
> for this flag. Please fix your driver/DT.

Okay, I will try to set FWNODE_FLAG_BEST_EFFORT only for
APLIC device_node via IRQCHIP_DECLARE().

Regards,
Anup


>
> -Saravana
>
>
> > >       for_each_matching_node_and_match(np, matches, &match) {
> > >               if (!of_property_read_bool(np, "interrupt-controller") ||
> > >                               !of_device_is_available(np))
> > > --
> > > 2.34.1
> > >
Saravana Kannan June 9, 2023, 9:17 p.m. UTC | #4
On Fri, Jun 9, 2023 at 4:40 AM Anup Patel <apatel@ventanamicro.com> wrote:
>
> On Fri, Jun 9, 2023 at 1:35 AM Saravana Kannan <saravanak@google.com> wrote:
> >
> > On Thu, Jun 8, 2023 at 11:28 AM Rob Herring <robh@kernel.org> wrote:
> > >
> > > +Saravana
> > >
> > > On Mon, May 08, 2023 at 07:58:33PM +0530, Anup Patel wrote:
> > > > The RISC-V APLIC interrupt controller driver is a regular platform
> > > > driver so we need to ensure that it is probed as soon as possible.
> > > > To achieve this, we mark the interrupt controller device nodes with
> > > > FWNODE_FLAG_BEST_EFFORT (just like console DT node).
> > > >
> > > > Fixes: 8f486cab263c ("driver core: fw_devlink: Allow firmware to mark devices as best effort")
> > >
> > > It is good practice to Cc the commit author of what you are fixing.
> > >
> > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> > > > ---
> > > >  drivers/of/irq.c | 10 ++++++++++
> > > >  1 file changed, 10 insertions(+)
> > > >
> > > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > > > index 174900072c18..94e1d9245cff 100644
> > > > --- a/drivers/of/irq.c
> > > > +++ b/drivers/of/irq.c
> > > > @@ -535,6 +535,16 @@ void __init of_irq_init(const struct of_device_id *matches)
> > > >       INIT_LIST_HEAD(&intc_desc_list);
> > > >       INIT_LIST_HEAD(&intc_parent_list);
> > > >
> > > > +     /*
> > > > +      * We need interrupt controller platform drivers to work as soon
> > >
> > > If it's platform drivers/devices you care about, then perhaps this
> > > should be done when platform devices are created.
> > >
> > > > +      * as possible so mark the interrupt controller device nodes with
> > > > +      * FWNODE_FLAG_BEST_EFFORT so that fw_delink knows not to delay
> > > > +      * the probe of the interrupt controller device for suppliers
> > > > +      * without drivers.
> > > > +      */
> > > > +     for_each_node_with_property(np, "interrupt-controller")
> > >
> > > This function only operates on nodes matching 'matches', but this
> > > operates on everything.
> > >
> > > It does make sense that if we init an interrupt controller here, then we
> > > will surely want to probe its driver later on. So maybe just move
> > > setting FWNODE_FLAG_BEST_EFFORT within
> > > for_each_matching_node_and_match() below.
> > >
> > > > +             np->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT;
> > > > +
> >
> > Definite Nack. You are pretty much disabling fw_devlink for all
> > interrupt controllers. There are plenty of examples of the IRQ drivers
> > being needed very early on and still probing properly without the need
> > for this flag. Please fix your driver/DT.
>
> Okay, I will try to set FWNODE_FLAG_BEST_EFFORT only for
> APLIC device_node via IRQCHIP_DECLARE().

No, my point is that you very likely don't need to use that flag.

What exactly is the problem you are facing? Point to an example RISC-V
dts (not dtsi) in upstream and give specifics please.

-Saravana
Anup Patel June 13, 2023, 4:42 a.m. UTC | #5
On Sat, Jun 10, 2023 at 2:47 AM Saravana Kannan <saravanak@google.com> wrote:
>
> On Fri, Jun 9, 2023 at 4:40 AM Anup Patel <apatel@ventanamicro.com> wrote:
> >
> > On Fri, Jun 9, 2023 at 1:35 AM Saravana Kannan <saravanak@google.com> wrote:
> > >
> > > On Thu, Jun 8, 2023 at 11:28 AM Rob Herring <robh@kernel.org> wrote:
> > > >
> > > > +Saravana
> > > >
> > > > On Mon, May 08, 2023 at 07:58:33PM +0530, Anup Patel wrote:
> > > > > The RISC-V APLIC interrupt controller driver is a regular platform
> > > > > driver so we need to ensure that it is probed as soon as possible.
> > > > > To achieve this, we mark the interrupt controller device nodes with
> > > > > FWNODE_FLAG_BEST_EFFORT (just like console DT node).
> > > > >
> > > > > Fixes: 8f486cab263c ("driver core: fw_devlink: Allow firmware to mark devices as best effort")
> > > >
> > > > It is good practice to Cc the commit author of what you are fixing.
> > > >
> > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> > > > > ---
> > > > >  drivers/of/irq.c | 10 ++++++++++
> > > > >  1 file changed, 10 insertions(+)
> > > > >
> > > > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > > > > index 174900072c18..94e1d9245cff 100644
> > > > > --- a/drivers/of/irq.c
> > > > > +++ b/drivers/of/irq.c
> > > > > @@ -535,6 +535,16 @@ void __init of_irq_init(const struct of_device_id *matches)
> > > > >       INIT_LIST_HEAD(&intc_desc_list);
> > > > >       INIT_LIST_HEAD(&intc_parent_list);
> > > > >
> > > > > +     /*
> > > > > +      * We need interrupt controller platform drivers to work as soon
> > > >
> > > > If it's platform drivers/devices you care about, then perhaps this
> > > > should be done when platform devices are created.
> > > >
> > > > > +      * as possible so mark the interrupt controller device nodes with
> > > > > +      * FWNODE_FLAG_BEST_EFFORT so that fw_delink knows not to delay
> > > > > +      * the probe of the interrupt controller device for suppliers
> > > > > +      * without drivers.
> > > > > +      */
> > > > > +     for_each_node_with_property(np, "interrupt-controller")
> > > >
> > > > This function only operates on nodes matching 'matches', but this
> > > > operates on everything.
> > > >
> > > > It does make sense that if we init an interrupt controller here, then we
> > > > will surely want to probe its driver later on. So maybe just move
> > > > setting FWNODE_FLAG_BEST_EFFORT within
> > > > for_each_matching_node_and_match() below.
> > > >
> > > > > +             np->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT;
> > > > > +
> > >
> > > Definite Nack. You are pretty much disabling fw_devlink for all
> > > interrupt controllers. There are plenty of examples of the IRQ drivers
> > > being needed very early on and still probing properly without the need
> > > for this flag. Please fix your driver/DT.
> >
> > Okay, I will try to set FWNODE_FLAG_BEST_EFFORT only for
> > APLIC device_node via IRQCHIP_DECLARE().
>
> No, my point is that you very likely don't need to use that flag.
>
> What exactly is the problem you are facing? Point to an example RISC-V
> dts (not dtsi) in upstream and give specifics please.

The APLIC irqchip driver added by this series is a platform driver. It
used to work fine without setting FWNODE_FLAG_BEST_EFFORT
flag in fwnode but after commit 8f486cab263c the APLIC irqchip
driver did not probe hence this fix.

Regards,
Anup
diff mbox series

Patch

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 174900072c18..94e1d9245cff 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -535,6 +535,16 @@  void __init of_irq_init(const struct of_device_id *matches)
 	INIT_LIST_HEAD(&intc_desc_list);
 	INIT_LIST_HEAD(&intc_parent_list);
 
+	/*
+	 * We need interrupt controller platform drivers to work as soon
+	 * as possible so mark the interrupt controller device nodes with
+	 * FWNODE_FLAG_BEST_EFFORT so that fw_delink knows not to delay
+	 * the probe of the interrupt controller device for suppliers
+	 * without drivers.
+	 */
+	for_each_node_with_property(np, "interrupt-controller")
+		np->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT;
+
 	for_each_matching_node_and_match(np, matches, &match) {
 		if (!of_property_read_bool(np, "interrupt-controller") ||
 				!of_device_is_available(np))