2021-01-20 00:52:00

by Dmitry Osipenko

[permalink] [raw]
Subject: [PATCH v1] gpio: tegra: Fix irq_set_affinity

The irq_set_affinity callback should not be set if parent IRQ domain
doesn't present because gpio-tegra driver callback fails in this case,
causing a noisy error messages on system suspend:

Disabling non-boot CPUs ...
IRQ 26: no longer affine to CPU1
IRQ128: set affinity failed(-22).
IRQ130: set affinity failed(-22).
IRQ131: set affinity failed(-22).
IRQ 27: no longer affine to CPU2
IRQ128: set affinity failed(-22).
IRQ130: set affinity failed(-22).
IRQ131: set affinity failed(-22).
IRQ 28: no longer affine to CPU3
IRQ128: set affinity failed(-22).
IRQ130: set affinity failed(-22).
IRQ131: set affinity failed(-22).
Entering suspend state LP1

Hence just don't specify the irq_set_affinity callback if parent PMC
IRQ domain is missing. Tegra isn't capable of setting affinity per GPIO,
affinity could be set only per GPIO bank, thus there is nothing to do
for gpio-tegra in regards to CPU affinity without the parent IRQ domain.

Tested-by: Peter Geis <[email protected]> # Ouya T30
Tested-by: Matt Merhar <[email protected]> # Ouya T30
Tested-by: Dmitry Osipenko <[email protected]> # A500 T20 and Nexus7 T30
Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip")
Reported-by: Matt Merhar <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/gpio/gpio-tegra.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 6c79e9d2f932..9a43129313fa 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -701,7 +701,6 @@ static int tegra_gpio_probe(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
tgi->ic.irq_set_wake = tegra_gpio_irq_set_wake;
#endif
- tgi->ic.irq_set_affinity = tegra_gpio_irq_set_affinity;
tgi->ic.irq_request_resources = tegra_gpio_irq_request_resources;
tgi->ic.irq_release_resources = tegra_gpio_irq_release_resources;

@@ -754,6 +753,8 @@ static int tegra_gpio_probe(struct platform_device *pdev)

if (!irq->parent_domain)
return -EPROBE_DEFER;
+
+ tgi->ic.irq_set_affinity = tegra_gpio_irq_set_affinity;
}

tgi->regs = devm_platform_ioremap_resource(pdev, 0);
--
2.29.2


2021-01-22 12:58:28

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v1] gpio: tegra: Fix irq_set_affinity

On Wed, Jan 20, 2021 at 1:46 AM Dmitry Osipenko <[email protected]> wrote:

> The irq_set_affinity callback should not be set if parent IRQ domain
> doesn't present because gpio-tegra driver callback fails in this case,
> causing a noisy error messages on system suspend:
>
> Disabling non-boot CPUs ...
> IRQ 26: no longer affine to CPU1
> IRQ128: set affinity failed(-22).
> IRQ130: set affinity failed(-22).
> IRQ131: set affinity failed(-22).
> IRQ 27: no longer affine to CPU2
> IRQ128: set affinity failed(-22).
> IRQ130: set affinity failed(-22).
> IRQ131: set affinity failed(-22).
> IRQ 28: no longer affine to CPU3
> IRQ128: set affinity failed(-22).
> IRQ130: set affinity failed(-22).
> IRQ131: set affinity failed(-22).
> Entering suspend state LP1
>
> Hence just don't specify the irq_set_affinity callback if parent PMC
> IRQ domain is missing. Tegra isn't capable of setting affinity per GPIO,
> affinity could be set only per GPIO bank, thus there is nothing to do
> for gpio-tegra in regards to CPU affinity without the parent IRQ domain.
>
> Tested-by: Peter Geis <[email protected]> # Ouya T30
> Tested-by: Matt Merhar <[email protected]> # Ouya T30
> Tested-by: Dmitry Osipenko <[email protected]> # A500 T20 and Nexus7 T30
> Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip")
> Reported-by: Matt Merhar <[email protected]>
> Signed-off-by: Dmitry Osipenko <[email protected]>

Ick, sorry for the noise!
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2021-01-28 00:02:35

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v1] gpio: tegra: Fix irq_set_affinity

On Fri, Jan 22, 2021 at 1:56 PM Linus Walleij <[email protected]> wrote:
>
> On Wed, Jan 20, 2021 at 1:46 AM Dmitry Osipenko <[email protected]> wrote:
>
> > The irq_set_affinity callback should not be set if parent IRQ domain
> > doesn't present because gpio-tegra driver callback fails in this case,
> > causing a noisy error messages on system suspend:
> >
> > Disabling non-boot CPUs ...
> > IRQ 26: no longer affine to CPU1
> > IRQ128: set affinity failed(-22).
> > IRQ130: set affinity failed(-22).
> > IRQ131: set affinity failed(-22).
> > IRQ 27: no longer affine to CPU2
> > IRQ128: set affinity failed(-22).
> > IRQ130: set affinity failed(-22).
> > IRQ131: set affinity failed(-22).
> > IRQ 28: no longer affine to CPU3
> > IRQ128: set affinity failed(-22).
> > IRQ130: set affinity failed(-22).
> > IRQ131: set affinity failed(-22).
> > Entering suspend state LP1
> >
> > Hence just don't specify the irq_set_affinity callback if parent PMC
> > IRQ domain is missing. Tegra isn't capable of setting affinity per GPIO,
> > affinity could be set only per GPIO bank, thus there is nothing to do
> > for gpio-tegra in regards to CPU affinity without the parent IRQ domain.
> >
> > Tested-by: Peter Geis <[email protected]> # Ouya T30
> > Tested-by: Matt Merhar <[email protected]> # Ouya T30
> > Tested-by: Dmitry Osipenko <[email protected]> # A500 T20 and Nexus7 T30
> > Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip")
> > Reported-by: Matt Merhar <[email protected]>
> > Signed-off-by: Dmitry Osipenko <[email protected]>
>
> Ick, sorry for the noise!
> Reviewed-by: Linus Walleij <[email protected]>
>
> Yours,
> Linus Walleij

Patch applied, thanks!

Bartosz