linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Interrupt storm from pinctrl-amd on Acer AN515-42
@ 2018-12-27 23:02 Leonard Crestez
  2018-12-28 12:48 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Leonard Crestez @ 2018-12-27 23:02 UTC (permalink / raw)
  To: Daniel Kurtz, Thomas Gleixner, Nehal Shah, Shyam Sundar S K
  Cc: Linus Walleij, Daniel Drake, Nitesh Kumar Agrawal, linux-gpio,
	linux-kernel, Hans de Goede

Hello,

My Acer Nitro 5 AN515-42 laptop with a Ryzen 2700U hangs on boot with 
recent kernel on an interrupt storm from pinctrl-amd.

Older kernels work but this seems to be because this module was disabled 
by default. I tried to copy over old driver from 4.9 but it still 
experiences same issue.

Digging a little deeper it seems the touchpad interrupt is active on 
boot and since it's configured as "level" and no touchpad driver is 
available yet there does not seem to be any way to clear it.

I don't know how this should be handled, booting with an active enabled but 
unclearable interrupt seems like a platform bug to me. There is even an 
option to set touchpad to "basic" which does some sort of ps2 emulation 
but the IRQ issue still happens!

One workaround is to explicitly disable the interrupt from the handler 
if no mapping is found; this will keep it disabled until 
amd_gpio_irq_set_type is called later.

--- drivers/pinctrl/pinctrl-amd.c
+++ drivers/pinctrl/pinctrl-amd.c
@@ -567,22 +567,27 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
                        regval = readl(regs + i);
                        if (!(regval & PIN_IRQ_PENDING) ||
                            !(regval & BIT(INTERRUPT_MASK_OFF)))
                                continue;
                        irq = irq_find_mapping(gc->irq.domain, irqnr + i);
-                       generic_handle_irq(irq);
+                       if (irq) {
+                               generic_handle_irq(irq);
+                               ret = IRQ_HANDLED;
+                       }
 
                        /* Clear interrupt.
                         * We must read the pin register again, in case the
                         * value was changed while executing
                         * generic_handle_irq() above.
                         */
                        raw_spin_lock_irqsave(&gpio_dev->lock, flags);
                        regval = readl(regs + i);
+                       /* Disable if pending but unmapped */
+                       if (!irq && (regval & PIN_IRQ_PENDING))
+                               regval &= ~BIT(INTERRUPT_ENABLE_OFF);
                        writel(regval, regs + i);
                        raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
-                       ret = IRQ_HANDLED;
                }
        }
 
        /* Signal EOI to the GPIO unit */


When in "i2c mode" the touchpad has an ACPI hid "ELAN0504", there are
many similar compatibe hids in elan_i2c driver and if I add this one it
probes successfully and handles irqs but fails to report input (i2c 
read data is invalid).

Same laptop experiences some severe p-state throttling issues so there
are many things wrong here. Let me know if you want more version info
or ACPI dumps.

--
Regards,
Leonard


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

* Re: Interrupt storm from pinctrl-amd on Acer AN515-42
  2018-12-27 23:02 Interrupt storm from pinctrl-amd on Acer AN515-42 Leonard Crestez
@ 2018-12-28 12:48 ` Linus Walleij
  2019-01-08 15:01   ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2018-12-28 12:48 UTC (permalink / raw)
  To: Leonard Crestez, Andy Shevchenko
  Cc: Daniel Kurtz, Thomas Gleixner, Nehal Shah, Shyam Sundar S K,
	Daniel Drake, Nitesh Kumar Agrawal, linux-gpio, linux-kernel,
	Hans de Goede

On Fri, Dec 28, 2018 at 12:02 AM Leonard Crestez <cdleonard@gmail.com> wrote:

> Digging a little deeper it seems the touchpad interrupt is active on
> boot and since it's configured as "level" and no touchpad driver is
> available yet there does not seem to be any way to clear it.

I think these are called "spurious interrupts".

> I don't know how this should be handled, booting with an active enabled but
> unclearable interrupt seems like a platform bug to me. There is even an
> option to set touchpad to "basic" which does some sort of ps2 emulation
> but the IRQ issue still happens!
>
> One workaround is to explicitly disable the interrupt from the handler
> if no mapping is found; this will keep it disabled until
> amd_gpio_irq_set_type is called later.

I don't know how x86 and ACPI systems usually deal with this stuff
so I'm kind of lost. On the embedded systems that I develop on,
I would just disable all interrupts on probe() (usually writing 0x0 in
some interrupt enable register) and then they will get enabled
once consumers need them.

But I have come to understand that maybe ACPI systems are
not so happy about drivers doing things like that?

Yours,
Linus Walleij

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

* Re: Interrupt storm from pinctrl-amd on Acer AN515-42
  2018-12-28 12:48 ` Linus Walleij
@ 2019-01-08 15:01   ` Thomas Gleixner
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2019-01-08 15:01 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Leonard Crestez, Andy Shevchenko, Daniel Kurtz, Nehal Shah,
	Shyam Sundar S K, Daniel Drake, Nitesh Kumar Agrawal, linux-gpio,
	linux-kernel, Hans de Goede

On Fri, 28 Dec 2018, Linus Walleij wrote:

> On Fri, Dec 28, 2018 at 12:02 AM Leonard Crestez <cdleonard@gmail.com> wrote:
> 
> > Digging a little deeper it seems the touchpad interrupt is active on
> > boot and since it's configured as "level" and no touchpad driver is
> > available yet there does not seem to be any way to clear it.
> 
> I think these are called "spurious interrupts".
> 
> > I don't know how this should be handled, booting with an active enabled but
> > unclearable interrupt seems like a platform bug to me. There is even an
> > option to set touchpad to "basic" which does some sort of ps2 emulation
> > but the IRQ issue still happens!
> >
> > One workaround is to explicitly disable the interrupt from the handler
> > if no mapping is found; this will keep it disabled until
> > amd_gpio_irq_set_type is called later.
> 
> I don't know how x86 and ACPI systems usually deal with this stuff
> so I'm kind of lost. On the embedded systems that I develop on,
> I would just disable all interrupts on probe() (usually writing 0x0 in
> some interrupt enable register) and then they will get enabled
> once consumers need them.

That's the right thing to do.

> But I have come to understand that maybe ACPI systems are
> not so happy about drivers doing things like that?

Each driver has to invoke a request_irq() variant, which enables the
interrupt line. So there should be no problem when disabling all interrupts
on probe.

Thanks,

	tglx


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

end of thread, other threads:[~2019-01-08 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27 23:02 Interrupt storm from pinctrl-amd on Acer AN515-42 Leonard Crestez
2018-12-28 12:48 ` Linus Walleij
2019-01-08 15:01   ` Thomas Gleixner

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).