rpms/kernel/F-11 linux-2.6.git-f5347867c5aea94c625246eaff8f7820b0a4cd8a.patch, NONE, 1.1 linux-2.6.git-f6bb13aa1ea3bb26a4c783822347873f085b9000.patch, NONE, 1.1 linux-acpi-2.6.git-dadf28a10c3eb29421837a2e413ab869ebd9e168.patch, NONE, 1.1 kernel.spec, 1.1829, 1.1830

Chuck Ebbert cebbert at fedoraproject.org
Thu Mar 25 14:45:39 UTC 2010


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv15403

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6.git-f5347867c5aea94c625246eaff8f7820b0a4cd8a.patch 
	linux-2.6.git-f6bb13aa1ea3bb26a4c783822347873f085b9000.patch 
	linux-acpi-2.6.git-dadf28a10c3eb29421837a2e413ab869ebd9e168.patch 
Log Message:
ACPI EC fixes from upstream:
   Fix SBS battery status query deadlocks
   Fix hibernation problems
   Re-enable EC burst mode for multibyte access
Tweak buildid generation to allow both command-line and SRPM
  to control the ID.

linux-2.6.git-f5347867c5aea94c625246eaff8f7820b0a4cd8a.patch:
 ec.c    |    3 ++-
 sbshc.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

--- NEW FILE linux-2.6.git-f5347867c5aea94c625246eaff8f7820b0a4cd8a.patch ---
From: Alexey Starikovskiy <astarikovskiy at suse.de>
Date: Wed, 30 Dec 2009 12:53:03 +0000 (+0300)
Subject: ACPI: SBS: Move SBS HC callback to faster Notify queue
X-Git-Tag: v2.6.33-rc5~9^2~4^2~1
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f5347867c5aea94c625246eaff8f7820b0a4cd8a

ACPI: SBS: Move SBS HC callback to faster Notify queue

SBS transactions should happen in Notify work queue, to not create
a dead lock with GPE execution accessing SBS devices.

Signed-off-by: Alexey Starikovskiy <astarikovskiy at suse.de>
Signed-off-by: Len Brown <len.brown at intel.com>
---

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 9cc3885..0473309 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -535,7 +535,8 @@ static int acpi_ec_sync_query(struct acpi_ec *ec)
 				return -ENOMEM;
 			memcpy(copy, handler, sizeof(*copy));
 			pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value);
-			return acpi_os_execute(OSL_GPE_HANDLER,
+			return acpi_os_execute((copy->func) ?
+				OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
 				acpi_ec_run, copy);
 		}
 	}
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index d933980..fd09229 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -242,7 +242,7 @@ static int smbus_alarm(void *context)
 		case ACPI_SBS_CHARGER:
 		case ACPI_SBS_MANAGER:
 		case ACPI_SBS_BATTERY:
-			acpi_os_execute(OSL_GPE_HANDLER,
+			acpi_os_execute(OSL_NOTIFY_HANDLER,
 					acpi_smbus_callback, hc);
 		default:;
 	}

linux-2.6.git-f6bb13aa1ea3bb26a4c783822347873f085b9000.patch:
 ec.c       |   33 ++++++++++++++++++++++++++++++++-
 internal.h |    2 ++
 sleep.c    |   19 ++++++++++++++-----
 3 files changed, 48 insertions(+), 6 deletions(-)

--- NEW FILE linux-2.6.git-f6bb13aa1ea3bb26a4c783822347873f085b9000.patch ---
From: Rafael J. Wysocki <rjw at sisk.pl>
Date: Thu, 4 Mar 2010 00:52:58 +0000 (+0100)
Subject: ACPI / EC / PM: Close race between EC and resume from hibernation
X-Git-Tag: v2.6.34-rc2~37^2^3
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f6bb13aa1ea3bb26a4c783822347873f085b9000

ACPI / EC / PM: Close race between EC and resume from hibernation

There is a race between resume from hibernation and the EC driver
that may result in restoring the hibernation image in the middle of
an EC transaction in progress, which in turn may lead to
unpredictable behavior of the platform.

