Linux-ACPI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Skip deferred request irqs for devices known to fail
@ 2019-03-22 11:05 Ian W MORRISON
  2019-03-22 11:42 ` Andy Shevchenko
  2019-03-22 14:45 ` Hans de Goede
  0 siblings, 2 replies; 6+ messages in thread
From: Ian W MORRISON @ 2019-03-22 11:05 UTC (permalink / raw)
  To: benjamin.tissoires, hdegoede, mika.westerberg, andriy.shevchenko,
	linus.walleij, bgolaszewski
  Cc: linux-gpio, linux-acpi, linux-kernel, stable, Ian W MORRISON

Patch ca876c7483b6 "gpiolib-acpi: make sure we trigger edge events at
least once on boot" causes the MINIX family of mini PCs to fail to boot
resulting in a "black screen". 

This patch excludes MINIX devices from executing this trigger in order
to successfully boot.

Cc: stable@vger.kernel.org
Signed-off-by: Ian W MORRISON <ianwmorrison@gmail.com>
---
 drivers/gpio/gpiolib-acpi.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 259cf6ab969b..8d855dc9b020 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -16,9 +16,21 @@
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
 #include <linux/pinctrl/pinctrl.h>
+#include <linux/dmi.h>
 
 #include "gpiolib.h"
 
+static const struct dmi_system_id skip_deferred_request_irqs_table[] = {
+	{
+		.ident = "MINIX Z83-4",
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MINIX"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
+		},
+	},
+	{}
+};
+
 /**
  * struct acpi_gpio_event - ACPI GPIO event handler data
  *
@@ -1219,18 +1231,24 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id)
 }
 
 /* Run deferred acpi_gpiochip_request_irqs() */
