All of lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org
Cc: Len Brown <len.brown@intel.com>
Subject: [PATCH 09/29] ACPI: Disable _GTS and _BFS support by default
Date: Thu, 23 Apr 2009 02:23:31 -0400	[thread overview]
Message-ID: <96f15efcea94545987715f453a8c2b8ea592d000.1240467664.git.len.brown@intel.com> (raw)
In-Reply-To: <1240467831-32613-1-git-send-email-lenb@kernel.org>
In-Reply-To: <50a4da890102a455e5cd3dd358c38650d07178d3.1240467664.git.len.brown@intel.com>

From: Len Brown <len.brown@intel.com>

Executing BIOS code paths not exercised by Windows
tends to get Linux into trouble.

However, if a system does benefit from _GTS or _BFS,
acpi.gts=1 an acpi.bfs=1 are now available to enable them.

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

Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/acpi/acpica/hwsleep.c |   43 ++++++++++++++++++++++++----------------
 drivers/acpi/sleep.c          |   27 +++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 17 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index baa5fc0..db307a3 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -211,6 +211,12 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
 
 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
 
+static unsigned int gts, bfs;
+module_param(gts, uint, 0644);
+module_param(bfs, uint, 0644);
+MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
+MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state
@@ -278,16 +284,18 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
 		return_ACPI_STATUS(status);
 	}
 
-	/* Execute the _GTS method */
+	if (gts) {
+		/* Execute the _GTS method */
 
-	arg_list.count = 1;
-	arg_list.pointer = &arg;
-	arg.type = ACPI_TYPE_INTEGER;
-	arg.integer.value = sleep_state;
+		arg_list.count = 1;
+		arg_list.pointer = &arg;
+		arg.type = ACPI_TYPE_INTEGER;
+		arg.integer.value = sleep_state;
 
-	status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
-	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
-		return_ACPI_STATUS(status);
+		status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
+		if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+			return_ACPI_STATUS(status);
+		}
 	}
 
 	/* Get current value of PM1A control */
@@ -513,18 +521,19 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
 		}
 	}
 
-	/* Execute the _BFS method */
+	if (bfs) {
+		/* Execute the _BFS method */
 
-	arg_list.count = 1;
-	arg_list.pointer = &arg;
-	arg.type = ACPI_TYPE_INTEGER;
-	arg.integer.value = sleep_state;
+		arg_list.count = 1;
+		arg_list.pointer = &arg;
+		arg.type = ACPI_TYPE_INTEGER;
+		arg.integer.value = sleep_state;
 
-	status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
-	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
-		ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
+		status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
+		if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+			ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
+		}
 	}
-
 	return_ACPI_STATUS(status);
 }
 
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 779e4e5..9042875 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -713,6 +713,32 @@ static void acpi_power_off(void)
 	acpi_enter_sleep_state(ACPI_STATE_S5);
 }
 
+/*
+ * ACPI 2.0 created the optional _GTS and _BFS,
+ * but industry adoption has been neither rapid nor broad.
+ *
+ * Linux gets into trouble when it executes poorly validated
+ * paths through the BIOS, so disable _GTS and _BFS by default,
+ * but do speak up and offer the option to enable them.
+ */
+void __init acpi_gts_bfs_check(void)
+{
+	acpi_handle dummy;
+
+	if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__GTS, &dummy)))
+	{
+		printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n");
+		printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, "
+			"please notify linux-acpi@vger.kernel.org\n");
+	}
+	if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__BFS, &dummy)))
+	{
+		printk(KERN_NOTICE PREFIX "BIOS offers _BFS\n");
+		printk(KERN_NOTICE PREFIX "If \"acpi.bfs=1\" improves resume, "
+			"please notify linux-acpi@vger.kernel.org\n");
+	}
+}
+
 int __init acpi_sleep_init(void)
 {
 	acpi_status status;
@@ -771,5 +797,6 @@ int __init acpi_sleep_init(void)
 	 * object can also be evaluated when the system enters S5.
 	 */
 	register_reboot_notifier(&tts_notifier);
+	acpi_gts_bfs_check();
 	return 0;
 }
