public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: venkatesh.pallipadi@intel.com
To: lenb@kernel.org, len.brown@intel.com
Cc: linux-acpi@vger.kernel.org,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Subject: [patch 2/4] ACPI: Use mwait for C1 idle
Date: Thu, 31 Jan 2008 17:35:04 -0800	[thread overview]
Message-ID: <20080201013629.328571000@intel.com> (raw)
In-Reply-To: 20080201013502.750627000@intel.com

[-- Attachment #1: acpi_c1_mwait.patch --]
[-- Type: text/plain, Size: 3041 bytes --]

Add mwait idle for C1 state instead of halt, on platforms that support
C1 state with mwait.

Renames cx->space_id to something more appropriate.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

Index: linux-2.6.25-rc/drivers/acpi/processor_idle.c
===================================================================
--- linux-2.6.25-rc.orig/drivers/acpi/processor_idle.c
+++ linux-2.6.25-rc/drivers/acpi/processor_idle.c
@@ -265,7 +265,7 @@ static atomic_t c3_cpu_count;
 /* Common C-state entry for C2, C3, .. */
 static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
 {
-	if (cstate->space_id == ACPI_CSTATE_FFH) {
+	if (cstate->entry_method == ACPI_CSTATE_FFH) {
 		/* Call into architectural FFH based C-state */
 		acpi_processor_ffh_cstate_enter(cstate);
 	} else {
@@ -904,20 +904,20 @@ static int acpi_processor_get_power_info
 		cx.address = reg->address;
 		cx.index = current_count + 1;
 
-		cx.space_id = ACPI_CSTATE_SYSTEMIO;
+		cx.entry_method = ACPI_CSTATE_SYSTEMIO;
 		if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
 			if (acpi_processor_ffh_cstate_probe
 					(pr->id, &cx, reg) == 0) {
-				cx.space_id = ACPI_CSTATE_FFH;
-			} else if (cx.type != ACPI_STATE_C1) {
+				cx.entry_method = ACPI_CSTATE_FFH;
+			} else if (cx.type == ACPI_STATE_C1) {
 				/*
 				 * C1 is a special case where FIXED_HARDWARE
 				 * can be handled in non-MWAIT way as well.
 				 * In that case, save this _CST entry info.
-				 * That is, we retain space_id of SYSTEM_IO for
-				 * halt based C1.
 				 * Otherwise, ignore this info and continue.
 				 */
+				cx.entry_method = ACPI_CSTATE_HALT;
+			} else {
 				continue;
 			}
 		}
@@ -1351,12 +1351,16 @@ static inline void acpi_idle_update_bm_r
 /**
  * acpi_idle_do_entry - a helper function that does C2 and C3 type entry
  * @cx: cstate data
+ *
+ * Caller disables interrupt before call and enables interrupt after return.
  */
 static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 {
-	if (cx->space_id == ACPI_CSTATE_FFH) {
+	if (cx->entry_method == ACPI_CSTATE_FFH) {
 		/* Call into architectural FFH based C-state */
 		acpi_processor_ffh_cstate_enter(cx);
+	} else if (cx->entry_method == ACPI_CSTATE_HALT) {
+		acpi_safe_halt();
 	} else {
 		int unused;
 		/* IO port based C-state */
@@ -1389,7 +1393,7 @@ static int acpi_idle_enter_c1(struct cpu
 	if (pr->flags.bm_check)
 		acpi_idle_update_bm_rld(pr, cx);
 
-	acpi_safe_halt();
+	acpi_idle_do_entry(cx);
 
 	local_irq_enable();
 	cx->usage++;
Index: linux-2.6.25-rc/include/acpi/processor.h
===================================================================
--- linux-2.6.25-rc.orig/include/acpi/processor.h
+++ linux-2.6.25-rc/include/acpi/processor.h
@@ -34,6 +34,7 @@
 
 #define ACPI_CSTATE_SYSTEMIO	(0)
 #define ACPI_CSTATE_FFH		(1)
+#define ACPI_CSTATE_HALT	(2)
 
 /* Power Management */
 
@@ -64,7 +65,7 @@ struct acpi_processor_cx {
 	u8 valid;
 	u8 type;
 	u32 address;
-	u8 space_id;
+	u8 entry_method;
 	u8 index;
 	u32 latency;
 	u32 latency_ticks;

-- 

  parent reply	other threads:[~2008-02-01  1:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01  1:35 [patch 0/4] ACPI, CPU_IDLE: ACPI processor_idle changes, C1 residency time, etc venkatesh.pallipadi
2008-02-01  1:35 ` [patch 1/4] ACPI: Fix acpi_safe_halt usages and interrupt enabling/disabling venkatesh.pallipadi
2008-02-07  7:21   ` Len Brown
2008-02-01  1:35 ` venkatesh.pallipadi [this message]
2008-02-07  7:38   ` [patch 2/4] ACPI: Use mwait for C1 idle Len Brown
2008-02-01  1:35 ` [patch 3/4] ACPI, CPU_IDLE: Support C1 idle time accounting venkatesh.pallipadi
2008-02-07  7:38   ` Len Brown
2008-02-01  1:35 ` [patch 4/4] CPUIDLE: Add a poll_idle method into CPU_IDLE venkatesh.pallipadi
2008-02-07  7:38   ` 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=20080201013629.328571000@intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox