From: Andy Lutomirski <luto@MIT.EDU>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Fenghua Yu <fenghua.yu@intel.com>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andy Lutomirski <luto@MIT.EDU>
Subject: [PATCH v3 2/2] x86: Enable monitor/mwait on Intel if BIOS hasn't already
Date: Tue, 9 Aug 2011 08:41:06 -0400 [thread overview]
Message-ID: <aed368a81dc914d639aaa77665f06ae136fe38dc.1312893572.git.luto@mit.edu> (raw)
In-Reply-To: <cover.1312893572.git.luto@mit.edu>
In-Reply-To: <cover.1312893572.git.luto@mit.edu>
My Intel DQ67SW (latest BIOS) disables monitor/mwait on the boot CPU
if TXT is enabled. We're lucky that the system works at all, since
the feature is still enabled on other CPUs.
The obvious fix is to just re-enable it ourselves.
Signed-off-by: Andy Lutomirski <luto@mit.edu>
---
arch/x86/kernel/cpu/intel.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 7d02873..c49487f 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -492,6 +492,30 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
}
}
+
+ /* Enable monitor/mwait if BIOS didn't do it for us. */
+ if (!cpu_has(c, X86_FEATURE_MWAIT) && cpu_has(c, X86_FEATURE_XMM3)
+ && c->x86 >= 6 && !(c->x86 == 6 && c->x86_model < 0x1c)
+ && !(c->x86 == 0xf && c->x86_model < 3)) {
+ u64 misc_enable;
+ rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+ misc_enable |= MSR_IA32_MISC_ENABLE_MWAIT;
+
+ /*
+ * Some non-SSE3 cpus will #GP. We check for that,
+ * but it can't hurt to be safe.
+ */
+ wrmsr_safe(MSR_IA32_MISC_ENABLE, (u32)misc_enable,
+ (u32)(misc_enable >> 32));
+
+ /* Re-read monitor capability. */
+ if (cpuid_ecx(1) & 0x8) {
+ set_cpu_cap(c, X86_FEATURE_MWAIT);
+
+ printk(KERN_WARNING FW_WARN "CPU #%d: IA32_MISC_ENABLE.ENABLE_MONITOR_FSM was not set\n",
+ c->cpu_index);
+ }
+ }
}
#ifdef CONFIG_X86_32
--
1.7.6
next prev parent reply other threads:[~2011-08-09 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-09 12:41 [PATCH v3 0/2] Forcibly enable some MISC_ENABLE features on Intel Andy Lutomirski
2011-08-09 12:41 ` [PATCH v3 1/2] x86: Enable fast strings on Intel if BIOS hasn't already Andy Lutomirski
2011-08-09 15:40 ` Yu, Fenghua
2011-08-10 14:49 ` Andrew Lutomirski
2011-08-10 15:05 ` Yu, Fenghua
2011-08-10 15:11 ` Andrew Lutomirski
2011-08-09 12:41 ` Andy Lutomirski [this message]
2011-08-09 12:50 ` [PATCH v3 0/2] Forcibly enable some MISC_ENABLE features on Intel Alan Cox
2011-08-09 13:09 ` Andrew Lutomirski
2011-08-10 18:21 ` Len Brown
2011-08-10 18:33 ` Andrew Lutomirski
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=aed368a81dc914d639aaa77665f06ae136fe38dc.1312893572.git.luto@mit.edu \
--to=luto@mit.edu \
--cc=fenghua.yu@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mjg59@srcf.ucam.org \
--cc=x86@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
all inboxes | Powered by JetHome®