Re: [PATCH v3 2/2] platform/x86: intel_int0002_vgpio: Use acpi_register_wakeup_handler()

From: Andy Shevchenko
Date: Fri Apr 03 2020 - 12:24:05 EST


On Fri, Apr 3, 2020 at 7:08 PM Rafael J. Wysocki <rjw@xxxxxxxxxxxxx> wrote:
>
> On Friday, April 3, 2020 5:48:34 PM CEST Hans de Goede wrote:
> > The Power Management Events (PMEs) the INT0002 driver listens for get
> > signalled by the Power Management Controller (PMC) using the same IRQ
> > as used for the ACPI SCI.
> >
> > Since commit fdde0ff8590b ("ACPI: PM: s2idle: Prevent spurious SCIs from
> > waking up the system") the SCI triggering, without there being a wakeup
> > cause recognized by the ACPI sleep code, will no longer wakeup the system.
> >
> > This breaks PMEs / wakeups signalled to the INT0002 driver, the system
> > never leaves the s2idle_loop() now.
> >
> > Use acpi_register_wakeup_handler() to register a function which checks
> > the GPE0a_STS register for a PME and trigger a wakeup when a PME has
> > been signalled.
> >
> > Fixes: fdde0ff8590b ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system")
> > Cc: 5.4+ <stable@xxxxxxxxxxxxxxx> # 5.4+
> > Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
>
> Andy, any objections?

No,
Acked-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>

Hans, just today when testing some other stuff noticed this

[ 49.279001] irq 9: nobody cared (try booting with the "irqpoll" option)
[ 49.289176] CPU: 0 PID: 168 Comm: irq/123-ATML100 Not tainted
5.6.0-next-20200403+ #212
[ 49.300915] Hardware name: Intel Corporation CHERRYVIEW D0
PLATFORM/Braswell CRB, BIOS BRAS.X64.B082.R00.150727 0557 07/27/2015
[ 49.316520] Call Trace:
[ 49.322093] <IRQ>
[ 49.327193] dump_stack+0x50/0x70
[ 49.333744] __report_bad_irq+0x30/0xa2
[ 49.340858] note_interrupt.cold+0xb/0x62
...
[ 49.685087] handlers:
[ 49.690307] [<000000000ab3cf88>] acpi_irq
[ 49.697463] [<00000000e5d78029>] int0002_irq [intel_int0002_vgpio]
[ 49.707063] Disabling IRQ #9

Is this what your series fixes?

>
> > ---
> > Changes in v3:
> > - Keep the pm_wakeup_hard_event() call
> >
> > Changes in v2:
> > - Adjust for the wakeup-handler registration function being renamed to
> > acpi_register_wakeup_handler()
> > ---
> > drivers/platform/x86/intel_int0002_vgpio.c | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
> > index f14e2c5f9da5..55f088f535e2 100644
> > --- a/drivers/platform/x86/intel_int0002_vgpio.c
> > +++ b/drivers/platform/x86/intel_int0002_vgpio.c
> > @@ -127,6 +127,14 @@ static irqreturn_t int0002_irq(int irq, void *data)
> > return IRQ_HANDLED;
> > }
> >
> > +static bool int0002_check_wake(void *data)
> > +{
> > + u32 gpe_sts_reg;
> > +
> > + gpe_sts_reg = inl(GPE0A_STS_PORT);
> > + return (gpe_sts_reg & GPE0A_PME_B0_STS_BIT);
> > +}
> > +
> > static struct irq_chip int0002_byt_irqchip = {
> > .name = DRV_NAME,
> > .irq_ack = int0002_irq_ack,
> > @@ -220,6 +228,7 @@ static int int0002_probe(struct platform_device *pdev)
> > return ret;
> > }
> >
> > + acpi_register_wakeup_handler(irq, int0002_check_wake, NULL);
> > device_init_wakeup(dev, true);
> > return 0;
> > }
> > @@ -227,6 +236,7 @@ static int int0002_probe(struct platform_device *pdev)
> > static int int0002_remove(struct platform_device *pdev)
> > {
> > device_init_wakeup(&pdev->dev, false);
> > + acpi_unregister_wakeup_handler(int0002_check_wake, NULL);
> > return 0;
> > }
> >
> >
>
>
>
>


--
With Best Regards,
Andy Shevchenko