mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-18 17:33:31 +00:00
x86: Enable fast strings on Intel CPUs if BIOS hasn't config for kernel 4.9
This commit is contained in:
parent
ac6cb48969
commit
d46b6d7970
@ -511,3 +511,9 @@ msgstr "仅常用端口(不走P2P流量到代理)"
|
||||
|
||||
msgid "Ping Latency"
|
||||
msgstr "Ping延迟"
|
||||
|
||||
msgid "Bypass Domain List"
|
||||
msgstr "域名白名单"
|
||||
|
||||
msgid "Black Domain List"
|
||||
msgstr "域名黑名单"
|
||||
|
@ -0,0 +1,57 @@
|
||||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
|
||||
index 1905ce9..a4a3ef2 100644
|
||||
--- a/arch/x86/kernel/cpu/intel.c
|
||||
+++ b/arch/x86/kernel/cpu/intel.c
|
||||
@@ -124,6 +124,7 @@
|
||||
static void early_init_intel(struct cpuinfo_x86 *c)
|
||||
{
|
||||
u64 misc_enable;
|
||||
+ bool allow_fast_string = true;
|
||||
|
||||
/* Unmask CPUID levels if masked: */
|
||||
if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
|
||||
@@ -233,20 +234,39 @@
|
||||
* Ingo Molnar reported a Pentium D (model 6) and a Xeon
|
||||
* (model 2) with the same problem.
|
||||
*/
|
||||
- if (c->x86 == 15)
|
||||
+ if (c->x86 == 15) {
|
||||
+ allow_fast_string = false;
|
||||
if (msr_clear_bit(MSR_IA32_MISC_ENABLE,
|
||||
MSR_IA32_MISC_ENABLE_FAST_STRING_BIT) > 0)
|
||||
pr_info("kmemcheck: Disabling fast string operations\n");
|
||||
+ }
|
||||
#endif
|
||||
|
||||
/*
|
||||
- * If fast string is not enabled in IA32_MISC_ENABLE for any reason,
|
||||
- * clear the fast string and enhanced fast string CPU capabilities.
|
||||
+ * If BIOS didn't enable fast string operation, try to enable
|
||||
+ * it ourselves. If that fails, then clear the fast string
|
||||
+ * and enhanced fast string CPU capabilities.
|
||||
*/
|
||||
if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
|
||||
rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
|
||||
+
|
||||
+ if (allow_fast_string &&
|
||||
+ !(misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING)) {
|
||||
+ misc_enable |= MSR_IA32_MISC_ENABLE_FAST_STRING;
|
||||
+ wrmsrl_safe(MSR_IA32_MISC_ENABLE, misc_enable);
|
||||
+
|
||||
+ /* Re-read to make sure it stuck. */
|
||||
+ rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
|
||||
+
|
||||
+ if (misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING)
|
||||
+ printk_once(KERN_INFO "BIOS disabled fast string operation, re-enabled sucessfully.\n");
|
||||
+ }
|
||||
+
|
||||
if (!(misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING)) {
|
||||
- pr_info("Disabled fast string operations\n");
|
||||
+ if (allow_fast_string)
|
||||
+ printk_once(KERN_INFO FW_WARN "BIOS disabled fast string operation, re-enable failed.\n");
|
||||
+ else
|
||||
+ printk_once(KERN_INFO "Disabled fast string operations\n");
|
||||
setup_clear_cpu_cap(X86_FEATURE_REP_GOOD);
|
||||
setup_clear_cpu_cap(X86_FEATURE_ERMS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user