Skip to contentSkip to conversation

Stable inclusion request - ACPI GPE regression fixes

PATCH Rafael J. Wysocki 2 participants 3 messages Jun 29, 2010 – Jul 29, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Greg,

Please include the following commits

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e4e9a735991c80fb0fc1bd4a13a93681c3c17ce0
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fd247447c1d94a79d5cfc647430784306b3a8323
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9a8bbb7704cbf515c0fc68970abbe4e91d68521
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ce43ace02320a3fb9614ddb27edc3a8700d68b26
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9d3c752de65dbfa6e522f1d666deb0ac152ef367

(in this order) into the next 2.6.34.y release. They are not necessary for older -stable kernels.

The first one should apply to 2.6.34. The second one (fd247447c1d94a79d5cfc647430784306b3a8323) unfortunately doesn't, so attached is a backport of it to the 2.6.34 code base. The remaining 3 patches should apply on top of it.

Thanks,
Rafael

From fd247447c1d94a79d5cfc647430784306b3a8323 Mon Sep 17 00:00:00 2001
From: Rafael J. Wysocki <[email protected]>
Date: Tue, 8 Jun 2010 10:49:08 +0200
Subject: [PATCH] ACPI / ACPICA: Fix low-level GPE manipulation code

ACPICA uses acpi_ev_enable_gpe() for enabling GPEs at the low level, which is incorrect, because this function only enables the GPE if the corresponding bit in its enable register's enable_for_run mask is set. This causes acpi_set_gpe() to work incorrectly if used for enabling GPEs that were not previously enabled with acpi_enable_gpe(). As a result, among other things, wakeup-only GPEs are never enabled by acpi_enable_wakeup_device(), so the devices that use them are unable to wake up the system.

To fix this issue remove acpi_ev_enable_gpe() and its counterpart acpi_ev_disable_gpe() and replace acpi_hw_low_disable_gpe() with acpi_hw_low_set_gpe() that will be used instead to manipulate GPE enable bits at the low level. Make the users of acpi_ev_enable_gpe() and acpi_ev_disable_gpe() call acpi_hw_low_set_gpe() instead and make sure that GPE enable masks are only updated by acpi_enable_gpe() and acpi_disable_gpe() when GPE reference counters change from 0 to 1 and from 1 to 0, respectively.

---
 drivers/acpi/acpica/acevents.h |    4 --
 drivers/acpi/acpica/achware.h  |    3 +
 drivers/acpi/acpica/evgpe.c    |   78 +----------------------------------------
 drivers/acpi/acpica/evxfevnt.c |   66 ++++++++++++++++++++++++++++++----
 drivers/acpi/acpica/hwgpe.c    |   26 +++++++++++--
 include/acpi/acexcep.h         |    2 -
 6 files changed, 84 insertions(+), 95 deletions(-)
drivers/acpi/acpica/acevents.h +0 -4
Index: linux-2.6-stable/drivers/acpi/acpica/acevents.h
===================================================================
@@ -78,10 +78,6 @@ acpi_ev_queue_notify_request(struct acpi
 acpi_status
 acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info);
 
-acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
-
-acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
-
 struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
 						       u32 gpe_number);
 
drivers/acpi/acpica/achware.h +2 -1
Index: linux-2.6-stable/drivers/acpi/acpica/achware.h
===================================================================
@@ -93,7 +93,8 @@ acpi_status acpi_hw_write_port(acpi_io_a
 u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info,
 			     struct acpi_gpe_register_info *gpe_register_info);
 
-acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
+acpi_status
+acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action);
 
 acpi_status
 acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
drivers/acpi/acpica/evgpe.c +2 -76

102 lines not on this page · raw message

drivers/acpi/acpica/evxfevnt.c +58 -8

106 lines not on this page · raw message