To remove that race condition, add a helpers for suspending and
resuming EC transactions in a safe way to be executed by the ACPI
platform hibernate pre-restore and restore cleanup callbacks.

http://bugzilla.kernel.org/show_bug.cgi?id=14668

Signed-off-by: Rafael J. Wysocki <rjw at sisk.pl>
Reported-and-tested-by: Maxim Levitsky <maximlevitsky at gmail.com>
Signed-off-by: Len Brown <len.brown at intel.com>
---

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d6471bb..19f93e1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -76,8 +76,9 @@ enum ec_command {
 enum {
 	EC_FLAGS_QUERY_PENDING,		/* Query is pending */
 	EC_FLAGS_GPE_STORM,		/* GPE storm detected */
-	EC_FLAGS_HANDLERS_INSTALLED	/* Handlers for GPE and
+	EC_FLAGS_HANDLERS_INSTALLED,	/* Handlers for GPE and
 					 * OpReg are installed */
+	EC_FLAGS_FROZEN,		/* Transactions are suspended */
 };
 
 /* If we find an EC via the ECDT, we need to keep a ptr to its context */
@@ -291,6 +292,10 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
 	if (t->rdata)
 		memset(t->rdata, 0, t->rlen);
 	mutex_lock(&ec->lock);
+	if (test_bit(EC_FLAGS_FROZEN, &ec->flags)) {
+		status = -EINVAL;
+		goto unlock;
+	}
 	if (ec->global_lock) {
 		status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
 		if (ACPI_FAILURE(status)) {
@@ -445,6 +450,32 @@ int ec_transaction(u8 command,
 
 EXPORT_SYMBOL(ec_transaction);
 
+void acpi_ec_suspend_transactions(void)
+{
+	struct acpi_ec *ec = first_ec;
+
+	if (!ec)
+		return;
+
+	mutex_lock(&ec->lock);
+	/* Prevent transactions from being carried out */
+	set_bit(EC_FLAGS_FROZEN, &ec->flags);
+	mutex_unlock(&ec->lock);
+}
+
+void acpi_ec_resume_transactions(void)
+{
+	struct acpi_ec *ec = first_ec;
+
+	if (!ec)
+		return;
+
+	mutex_lock(&ec->lock);
+	/* Allow transactions to be carried out again */
+	clear_bit(EC_FLAGS_FROZEN, &ec->flags);
+	mutex_unlock(&ec->lock);
+}
+
 static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data)
 {
 	int result;
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index cb28e05..7874246 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -51,6 +51,8 @@ void acpi_early_processor_set_pdc(void);
 int acpi_ec_init(void);
 int acpi_ec_ecdt_probe(void);
 int acpi_boot_ec_enable(void);
+void acpi_ec_suspend_transactions(void);
+void acpi_ec_resume_transactions(void);
 
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 79d33d9..f01f8e8 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -552,8 +552,17 @@ static void acpi_hibernation_leave(void)
 	hibernate_nvs_restore();
 }
 
-static void acpi_pm_enable_gpes(void)
+static int acpi_pm_pre_restore(void)
 {
+	acpi_disable_all_gpes();
+	acpi_os_wait_events_complete(NULL);
+	acpi_ec_suspend_transactions();
+	return 0;
+}
+
+static void acpi_pm_restore_cleanup(void)
+{
+	acpi_ec_resume_transactions();
 	acpi_enable_all_runtime_gpes();
 }
 
@@ -565,8 +574,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops = {
 	.prepare = acpi_pm_prepare,
 	.enter = acpi_hibernation_enter,
 	.leave = acpi_hibernation_leave,
-	.pre_restore = acpi_pm_disable_gpes,
-	.restore_cleanup = acpi_pm_enable_gpes,
+	.pre_restore = acpi_pm_pre_restore,
+	.restore_cleanup = acpi_pm_restore_cleanup,
 };
 
 /**
@@ -618,8 +627,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = {
 	.prepare = acpi_pm_disable_gpes,
 	.enter = acpi_hibernation_enter,
 	.leave = acpi_hibernation_leave,
-	.pre_restore = acpi_pm_disable_gpes,
-	.restore_cleanup = acpi_pm_enable_gpes,
+	.pre_restore = acpi_pm_pre_restore,
+	.restore_cleanup = acpi_pm_restore_cleanup,
 	.recover = acpi_pm_finish,
 };
 #endif /* CONFIG_HIBERNATION */

linux-acpi-2.6.git-dadf28a10c3eb29421837a2e413ab869ebd9e168.patch:
 acpica/exprep.c |   12 ++++++++++++
 ec.c            |   35 +++++++++--------------------------
 2 files changed, 21 insertions(+), 26 deletions(-)

--- NEW FILE linux-acpi-2.6.git-dadf28a10c3eb29421837a2e413ab869ebd9e168.patch ---
From: Alexey Starikovskiy <astarikovskiy at suse.de>
Date: Wed, 17 Mar 2010 17:14:13 +0000 (-0400)
Subject: ACPI: EC: Allow multibyte access to EC
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Flenb%2Flinux-acpi-2.6.git;a=commitdiff_plain;h=dadf28a10c3eb29421837a2e413ab869ebd9e168

ACPI: EC: Allow multibyte access to EC

http://bugzilla.kernel.org/show_bug.cgi?id=14667

[ backport to 2.6.3[23] ]

Signed-off-by: Alexey Starikovskiy <astarikovskiy at suse.de>
Signed-off-by: Len Brown <len.brown at intel.com>
---

diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index edf62bf..a610ebe 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -468,6 +468,18 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 
 		acpi_ut_add_reference(obj_desc->field.region_obj);
 
+		/* allow full data read from EC address space */
+		if (obj_desc->field.region_obj->region.space_id ==
+			ACPI_ADR_SPACE_EC) {
+			if (obj_desc->common_field.bit_length > 8)
+				obj_desc->common_field.access_bit_width =
+				ACPI_ROUND_UP(obj_desc->common_field.
+							bit_length, 8);
+				obj_desc->common_field.access_byte_width =
+				ACPI_DIV_8(obj_desc->common_field.
+							access_bit_width);
+		}
+
 		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
 				  "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
 				  obj_desc->field.start_field_bit_offset,
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1ac28c6..7208a69 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -628,12 +628,12 @@ static u32 acpi_ec_gpe_handler(void *data)
 
 static acpi_status
 acpi_ec_space_handler(u32 function, acpi_physical_address address,
-		      u32 bits, acpi_integer *value,
+		      u32 bits, acpi_integer *value64,
 		      void *handler_context, void *region_context)
 {
 	struct acpi_ec *ec = handler_context;
-	int result = 0, i;
-	u8 temp = 0;
+	int result = 0, i, bytes = bits / 8;
+	u8 *value = (u8 *)value64;
 
 	if ((address > 0xFF) || !value || !handler_context)
 		return AE_BAD_PARAMETER;
@@ -641,32 +641,15 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
 	if (function != ACPI_READ && function != ACPI_WRITE)
 		return AE_BAD_PARAMETER;
 
-	if (bits != 8 && acpi_strict)
-		return AE_BAD_PARAMETER;
-
-	if (EC_FLAGS_MSI)
+	if (EC_FLAGS_MSI || bits > 8)
 		acpi_ec_burst_enable(ec);
 
-	if (function == ACPI_READ) {
-		result = acpi_ec_read(ec, address, &temp);
-		*value = temp;
-	} else {
-		temp = 0xff & (*value);
-		result = acpi_ec_write(ec, address, temp);
-	}
-
-	for (i = 8; unlikely(bits - i > 0); i += 8) {
-		++address;
-		if (function == ACPI_READ) {
-			result = acpi_ec_read(ec, address, &temp);
-			(*value) |= ((acpi_integer)temp) << i;
-		} else {
-			temp = 0xff & ((*value) >> i);
-			result = acpi_ec_write(ec, address, temp);
-		}
-	}
+	for (i = 0; i < bytes; ++i, ++address, ++value)
+		result = (function == ACPI_READ) ?
+			acpi_ec_read(ec, address, value) :
+			acpi_ec_write(ec, address, *value);
 
-	if (EC_FLAGS_MSI)
+	if (EC_FLAGS_MSI || bits > 8)
 		acpi_ec_burst_disable(ec);
 
 	switch (result) {


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1829
retrieving revision 1.1830
diff -u -p -r1.1829 -r1.1830
--- kernel.spec	17 Mar 2010 02:36:50 -0000	1.1829
+++ kernel.spec	25 Mar 2010 14:45:38 -0000	1.1830
@@ -11,11 +11,25 @@ Summary: The Linux kernel
 # Versions of various parts
 
 # Polite request for people who spin their own kernel rpms:
-# please modify the "buildid" define in a way that identifies
+# please modify the "srpm_buildid" define in a way that identifies
 # that the kernel isn't the stock distribution kernel, for example,
 # by setting the define to ".local" or ".bz123456"
 #
-# % define buildid .local
+# % define srpm_buildid .local
+
+# You can also specify buildid on the rpmbuild command line
+# by adding --define="buildid .local". If both kinds of buildid
+# are specified they will be concatenated together.
+
+%if 0%{?srpm_buildid:1}
+%if 0%{?buildid:1}
+# append buildid passed on command line to the one in the SRPM
+%global parm_buildid %{buildid}
+%define buildid %{srpm_buildid}%{parm_buildid}
+%else
+%define buildid %{srpm_buildid}
+%endif
+%endif
 
 # fedora_build defines which build revision of this kernel version we're
 # building. Rather than incrementing forever, as with the prior versioning
@@ -760,6 +774,11 @@ Patch14456: tg3-06-fix-5906-transmit-han
 
 Patch20031: vgaarb-fix-userspace-ptr-deref.patch
 
+# ACPI EC fixes
+Patch20043: linux-2.6.git-f5347867c5aea94c625246eaff8f7820b0a4cd8a.patch
+Patch20044: linux-2.6.git-f6bb13aa1ea3bb26a4c783822347873f085b9000.patch
+Patch20045: linux-acpi-2.6.git-dadf28a10c3eb29421837a2e413ab869ebd9e168.patch
+
 #===============================================================================
 %endif
 
@@ -1248,6 +1267,13 @@ ApplyPatch wmi-survive-bios-with-duplica
 # ACPI
 ApplyPatch linux-2.6-defaults-acpi-video.patch
 ApplyPatch linux-2.6-acpi-video-dos.patch
+# ACPI EC fixes
+# fix sbs query deadlocks
+ApplyPatch linux-2.6.git-f5347867c5aea94c625246eaff8f7820b0a4cd8a.patch
+# fix hibernation races
+ApplyPatch linux-2.6.git-f6bb13aa1ea3bb26a4c783822347873f085b9000.patch
+# fix burst mode bugs, caused by commit 6a63b06f3c494cc87eade97f081300bda60acec7
+ApplyPatch linux-acpi-2.6.git-dadf28a10c3eb29421837a2e413ab869ebd9e168.patch
 
 # Various low-impact patches to aid debugging.
 ApplyPatch linux-2.6-debug-sizeof-structs.patch
@@ -2048,6 +2074,14 @@ fi
 # and build.
 
 %changelog
+* Tue Mar 25 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.10-45
+- ACPI EC fixes from upstream:
+   Fix SBS battery status query deadlocks
+   Fix hibernation problems
+   Re-enable EC burst mode for multibyte access
+- Tweak buildid generation to allow both command-line and SRPM
+  to control the ID.
+
 * Tue Mar 16 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.10-44
 - Linux 2.6.32.10
 - iwlwifi-silence-tfds-in-queue-message.patch:



More information about the scm-commits mailing list