All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt
@ 2022-08-03  4:24 Mario Limonciello
  2022-08-03  4:25 ` [PATCH v2 2/2] gpiolib: acpi: Add a quirk for Asus UM325UAZ Mario Limonciello
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Mario Limonciello @ 2022-08-03  4:24 UTC (permalink / raw)
  To: Hans de Goede, Mika Westerberg, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski
  Cc: Mario Limonciello, linux-gpio, linux-acpi, linux-kernel

gpiolib-acpi already had support for ignoring a pin for wakeup, but
if an OEM configures a floating pin as an interrupt source then
stopping it from being a wakeup won't do much good to stop the
interrupt storm.

Add support for a module parameter and quirk infrastructure to
ignore interrupts as well.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
 * Drop enum
 * Drop Tested-by tag

 drivers/gpio/gpiolib-acpi.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index c2523ac26fac..f993f6f728ad 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -32,9 +32,16 @@ MODULE_PARM_DESC(ignore_wake,
 		 "controller@pin combos on which to ignore the ACPI wake flag "
 		 "ignore_wake=controller@pin[,controller@pin[,...]]");
 
+static char *ignore_interrupt;
+module_param(ignore_interrupt, charp, 0444);
+MODULE_PARM_DESC(ignore_interrupt,
+		 "controller@pin combos on which to ignore interrupt "
+		 "ignore_interrupt=controller@pin[,controller@pin[,...]]");
+
 struct acpi_gpiolib_dmi_quirk {
 	bool no_edge_events_on_boot;
 	char *ignore_wake;
+	char *ignore_interrupt;
 };
 
 /**
@@ -317,14 +324,15 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
 	return desc;
 }
 
-static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin_in)
+static bool acpi_gpio_in_ignore_list(const char *ignore_list, const char *controller_in,
+				     unsigned int pin_in)
 {
 	const char *controller, *pin_str;
 	unsigned int pin;
 	char *endp;
 	int len;
 
-	controller = ignore_wake;
+	controller = ignore_list;
 	while (controller) {
 		pin_str = strchr(controller, '@');
 		if (!pin_str)
@@ -348,7 +356,7 @@ static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin
 
 	return false;
 err:
-	pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_wake: %s\n", ignore_wake);
+	pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_...: %s\n", ignore_list);
 	return false;
 }
 
@@ -360,7 +368,7 @@ static bool acpi_gpio_irq_is_wake(struct device *parent,
 	if (agpio->wake_capable != ACPI_WAKE_CAPABLE)
 		return false;
 
-	if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) {
+	if (acpi_gpio_in_ignore_list(ignore_wake, dev_name(parent), pin)) {
 		dev_info(parent, "Ignoring wakeup on pin %u\n", pin);
 		return false;
 	}
@@ -427,6 +435,11 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
 		goto fail_unlock_irq;
 	}
 
+	if (acpi_gpio_in_ignore_list(ignore_interrupt, dev_name(chip->parent), pin)) {
+		dev_info(chip->parent, "Ignoring interrupt on pin %u\n", pin);
+		return AE_OK;
+	}
+
 	event = kzalloc(sizeof(*event), GFP_KERNEL);
 	if (!event)
 		goto fail_unlock_irq;
@@ -1582,6 +1595,9 @@ static int __init acpi_gpio_setup_params(void)
 	if (ignore_wake == NULL && quirk && quirk->ignore_wake)
 		ignore_wake = quirk->ignore_wake;
 
+	if (ignore_interrupt == NULL && quirk && quirk->ignore_interrupt)
+		ignore_interrupt = quirk->ignore_interrupt;
+
 	return 0;
 }
 
-- 
2.34.1


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

* [PATCH v2 2/2] gpiolib: acpi: Add a quirk for Asus UM325UAZ
  2022-08-03  4:24 [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt Mario Limonciello
@ 2022-08-03  4:25 ` Mario Limonciello
  2022-08-03  9:50   ` Mika Westerberg
  2022-08-03  9:47 ` [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt Mika Westerberg
  2022-08-03 15:07 ` Hans de Goede
  2 siblings, 1 reply; 8+ messages in thread
From: Mario Limonciello @ 2022-08-03  4:25 UTC (permalink / raw)
  To: Hans de Goede, Mika Westerberg, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski
  Cc: Mario Limonciello, Pavel Krc, linux-gpio, linux-acpi, linux-kernel

Asus UM325UAZ has GPIO 18 programmed as both an interrupt and a wake
source, but confirmed with internal team on this design this pin is
floating and shouldn't have been programmed. This causes lots of
spurious IRQs on the system and horrendous battery life.

Add a quirk to ignore attempts to program this pin on this system.

Reported-by: Pavel Krc <reg.krn@pkrc.net>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216208
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
 * Drop Tested-by tag
 * Add Reviewed by tag

 drivers/gpio/gpiolib-acpi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index f993f6f728ad..9c8ab1dc6087 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -1573,6 +1573,20 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = {
 			.ignore_wake = "INT33FF:01@0",
 		},
 	},
+	{
+		/*
+		 * Interrupt storm caused from edge triggered floating pin
+		 * Found in BIOS UX325UAZ.300
+		 * https://bugzilla.kernel.org/show_bug.cgi?id=216208
+		 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UAZ_UM325UAZ"),
+		},
+		.driver_data = &(struct acpi_gpiolib_dmi_quirk) {
+			.ignore_interrupt = "AMDI0030:00@18",
+		},
+	},
 	{} /* Terminating entry */
 };
 
-- 
2.34.1


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

* Re: [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt
  2022-08-03  4:24 [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt Mario Limonciello
  2022-08-03  4:25 ` [PATCH v2 2/2] gpiolib: acpi: Add a quirk for Asus UM325UAZ Mario Limonciello
@ 2022-08-03  9:47 ` Mika Westerberg
  2022-08-03 15:07 ` Hans de Goede
  2 siblings, 0 replies; 8+ messages in thread
From: Mika Westerberg @ 2022-08-03  9:47 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Hans de Goede, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-acpi, linux-kernel

On Tue, Aug 02, 2022 at 11:24:59PM -0500, Mario Limonciello wrote:
> gpiolib-acpi already had support for ignoring a pin for wakeup, but
> if an OEM configures a floating pin as an interrupt source then
> stopping it from being a wakeup won't do much good to stop the
> interrupt storm.
> 
> Add support for a module parameter and quirk infrastructure to
> ignore interrupts as well.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

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

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

* Re: [PATCH v2 2/2] gpiolib: acpi: Add a quirk for Asus UM325UAZ
  2022-08-03  4:25 ` [PATCH v2 2/2] gpiolib: acpi: Add a quirk for Asus UM325UAZ Mario Limonciello
@ 2022-08-03  9:50   ` Mika Westerberg
  0 siblings, 0 replies; 8+ messages in thread
From: Mika Westerberg @ 2022-08-03  9:50 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Hans de Goede, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski, Pavel Krc, linux-gpio, linux-acpi,
	linux-kernel

On Tue, Aug 02, 2022 at 11:25:00PM -0500, Mario Limonciello wrote:
> Asus UM325UAZ has GPIO 18 programmed as both an interrupt and a wake
> source, but confirmed with internal team on this design this pin is
> floating and shouldn't have been programmed. This causes lots of
> spurious IRQs on the system and horrendous battery life.
> 
> Add a quirk to ignore attempts to program this pin on this system.
> 
> Reported-by: Pavel Krc <reg.krn@pkrc.net>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216208
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

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

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

* Re: [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt
  2022-08-03  4:24 [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt Mario Limonciello
  2022-08-03  4:25 ` [PATCH v2 2/2] gpiolib: acpi: Add a quirk for Asus UM325UAZ Mario Limonciello
  2022-08-03  9:47 ` [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt Mika Westerberg
@ 2022-08-03 15:07 ` Hans de Goede
  2022-08-26 17:31   ` Andy Shevchenko
  2 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2022-08-03 15:07 UTC (permalink / raw)
  To: Mario Limonciello, Mika Westerberg, Andy Shevchenko,
	Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-acpi, linux-kernel

Hi,

On 8/3/22 06:24, Mario Limonciello wrote:
> gpiolib-acpi already had support for ignoring a pin for wakeup, but
> if an OEM configures a floating pin as an interrupt source then
> stopping it from being a wakeup won't do much good to stop the
> interrupt storm.
> 
> Add support for a module parameter and quirk infrastructure to
> ignore interrupts as well.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
> v1->v2:
>  * Drop enum
>  * Drop Tested-by tag
> 
>  drivers/gpio/gpiolib-acpi.c | 24 ++++++++++++++++++++----
>  1 file changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index c2523ac26fac..f993f6f728ad 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -32,9 +32,16 @@ MODULE_PARM_DESC(ignore_wake,
>  		 "controller@pin combos on which to ignore the ACPI wake flag "
>  		 "ignore_wake=controller@pin[,controller@pin[,...]]");
>  
> +static char *ignore_interrupt;
> +module_param(ignore_interrupt, charp, 0444);
> +MODULE_PARM_DESC(ignore_interrupt,
> +		 "controller@pin combos on which to ignore interrupt "
> +		 "ignore_interrupt=controller@pin[,controller@pin[,...]]");
> +
>  struct acpi_gpiolib_dmi_quirk {
>  	bool no_edge_events_on_boot;
>  	char *ignore_wake;
> +	char *ignore_interrupt;
>  };
>  
>  /**
> @@ -317,14 +324,15 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
>  	return desc;
>  }
>  
> -static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin_in)
> +static bool acpi_gpio_in_ignore_list(const char *ignore_list, const char *controller_in,
> +				     unsigned int pin_in)
>  {
>  	const char *controller, *pin_str;
>  	unsigned int pin;
>  	char *endp;
>  	int len;
>  
> -	controller = ignore_wake;
> +	controller = ignore_list;
>  	while (controller) {
>  		pin_str = strchr(controller, '@');
>  		if (!pin_str)
> @@ -348,7 +356,7 @@ static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin
>  
>  	return false;
>  err:
> -	pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_wake: %s\n", ignore_wake);
> +	pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_...: %s\n", ignore_list);
>  	return false;
>  }
>  
> @@ -360,7 +368,7 @@ static bool acpi_gpio_irq_is_wake(struct device *parent,
>  	if (agpio->wake_capable != ACPI_WAKE_CAPABLE)
>  		return false;
>  
> -	if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) {
> +	if (acpi_gpio_in_ignore_list(ignore_wake, dev_name(parent), pin)) {
>  		dev_info(parent, "Ignoring wakeup on pin %u\n", pin);
>  		return false;
>  	}
> @@ -427,6 +435,11 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
>  		goto fail_unlock_irq;
>  	}
>  
> +	if (acpi_gpio_in_ignore_list(ignore_interrupt, dev_name(chip->parent), pin)) {
> +		dev_info(chip->parent, "Ignoring interrupt on pin %u\n", pin);
> +		return AE_OK;
> +	}
> +
>  	event = kzalloc(sizeof(*event), GFP_KERNEL);
>  	if (!event)
>  		goto fail_unlock_irq;
> @@ -1582,6 +1595,9 @@ static int __init acpi_gpio_setup_params(void)
>  	if (ignore_wake == NULL && quirk && quirk->ignore_wake)
>  		ignore_wake = quirk->ignore_wake;
>  
> +	if (ignore_interrupt == NULL && quirk && quirk->ignore_interrupt)
> +		ignore_interrupt = quirk->ignore_interrupt;
> +
>  	return 0;
>  }
>  


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

* Re: [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt
  2022-08-03 15:07 ` Hans de Goede
@ 2022-08-26 17:31   ` Andy Shevchenko
  2022-08-29 18:16     ` Limonciello, Mario
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2022-08-26 17:31 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Mario Limonciello, Mika Westerberg, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-acpi, linux-kernel

On Wed, Aug 03, 2022 at 05:07:15PM +0200, Hans de Goede wrote:
> On 8/3/22 06:24, Mario Limonciello wrote:
> > gpiolib-acpi already had support for ignoring a pin for wakeup, but
> > if an OEM configures a floating pin as an interrupt source then
> > stopping it from being a wakeup won't do much good to stop the
> > interrupt storm.
> > 
> > Add support for a module parameter and quirk infrastructure to
> > ignore interrupts as well.
> > 
> > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> 
> Thanks, patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko



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

* RE: [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt
  2022-08-26 17:31   ` Andy Shevchenko
@ 2022-08-29 18:16     ` Limonciello, Mario
  2022-08-29 19:26       ` Andy Shevchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Limonciello, Mario @ 2022-08-29 18:16 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede
  Cc: Mika Westerberg, Linus Walleij, Bartosz Golaszewski, linux-gpio,
	linux-acpi, linux-kernel

[Public]

> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Sent: Friday, August 26, 2022 12:32
> To: Hans de Goede <hdegoede@redhat.com>
> Cc: Limonciello, Mario <Mario.Limonciello@amd.com>; Mika Westerberg
> <mika.westerberg@linux.intel.com>; Linus Walleij <linus.walleij@linaro.org>;
> Bartosz Golaszewski <brgl@bgdev.pl>; linux-gpio@vger.kernel.org; linux-
> acpi@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming
> an interrupt
> 
> On Wed, Aug 03, 2022 at 05:07:15PM +0200, Hans de Goede wrote:
> > On 8/3/22 06:24, Mario Limonciello wrote:
> > > gpiolib-acpi already had support for ignoring a pin for wakeup, but
> > > if an OEM configures a floating pin as an interrupt source then
> > > stopping it from being a wakeup won't do much good to stop the
> > > interrupt storm.
> > >
> > > Add support for a module parameter and quirk infrastructure to
> > > ignore interrupts as well.
> > >
> > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> >
> > Thanks, patch looks good to me:
> >
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> Pushed to my review and testing queue, thanks!
> 
> --
> With Best Regards,
> Andy Shevchenko
> 

Andy,

Just to double check, you meant you took both patches, not just the first right?

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

* Re: [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt
  2022-08-29 18:16     ` Limonciello, Mario
@ 2022-08-29 19:26       ` Andy Shevchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2022-08-29 19:26 UTC (permalink / raw)
  To: Limonciello, Mario
  Cc: Hans de Goede, Mika Westerberg, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-acpi, linux-kernel

On Mon, Aug 29, 2022 at 06:16:45PM +0000, Limonciello, Mario wrote:
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Sent: Friday, August 26, 2022 12:32
> > On Wed, Aug 03, 2022 at 05:07:15PM +0200, Hans de Goede wrote:
> > > On 8/3/22 06:24, Mario Limonciello wrote:

...

> > > Thanks, patch looks good to me:
> > >
> > > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> > 
> > Pushed to my review and testing queue, thanks!

> Just to double check, you meant you took both patches, not just the first right?

Yes, I took 2 patches. To reduce a confusion I highly recommend to send a
series with a cover letter, so the answer to it will definitely be equal to
"yes, I have took all of them" if nothing else specified.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2022-08-29 19:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  4:24 [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt Mario Limonciello
2022-08-03  4:25 ` [PATCH v2 2/2] gpiolib: acpi: Add a quirk for Asus UM325UAZ Mario Limonciello
2022-08-03  9:50   ` Mika Westerberg
2022-08-03  9:47 ` [PATCH v2 1/2] gpiolib: acpi: Add support to ignore programming an interrupt Mika Westerberg
2022-08-03 15:07 ` Hans de Goede
2022-08-26 17:31   ` Andy Shevchenko
2022-08-29 18:16     ` Limonciello, Mario
2022-08-29 19:26       ` 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.