linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [REGRESSION] Missing IRQ via amd_gpio
@ 2022-04-22 13:03 Takashi Iwai
  2022-04-22 14:17 ` Thorsten Leemhuis
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2022-04-22 13:03 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: Shreeya Patel, linux-gpio, linux-kernel, regressions

Hi,

we received a bug report for 5.17.3 kernel showing a new error:

 amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517

Not only an error message but in practice this leads to a missing IRQ
assignment; the IRQ 27 is no longer assigned to amd_gpio driver.

As the error number (EPROBE_DEFER) indicates, this seems to be the
side-effect of the recent fix, the upstream commit 5467801f1fcb
("gpio: Restrict usage of GPIO chip irq members before
initialization").  As far as I understand, the problem is in
acpi_gpiochip_request_interrupts() call that is called from
gpiochip_add_irqchip() itself.  Since it's called before the
initialized flag set, it always fails now.

Below is a temporary quick fix and it seems working.  But I'm not sure
whether I overlooked something obvious...


thanks,

Takashi

-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] gpio: Fix missing IRQ assginment for ACPI gpiochip

The recent fix for gpiolib caused an error like:
  amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517
It indicates -EPROBE_DEFER, and since the function
acpi_gpiochip_request_interrupts() doesn't handle the deferred probe,
this leads to the missing IRQs. 

The problem is that acpi_gpiochip_request_interrupts() itself is
called from gpiochip_add_irqchip() but before gc->irq.initialized flag
is set.  For fixing the regression, let's move the call of
acpi_gpiochip_request_interrupts() after the initialized flag setup.

Fixes: 5467801f1fcb ("gpio: Restrict usage of GPIO chip irq members before initialization")
BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1198697
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpio/gpiolib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 085348e08986..b7694171655c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1601,8 +1601,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
 
 	gpiochip_set_irq_hooks(gc);
 
-	acpi_gpiochip_request_interrupts(gc);
-
 	/*
 	 * Using barrier() here to prevent compiler from reordering
 	 * gc->irq.initialized before initialization of above
@@ -1612,6 +1610,8 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
 
 	gc->irq.initialized = true;
 
+	acpi_gpiochip_request_interrupts(gc);
+
 	return 0;
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [REGRESSION] Missing IRQ via amd_gpio
  2022-04-22 13:03 [REGRESSION] Missing IRQ via amd_gpio Takashi Iwai
@ 2022-04-22 14:17 ` Thorsten Leemhuis
  2022-04-22 14:29   ` Thorsten Leemhuis
  2022-04-22 14:33   ` Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Leemhuis @ 2022-04-22 14:17 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Shreeya Patel, linux-gpio, linux-kernel, regressions,
	Mario Limonciello, Linus Walleij, Bartosz Golaszewski

Hi Takashi! Thx for CCing the regression list.