+/* but exclude devices known to fail */
 static int acpi_gpio_handle_deferred_request_irqs(void)
 {
 	struct acpi_gpio_chip *acpi_gpio, *tmp;
+	const struct dmi_system_id *dmi_id;
 
-	mutex_lock(&acpi_gpio_deferred_req_irqs_lock);
-	list_for_each_entry_safe(acpi_gpio, tmp,
+	dmi_id = dmi_first_match(skip_deferred_request_irqs_table);
+
+	if (! dmi_id) {
+		mutex_lock(&acpi_gpio_deferred_req_irqs_lock);
+		list_for_each_entry_safe(acpi_gpio, tmp,
 				 &acpi_gpio_deferred_req_irqs_list,
 				 deferred_req_irqs_list_entry)
-		acpi_gpiochip_request_irqs(acpi_gpio);
+			acpi_gpiochip_request_irqs(acpi_gpio);
 
-	acpi_gpio_deferred_req_irqs_done = true;
-	mutex_unlock(&acpi_gpio_deferred_req_irqs_lock);
+		acpi_gpio_deferred_req_irqs_done = true;
+		mutex_unlock(&acpi_gpio_deferred_req_irqs_lock);
+	}
 
 	return 0;
 }
-- 
2.17.1

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

* Re: [PATCH] Skip deferred request irqs for devices known to fail
  2019-03-22 11:05 [PATCH] Skip deferred request irqs for devices known to fail Ian W MORRISON
@ 2019-03-22 11:42 ` Andy Shevchenko
  2019-03-22 14:45 ` Hans de Goede
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-03-22 11:42 UTC (permalink / raw)
  To: Ian W MORRISON
  Cc: benjamin.tissoires, hdegoede, mika.westerberg, linus.walleij,
	bgolaszewski, linux-gpio, linux-acpi, linux-kernel, stable

On Fri, Mar 22, 2019 at 10:05:15PM +1100, Ian W MORRISON wrote:

Thanks for the patch, my comments below.

> Patch ca876c7483b6 "gpiolib-acpi: make sure we trigger edge events at
> least once on boot" causes the MINIX family of mini PCs to fail to boot
> resulting in a "black screen". 

> This patch excludes MINIX devices from executing this trigger in order
> to successfully boot.

Hmm... Feels like this is symptomatic healing.
Hans, do you have anything in mind about this case?

>  #include <linux/interrupt.h>
>  #include <linux/mutex.h>
>  #include <linux/pinctrl/pinctrl.h>
> +#include <linux/dmi.h>

This should be in order.

>  /* Run deferred acpi_gpiochip_request_irqs() */
> +/* but exclude devices known to fail */

/*
 * This should be done in the similar style
 * as for multi-line comments. Like this one.
 */

> +	dmi_id = dmi_first_match(skip_deferred_request_irqs_table);
> +

Redundant blank line.

> +	if (! dmi_id) {

No space here, however, better to write positive conditional.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] Skip deferred request irqs for devices known to fail
  2019-03-22 11:05 [PATCH] Skip deferred request irqs for devices known to fail Ian W MORRISON
  2019-03-22 11:42 ` Andy Shevchenko
@ 2019-03-22 14:45 ` Hans de Goede
  2019-03-23  3:39   ` Ian W MORRISON
  1 sibling, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2019-03-22 14:45 UTC (permalink / raw)
  To: Ian W MORRISON, benjamin.tissoires, mika.westerberg,
	andriy.shevchenko, linus.walleij, bgolaszewski
  Cc: linux-gpio, linux-acpi, linux-kernel, stable

Hi,

On 3/22/19 12:05 PM, Ian W MORRISON wrote:
> Patch ca876c7483b6 "gpiolib-acpi: make sure we trigger edge events at
> least once on boot" causes the MINIX family of mini PCs to fail to boot
> resulting in a "black screen".
> 
> This patch excludes MINIX devices from executing this trigger in order
> to successfully boot.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Ian W MORRISON <ianwmorrison@gmail.com>

IMHO we need to root-cause this problem a bit more before applying this
kludge.

Can you provide an ACPI dump of one of the affected machines ?

Regards,

Hans



> ---
>   drivers/gpio/gpiolib-acpi.c | 28 +++++++++++++++++++++++-----
>   1 file changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index 259cf6ab969b..8d855dc9b020 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -16,9 +16,21 @@
>   #include <linux/interrupt.h>
>   #include <linux/mutex.h>
>   #include <linux/pinctrl/pinctrl.h>
> +#include <linux/dmi.h>
>   
>   #include "gpiolib.h"
>   
> +static const struct dmi_system_id skip_deferred_request_irqs_table[] = {
> +	{
> +		.ident = "MINIX Z83-4",
> +		.matches = {
> +			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MINIX"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
> +		},
> +	},
> +	{}
> +};
> +
>   /**
>    * struct acpi_gpio_event - ACPI GPIO event handler data
>    *
> @@ -1219,18 +1231,24 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id)
>   }
>   
>   /* Run deferred acpi_gpiochip_request_irqs() */
> +/* but exclude devices known to fail */
>   static int acpi_gpio_handle_deferred_request_irqs(void)
>   {
>   	struct acpi_gpio_chip *acpi_gpio, *tmp;
> +	const struct dmi_system_id *dmi_id;
>   
> -	mutex_lock(&acpi_gpio_deferred_req_irqs_lock);
> -	list_for_each_entry_safe(acpi_gpio, tmp,
> +	dmi_id = dmi_first_match(skip_deferred_request_irqs_table);
> +
> +	if (! dmi_id) {
> +		mutex_lock(&acpi_gpio_deferred_req_irqs_lock);
> +		list_for_each_entry_safe(acpi_gpio, tmp,
>   				 &acpi_gpio_deferred_req_irqs_list,
>   				 deferred_req_irqs_list_entry)
> -		acpi_gpiochip_request_irqs(acpi_gpio);
> +			acpi_gpiochip_request_irqs(acpi_gpio);
>   
> -	acpi_gpio_deferred_req_irqs_done = true;
> -	mutex_unlock(&acpi_gpio_deferred_req_irqs_lock);
> +		acpi_gpio_deferred_req_irqs_done = true;
> +		mutex_unlock(&acpi_gpio_deferred_req_irqs_lock);
> +	}
>   
>   	return 0;
>   }
> 

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

* Re: [PATCH] Skip deferred request irqs for devices known to fail
  2019-03-22 14:45 ` Hans de Goede
@ 2019-03-23  3:39   ` Ian W MORRISON
  2019-08-18 18:59     ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Ian W MORRISON @ 2019-03-23  3:39 UTC (permalink / raw)
  To: Hans de Goede
  Cc: benjamin.tissoires, mika.westerberg, Andy Shevchenko,
	linus.walleij, bgolaszewski, linux-gpio, linux-acpi,
	linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

Hi Hans,

> IMHO we need to root-cause this problem a bit more before applying this
> kludge.
>
> Can you provide an ACPI dump of one of the affected machines ?
>

Attached is an ACPI dump.

Regards,
Ian

[-- Attachment #2: ACPI.dat --]
[-- Type: application/octet-stream, Size: 712044 bytes --]

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

* Re: [PATCH] Skip deferred request irqs for devices known to fail
  2019-03-23  3:39   ` Ian W MORRISON
@ 2019-08-18 18:59     ` Hans de Goede
  2019-08-19 11:35       ` Ian W MORRISON
  0 siblings, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2019-08-18 18:59 UTC (permalink / raw)
  To: Ian W MORRISON
  Cc: benjamin.tissoires, mika.westerberg, Andy Shevchenko,
	linus.walleij, bgolaszewski, linux-gpio, linux-acpi,
	linux-kernel, stable

Hi Ian, et. al.,

On 23-03-19 04:39, Ian W MORRISON wrote:
> Hi Hans,
> 
>> IMHO we need to root-cause this problem a bit more before applying this
>> kludge.
>>
>> Can you provide an ACPI dump of one of the affected machines ?
>>
> 
> Attached is an ACPI dump.

First of all sorry for taking way too long to get back to you on this.

So I've taken a look at all the _AEI code in the DSDT, a whole bunch of
it seems copy and pasted from various tablets, but nothing really
stands out as being a likely cause of this.

As such I guess we may need to go with the blacklist patch you suggested
which sucks, but having these devices not boot sucks even harder.

I guess this problem did not magically fix it self in the mean time
(with newer kernels) ?

Can you resubmit your patch with Andy's review remarks addressed?

In case you've lost Andy's reply I will reproduce the review remarks
below.

Regards,

Hans

p.s.

Andy's review remarks as promised:

 >  #include <linux/interrupt.h>
 >  #include <linux/mutex.h>
 >  #include <linux/pinctrl/pinctrl.h>
 > +#include <linux/dmi.h>

This should be in order.

 >  /* Run deferred acpi_gpiochip_request_irqs() */
 > +/* but exclude devices known to fail */

/*
  * This should be done in the similar style
  * as for multi-line comments. Like this one.
  */

 > +	dmi_id = dmi_first_match(skip_deferred_request_irqs_table);
 > +

Redundant blank line.

 > +	if (! dmi_id) {

No space here, however, better to write positive conditional.


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

* Re: [PATCH] Skip deferred request irqs for devices known to fail
  2019-08-18 18:59     ` Hans de Goede
@ 2019-08-19 11:35       ` Ian W MORRISON
  0 siblings, 0 replies; 6+ messages in thread
From: Ian W MORRISON @ 2019-08-19 11:35 UTC (permalink / raw)
  To: Hans de Goede
  Cc: benjamin.tissoires, mika.westerberg, Andy Shevchenko,
	Linus Walleij, bgolaszewski, linux-gpio, linux-acpi,
	linux-kernel, stable

Hi Hans and everyone,

On Mon, 19 Aug 2019 at 04:59, Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi Ian, et. al.,
>
> As such I guess we may need to go with the blacklist patch you suggested
> which sucks, but having these devices not boot sucks even harder.
>
> I guess this problem did not magically fix it self in the mean time
> (with newer kernels) ?
>

Unfortunately it didn't 'self-fix' with later kernels.

> Can you resubmit your patch with Andy's review remarks addressed?
>
> In case you've lost Andy's reply I will reproduce the review remarks
> below.
>
> Regards,
>
> Hans
>

Resubmitted as requested.

Many thanks and best regards,
Ian

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 11:05 [PATCH] Skip deferred request irqs for devices known to fail Ian W MORRISON
2019-03-22 11:42 ` Andy Shevchenko
2019-03-22 14:45 ` Hans de Goede
2019-03-23  3:39   ` Ian W MORRISON
2019-08-18 18:59     ` Hans de Goede
2019-08-19 11:35       ` Ian W MORRISON

Linux-ACPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-acpi/0 linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ https://lore.kernel.org/linux-acpi \
		linux-acpi@vger.kernel.org linux-acpi@archiver.kernel.org
	public-inbox-index linux-acpi


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-acpi


AGPL code for this site: git clone https://public-inbox.org/ public-inbox