drivers/acpi/acpica/hwgpe.c +21 -5
Index: linux-2.6-stable/drivers/acpi/acpica/hwgpe.c
===================================================================
@@ -78,23 +78,27 @@ u32 acpi_hw_gpe_register_bit(struct acpi
 
 /******************************************************************************
  *
- * FUNCTION:	acpi_hw_low_disable_gpe
+ * FUNCTION:	acpi_hw_low_set_gpe
  *
  * PARAMETERS:	gpe_event_info	    - Info block for the GPE to be disabled
+ *		action		    - Enable or disable
  *
  * RETURN:	Status
  *
- * DESCRIPTION: Disable a single GPE in the enable register.
+ * DESCRIPTION: Enable or disable a single GPE in its enable register.
  *
  ******************************************************************************/
 
-acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
+acpi_status
+acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action)
 {
 	struct acpi_gpe_register_info *gpe_register_info;
 	acpi_status status;
 	u32 enable_mask;
 	u32 register_bit;
 
+	ACPI_FUNCTION_ENTRY();
+
 	/* Get the info block for the entire GPE register */
 
 	gpe_register_info = gpe_event_info->register_info;
@@ -109,11 +113,23 @@ acpi_status acpi_hw_low_disable_gpe(stru
 		return (status);
 	}
 
-	/* Clear just the bit that corresponds to this GPE */
+	/* Set or clear just the bit that corresponds to this GPE */
 
 	register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
 						gpe_register_info);
-	ACPI_CLEAR_BIT(enable_mask, register_bit);
+	switch (action) {
+	case ACPI_GPE_ENABLE:
+		ACPI_SET_BIT(enable_mask, register_bit);
+		break;
+
+	case ACPI_GPE_DISABLE:
+		ACPI_CLEAR_BIT(enable_mask, register_bit);
+		break;
+
+	default:
+		ACPI_ERROR((AE_INFO, "Invalid action\n"));
+		return (AE_BAD_PARAMETER);
+	}
 
 	/* Write the updated enable mask */
 
include/acpi/acexcep.h +1 -1
Index: linux-2.6-stable/include/acpi/acexcep.h
===================================================================
@@ -87,7 +87,7 @@
 #define AE_NO_GLOBAL_LOCK               (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
 #define AE_ABORT_METHOD                 (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
 #define AE_SAME_HANDLER                 (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
-#define AE_WAKE_ONLY_GPE                (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_HANDLER                   (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
 #define AE_OWNER_ID_LIMIT               (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
 
 #define AE_CODE_ENV_MAX                 0x001B
#1 lore raw
Quoted 10 lines · Rafael J. Wysocki

Hi Greg,

Please include the following commits

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e4e9a735991c80fb0fc1bd4a13a93681c3c17ce0
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fd247447c1d94a79d5cfc647430784306b3a8323
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9a8bbb7704cbf515c0fc68970abbe4e91d68521
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ce43ace02320a3fb9614ddb27edc3a8700d68b26
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9d3c752de65dbfa6e522f1d666deb0ac152ef367

Quoted 7 lines

(in this order) into the next 2.6.34.y release. They are not necessary for older -stable kernels.

The first one should apply to 2.6.34. The second one (fd247447c1d94a79d5cfc647430784306b3a8323) unfortunately doesn't, so attached is a backport of it to the 2.6.34 code base. The remaining 3 patches should apply on top of it.

Now all queued up.

thanks,

greg k-h

#2 lore raw
Quoted 14 lines · Greg KH
Quoted 13 lines · Rafael J. Wysocki

Hi Greg,

Please include the following commits

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e4e9a735991c80fb0fc1bd4a13a93681c3c17ce0
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fd247447c1d94a79d5cfc647430784306b3a8323
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9a8bbb7704cbf515c0fc68970abbe4e91d68521
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ce43ace02320a3fb9614ddb27edc3a8700d68b26
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9d3c752de65dbfa6e522f1d666deb0ac152ef367

(in this order) into the next 2.6.34.y release. They are not necessary for older -stable kernels.

Quoted 6 lines
Quoted 4 lines

The first one should apply to 2.6.34. The second one (fd247447c1d94a79d5cfc647430784306b3a8323) unfortunately doesn't, so attached is a backport of it to the 2.6.34 code base. The remaining 3 patches should apply on top of it.

Now all queued up.

Thanks!

Rafael