Skip to contentSkip to conversation

Skip deferred request irqs for devices known to fail

PATCH Superseded Ian W MORRISON 3 participants 6 messages Mar 22, 2019 – Aug 19, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Skip deferred request irqs for devices known to fail

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.

---
 drivers/gpio/gpiolib-acpi.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)
drivers/gpio/gpiolib-acpi.c +23 -5
index 259cf6ab969b..8d855dc9b020 100644
@@ -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;
 }
Signature · 1 line
2.17.1
#1 lore raw

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

Thanks for the patch, my comments below.

Quoted 6 lines

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?

Quoted 4 lines

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

This should be in order.

Quoted 2 lines

/* 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.
*/

drivers/gpio/gpiolib-acpi.c bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) · line 1241

Quoted 2 lines
drivers/gpio/gpiolib-acpi.c +2 -0
+	dmi_id = dmi_first_match(skip_deferred_request_irqs_table);
+

Redundant blank line.

drivers/gpio/gpiolib-acpi.c bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) · line 1242

Quoted 1 line
drivers/gpio/gpiolib-acpi.c +1 -0
+	if (! dmi_id) {

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

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Ian W MORRISON

Hi,

Quoted 9 lines · 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.

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

Quoted 61 lines
---
  drivers/gpio/gpiolib-acpi.c | 28 +++++++++++++++++++++++-----
  1 file changed, 23 insertions(+), 5 deletions(-)
drivers/gpio/gpiolib-acpi.c +23 -5
index 259cf6ab969b..8d855dc9b020 100644
@@ -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;
  }
#3 lore raw

Hi Hans,

Quoted 5 lines

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

#4 lore raw

Hi Ian, et. al.,

Quoted 9 lines · Ian W MORRISON

Hi Hans,

Quoted 5 lines

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:

Quoted 4 lines

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

This should be in order.

Quoted 2 lines

/* 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.
*/

drivers/gpio/gpiolib-acpi.c bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) · line 1241

Quoted 2 lines
drivers/gpio/gpiolib-acpi.c +2 -0
+	dmi_id = dmi_first_match(skip_deferred_request_irqs_table);
+

Redundant blank line.

drivers/gpio/gpiolib-acpi.c bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) · line 1242

Quoted 1 line
drivers/gpio/gpiolib-acpi.c +1 -0
+	if (! dmi_id) {

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

#5 lore raw

Hi Hans and everyone,

Quoted 9 lines · Hans de Goede

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.

Quoted 9 lines

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