All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: baytrail: Set IRQCHIP_SET_TYPE_MASKED flag on the irqchip
@ 2021-11-22 22:04 Hans de Goede
  2021-11-23 11:08 ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2021-11-22 22:04 UTC (permalink / raw)
  To: Mika Westerberg, Andy Shevchenko, Linus Walleij
  Cc: Hans de Goede, linux-gpio, linux-acpi

The byt_irq_type function ends with the IRQ masked, this means that calls
to irq_set_irq_type() while the IRQ is enabled end up masking it, which
is wrong. Add the IRQCHIP_SET_TYPE_MASKED flag to fix this.

This will make the IRQ core call mask() + unmask() on the IRQ around
a set_type() call when the IRQ is enabled at the type of the call.

Note in practice irq_set_irq_type() getting called while the IRQ is enabled
almost never happens. I hit this with a buggy DSDT where a wrongly active
(_STA returns 0xf) I2C ACPI devices point to an IRQ already in use by an
_AEI handler, leading to the irq_set_irq_type() call in
acpi_dev_gpio_irq_get_by() getting called while the IRQ is enabled.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 744ebe417bff..e3dd105e2f6e 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1554,7 +1554,8 @@ static int byt_gpio_probe(struct intel_pinctrl *vg)
 		vg->irqchip.irq_mask = byt_irq_mask,
 		vg->irqchip.irq_unmask = byt_irq_unmask,
 		vg->irqchip.irq_set_type = byt_irq_type,
-		vg->irqchip.flags = IRQCHIP_SKIP_SET_WAKE,
+		vg->irqchip.flags = IRQCHIP_SKIP_SET_WAKE |
+				    IRQCHIP_SET_TYPE_MASKED,
 
 		girq = &gc->irq;
 		girq->chip = &vg->irqchip;
-- 
2.33.1


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

* Re: [PATCH] pinctrl: baytrail: Set IRQCHIP_SET_TYPE_MASKED flag on the irqchip
  2021-11-22 22:04 [PATCH] pinctrl: baytrail: Set IRQCHIP_SET_TYPE_MASKED flag on the irqchip Hans de Goede
@ 2021-11-23 11:08 ` Mika Westerberg
  2021-11-23 13:39   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2021-11-23 11:08 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Andy Shevchenko, Linus Walleij, linux-gpio, linux-acpi

On Mon, Nov 22, 2021 at 11:04:23PM +0100, Hans de Goede wrote:
> The byt_irq_type function ends with the IRQ masked, this means that calls
> to irq_set_irq_type() while the IRQ is enabled end up masking it, which
> is wrong. Add the IRQCHIP_SET_TYPE_MASKED flag to fix this.
> 
> This will make the IRQ core call mask() + unmask() on the IRQ around
> a set_type() call when the IRQ is enabled at the type of the call.
> 
> Note in practice irq_set_irq_type() getting called while the IRQ is enabled
> almost never happens. I hit this with a buggy DSDT where a wrongly active
> (_STA returns 0xf) I2C ACPI devices point to an IRQ already in use by an
> _AEI handler, leading to the irq_set_irq_type() call in
> acpi_dev_gpio_irq_get_by() getting called while the IRQ is enabled.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH] pinctrl: baytrail: Set IRQCHIP_SET_TYPE_MASKED flag on the irqchip
  2021-11-23 11:08 ` Mika Westerberg
@ 2021-11-23 13:39   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-11-23 13:39 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Hans de Goede, Andy Shevchenko, Linus Walleij, linux-gpio, linux-acpi

On Tue, Nov 23, 2021 at 01:08:30PM +0200, Mika Westerberg wrote:
> On Mon, Nov 22, 2021 at 11:04:23PM +0100, Hans de Goede wrote:
> > The byt_irq_type function ends with the IRQ masked, this means that calls
> > to irq_set_irq_type() while the IRQ is enabled end up masking it, which
> > is wrong. Add the IRQCHIP_SET_TYPE_MASKED flag to fix this.
> > 
> > This will make the IRQ core call mask() + unmask() on the IRQ around
> > a set_type() call when the IRQ is enabled at the type of the call.
> > 
> > Note in practice irq_set_irq_type() getting called while the IRQ is enabled
> > almost never happens. I hit this with a buggy DSDT where a wrongly active
> > (_STA returns 0xf) I2C ACPI devices point to an IRQ already in use by an
> > _AEI handler, leading to the irq_set_irq_type() call in
> > acpi_dev_gpio_irq_get_by() getting called while the IRQ is enabled.
> > 
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2021-11-23 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 22:04 [PATCH] pinctrl: baytrail: Set IRQCHIP_SET_TYPE_MASKED flag on the irqchip Hans de Goede
2021-11-23 11:08 ` Mika Westerberg
2021-11-23 13:39   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.