From: Ross Lagerwall Subject: [PATCH 1/2] mwait_idle: Disable Baytrail Core and Module C6 auto-demotion Date: Mon, 8 Sep 2014 13:42:06 +0100 Message-ID: <1410180127-4812-1-git-send-email-ross.lagerwall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org From: Len Brown Power efficiency improves on Baytrail (Intel Atom Processor E3000) when C6 auto-demotion is disabled. Based on work by Srinidhi Kasagar . Signed-off-by: Len Brown Signed-off-by: Ross Lagerwall --- xen/arch/x86/cpu/mwait-idle.c | 7 +++++++ xen/include/asm-x86/msr-index.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c index c2c8889..2c5864e 100644 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -88,6 +88,7 @@ struct idle_cpu { * Indicate which enable bits to clear here. */ unsigned long auto_demotion_disable_flags; + bool_t byt_auto_demotion_disable_flag; bool_t disable_promotion_to_c1e; }; @@ -569,6 +570,7 @@ static const struct idle_cpu idle_cpu_snb = { static const struct idle_cpu idle_cpu_byt = { .state_table = byt_cstates, .disable_promotion_to_c1e = 1, + .byt_auto_demotion_disable_flag = 1, }; static const struct idle_cpu idle_cpu_ivb = { @@ -767,6 +769,11 @@ static int mwait_idle_cpu_init(struct notifier_block *nfb, if (icpu->auto_demotion_disable_flags) on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, NULL, 1); + if (icpu->byt_auto_demotion_disable_flag) { + wrmsrl(MSR_CC6_DEMOTION_POLICY_CONFIG, 0); + wrmsrl(MSR_MC6_DEMOTION_POLICY_CONFIG, 0); + } + if (icpu->disable_promotion_to_c1e) on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 1); diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h index 2056501..7e13742 100644 --- a/xen/include/asm-x86/msr-index.h +++ b/xen/include/asm-x86/msr-index.h @@ -102,6 +102,9 @@ #define CMCI_EN (1UL<<30) #define CMCI_THRESHOLD_MASK 0x7FFF +#define MSR_CC6_DEMOTION_POLICY_CONFIG 0x00000668 +#define MSR_MC6_DEMOTION_POLICY_CONFIG 0x00000669 + #define MSR_AMD64_MC0_MASK 0xc0010044 #define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) -- 1.9.3