On 22.04.22 15:03, Takashi Iwai wrote:
> Hi,
> 
> we received a bug report for 5.17.3 kernel showing a new error:
> 
>  amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517
> 
> Not only an error message but in practice this leads to a missing IRQ
> assignment; the IRQ 27 is no longer assigned to amd_gpio driver.
> 
> As the error number (EPROBE_DEFER) indicates, this seems to be the
> side-effect of the recent fix, the upstream commit 5467801f1fcb
> ("gpio: Restrict usage of GPIO chip irq members before
> initialization").  As far as I understand, the problem is in
> acpi_gpiochip_request_interrupts() call that is called from
> gpiochip_add_irqchip() itself.  Since it's called before the
> initialized flag set, it always fails now.
> 
> Below is a temporary quick fix and it seems working.  But I'm not sure
> whether I overlooked something obvious...

A patch that afaics will fix this hopefully should get merged really
soon now:

https://lore.kernel.org/all/20220422131452.20757-1-mario.limonciello@amd.com/

See also v1:

https://lore.kernel.org/all/20220414025705.598-1-mario.limonciello@amd.com/

Ciao, Thorsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [REGRESSION] Missing IRQ via amd_gpio
  2022-04-22 14:17 ` Thorsten Leemhuis
@ 2022-04-22 14:29   ` Thorsten Leemhuis
  2022-04-22 14:33   ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Thorsten Leemhuis @ 2022-04-22 14:29 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Shreeya Patel, linux-gpio, linux-kernel, regressions,
	Mario Limonciello, Linus Walleij, Bartosz Golaszewski



On 22.04.22 16:17, Thorsten Leemhuis wrote:
> Hi Takashi! Thx for CCing the regression list.
> 
> On 22.04.22 15:03, Takashi Iwai wrote:
>> Hi,
>>
>> we received a bug report for 5.17.3 kernel showing a new error:
>>
>>  amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517
>>
>> Not only an error message but in practice this leads to a missing IRQ
>> assignment; the IRQ 27 is no longer assigned to amd_gpio driver.
>>
>> As the error number (EPROBE_DEFER) indicates, this seems to be the
>> side-effect of the recent fix, the upstream commit 5467801f1fcb
>> ("gpio: Restrict usage of GPIO chip irq members before
>> initialization").  As far as I understand, the problem is in
>> acpi_gpiochip_request_interrupts() call that is called from
>> gpiochip_add_irqchip() itself.  Since it's called before the
>> initialized flag set, it always fails now.
>>
>> Below is a temporary quick fix and it seems working.  But I'm not sure
>> whether I overlooked something obvious...
> 
> A patch that afaics will fix this hopefully should get merged really
> soon now:
> 
> https://lore.kernel.org/all/20220422131452.20757-1-mario.limonciello@amd.com/
> 
> See also v1:
> 
> https://lore.kernel.org/all/20220414025705.598-1-mario.limonciello@amd.com/

Sorry, I shouldn't have stripped the rest of the message, mario might be
interested in at least the link, so here it is:

>> -- 8< --
>> From: Takashi Iwai <tiwai@suse.de>
>> Subject: [PATCH] gpio: Fix missing IRQ assginment for ACPI gpiochip
>> 
>> The recent fix for gpiolib caused an error like:
>>   amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517
>> It indicates -EPROBE_DEFER, and since the function
>> acpi_gpiochip_request_interrupts() doesn't handle the deferred probe,
>> this leads to the missing IRQs. 
>> 
>> The problem is that acpi_gpiochip_request_interrupts() itself is
>> called from gpiochip_add_irqchip() but before gc->irq.initialized flag
>> is set.  For fixing the regression, let's move the call of
>> acpi_gpiochip_request_interrupts() after the initialized flag setup.
>> 
>> Fixes: 5467801f1fcb ("gpio: Restrict usage of GPIO chip irq members before initialization")
>> BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1198697
>> Signed-off-by: Takashi Iwai <tiwai@suse.de>
>> ---
>>  drivers/gpio/gpiolib.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
>> index 085348e08986..b7694171655c 100644
>> --- a/drivers/gpio/gpiolib.c
>> +++ b/drivers/gpio/gpiolib.c
>> @@ -1601,8 +1601,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
>>  
>>  	gpiochip_set_irq_hooks(gc);
>>  
>> -	acpi_gpiochip_request_interrupts(gc);
>> -
>>  	/*
>>  	 * Using barrier() here to prevent compiler from reordering
>>  	 * gc->irq.initialized before initialization of above
>> @@ -1612,6 +1610,8 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
>>  
>>  	gc->irq.initialized = true;
>>  
>> +	acpi_gpiochip_request_interrupts(gc);
>> +
>>  	return 0;
>>  }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [REGRESSION] Missing IRQ via amd_gpio
  2022-04-22 14:17 ` Thorsten Leemhuis
  2022-04-22 14:29   ` Thorsten Leemhuis
@ 2022-04-22 14:33   ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2022-04-22 14:33 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Takashi Iwai, Shreeya Patel, linux-gpio, linux-kernel,
	regressions, Mario Limonciello, Linus Walleij,
	Bartosz Golaszewski

On Fri, 22 Apr 2022 16:17:36 +0200,
Thorsten Leemhuis wrote:
> 
> Hi Takashi! Thx for CCing the regression list.
> 
> On 22.04.22 15:03, Takashi Iwai wrote:
> > Hi,
> > 
> > we received a bug report for 5.17.3 kernel showing a new error:
> > 
> >  amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517
> > 
> > Not only an error message but in practice this leads to a missing IRQ
> > assignment; the IRQ 27 is no longer assigned to amd_gpio driver.
> > 
> > As the error number (EPROBE_DEFER) indicates, this seems to be the
> > side-effect of the recent fix, the upstream commit 5467801f1fcb
> > ("gpio: Restrict usage of GPIO chip irq members before
> > initialization").  As far as I understand, the problem is in
> > acpi_gpiochip_request_interrupts() call that is called from
> > gpiochip_add_irqchip() itself.  Since it's called before the
> > initialized flag set, it always fails now.
> > 
> > Below is a temporary quick fix and it seems working.  But I'm not sure
> > whether I overlooked something obvious...
> 
> A patch that afaics will fix this hopefully should get merged really
> soon now:
> 
> https://lore.kernel.org/all/20220422131452.20757-1-mario.limonciello@amd.com/
> 
> See also v1:
> 
> https://lore.kernel.org/all/20220414025705.598-1-mario.limonciello@amd.com/

Thanks, good to know that we reached to the very same fix :)

So, feel free to take my tags to Mario's patch, if any:

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Takashi Iwai <tiwai@suse.de>


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-22 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-22 13:03 [REGRESSION] Missing IRQ via amd_gpio Takashi Iwai
2022-04-22 14:17 ` Thorsten Leemhuis
2022-04-22 14:29   ` Thorsten Leemhuis
2022-04-22 14:33   ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).