]> xenbits.xensource.com Git - xen.git/commitdiff
x86: Use deep C states for off-lined CPUs
authorBoris Ostrovsky <boris.ostrovsky@amd.com>
Tue, 6 Mar 2012 14:51:33 +0000 (15:51 +0100)
committerBoris Ostrovsky <boris.ostrovsky@amd.com>
Tue, 6 Mar 2012 14:51:33 +0000 (15:51 +0100)
Currently when a core is taken off-line it is placed in C1 state (unless
MONITOR/MWAIT is used). This patch allows a core to go to deeper C states
resulting in significantly higher power savings.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/acpi/cpu_idle.c

index 0102b6329e32f3dc4598912625a91fa4fa64f7d7..90168548bc0cc54fbc2e830ca80945674166aeeb 100644 (file)
@@ -602,6 +602,23 @@ static void acpi_dead_idle(void)
             __mwait(cx->address, 0);
         }
     }
+    else if ( current_cpu_data.x86_vendor == X86_VENDOR_AMD &&
+              cx->entry_method == ACPI_CSTATE_EM_SYSIO )
+    {
+        /* Intel prefers not to use SYSIO */
+
+        /* Avoid references to shared data after the cache flush */
+        u32 address = cx->address;
+        u32 pmtmr_ioport_local = pmtmr_ioport;
+
+        wbinvd();
+
+        while ( 1 )
+        {
+            inb(address);
+            inl(pmtmr_ioport_local);
+        }
+    }
 
 default_halt:
     for ( ; ; )