-- 
1.6.0.6


  parent reply	other threads:[~2009-04-23  6:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23  6:23 ACPI patches queued for 2.6.30-rc3 Len Brown
2009-04-23  6:23 ` [PATCH 01/29] ACPI: button: whitespace changes Len Brown
2009-04-23  6:23   ` [PATCH 02/29] ACPI: button: remove unnecessary null pointer checks Len Brown
2009-04-23  6:23   ` [PATCH 03/29] ACPI: button: use Linux style for getting driver_data Len Brown
2009-04-23  6:23   ` [PATCH 04/29] ACPI: button: cache hid/name/class pointers Len Brown
2009-04-23  6:23   ` [PATCH 05/29] ACPI: button: remove button->device pointer Len Brown
2009-04-23  6:23   ` [PATCH 06/29] ACPI: button: remove control method/fixed hardware distinctions Len Brown
2009-04-23  6:23   ` [PATCH 07/29] ACPI: Revert conflicting workaround for BIOS w/ mangled PRT entries Len Brown
2009-04-23  6:23   ` [PATCH 08/29] ACPI video: handle indexed _BQC correctly Len Brown
2009-04-23  6:23   ` Len Brown [this message]
2009-04-23  6:23   ` [PATCH 10/29] thermal: Fix polling frequency for systems without passive cooling Len Brown
2009-04-23  6:23   ` [PATCH 11/29] sony-laptop: Duplicate SNC 127 Event Fix Len Brown
2009-04-23  6:23   ` [PATCH 12/29] sony-laptop: SNC 127 Initialization Fix Len Brown
2009-04-23  6:23   ` [PATCH 13/29] sony-laptop: SNC input event 38 fix Len Brown
2009-04-23  6:23   ` [PATCH 14/29] ec.c: Fix ACPI EC resume non-query interrupt message Len Brown
2009-04-23  6:23   ` [PATCH 15/29] sony-laptop: fix bogus error message display on resume Len Brown
2009-04-23  6:23   ` [PATCH 16/29] sony-laptop: always try to unblock rfkill on load Len Brown
2009-04-23  6:23   ` [PATCH 17/29] thinkpad-acpi: silence hotkey enable warning for module parameter Len Brown
2009-04-23  6:23   ` [PATCH 18/29] thinkpad-acpi: fix LED blinking through timer trigger Len Brown
2009-04-23  6:23   ` [PATCH 19/29] thinkpad-acpi: fix use of MODULE_AUTHOR Len Brown
2009-04-23  6:23   ` [PATCH 20/29] thinkpad-acpi: simplify module autoloading Len Brown
2009-04-23  6:23   ` [PATCH 21/29] thinkpad-acpi: bump up version to 0.23 Len Brown
2009-04-23  6:23   ` [PATCH 22/29] x86, acpi_cpufreq: Fix the NULL pointer dereference in get_measured_perf Len Brown
2009-04-23  6:23   ` [PATCH 23/29] acpi-cpufreq: Cleanup: Use printk_once Len Brown
2009-04-23  6:23   ` [PATCH 24/29] acpi-cpufreq: style-only: add parens to math expression Len Brown
2009-04-23  6:23   ` [PATCH 25/29] acpi-cpufreq: Do not let get_measured perf depend on internal variable Len Brown
2009-04-23  6:23   ` [PATCH 26/29] ACPI video: fix an error when the brightness levels on AC and on Battery are same Len Brown
2009-04-23  6:23   ` [PATCH 27/29] ACPI: add /sys/firmware/acpi/interrupts/sci_not counter Len Brown
2009-04-23  6:23   ` [PATCH 28/29] ACPI: idle: mark_tsc_unstable() at init-time, not run-time Len Brown
2009-04-23  6:23   ` [PATCH 29/29] ACPI: delete obsolete "bus master activity" proc field Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96f15efcea94545987715f453a8c2b8ea592d000.1240467664.git.len.brown@intel.com \
    --to=lenb@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.