Skip to contentSkip to conversation

ACPI: s2idle: Log when enabling wakeup IRQ fails

PATCH In review Simon Gaiser 2 participants 2 messages Mar 13, 2023 – Mar 20, 2023 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ACPI: s2idle: Log when enabling wakeup IRQ fails

enable_irq_wake() can fail. Previously acpi_s2idle_prepare() silently ignored it's return code. Based on [1] we should try to continue even in case of an error, so just log a warning for now.

Discovered when trying to go into s2idle under Xen. This leads to a system that can't be woken, since xen-pirq currently doesn't support setting wakeup IRQs [2]. With this you get at least some helpful log message if you have access to console messages.

---
v2:
- Based on feedback switched to only logging a warning instead of returning an error.

---
 drivers/acpi/sleep.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/acpi/sleep.c +7 -1
index 4ca667251272..6b30dea94fae 100644
@@ -714,7 +714,13 @@ int acpi_s2idle_begin(void)
 int acpi_s2idle_prepare(void)
 {
 	if (acpi_sci_irq_valid()) {
-		enable_irq_wake(acpi_sci_irq);
+		int error;
+
+		error = enable_irq_wake(acpi_sci_irq);
+		if (error)
+			pr_warn("Warning: Failed to enable wakeup from IRQ %d: %d\n",
+				acpi_sci_irq,
+				error);
 		acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
 	}
 
Signature · 1 line
2.39.2
#1 lore raw
Quoted 32 lines · Simon Gaiser

enable_irq_wake() can fail. Previously acpi_s2idle_prepare() silently ignored it's return code. Based on [1] we should try to continue even in case of an error, so just log a warning for now.

Discovered when trying to go into s2idle under Xen. This leads to a system that can't be woken, since xen-pirq currently doesn't support setting wakeup IRQs [2]. With this you get at least some helpful log message if you have access to console messages.

---
v2:
- Based on feedback switched to only logging a warning instead of returning an error.

---
 drivers/acpi/sleep.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/acpi/sleep.c +1 -1
index 4ca667251272..6b30dea94fae 100644
@@ -714,7 +714,13 @@ int acpi_s2idle_begin(void)
 int acpi_s2idle_prepare(void)
 {
        if (acpi_sci_irq_valid()) {
-               enable_irq_wake(acpi_sci_irq);
+               int error;

drivers/acpi/sleep.c int acpi_s2idle_begin(void)

Quoted 10 lines
drivers/acpi/sleep.c +6 -1
+
+               error = enable_irq_wake(acpi_sci_irq);
+               if (error)
+                       pr_warn("Warning: Failed to enable wakeup from IRQ %d: %d\n",
+                               acpi_sci_irq,
+                               error);
                acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
        }
 
--

Applied (with a minor white space adjustment) as 6.4 material, thanks!