linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/AMD: Apply erratum 665 on machines without a BIOS fix
@ 2016-09-02  5:35 Borislav Petkov
  2016-09-02 19:37 ` [tip:x86/urgent] " tip-bot for Emanuel Czirai
  0 siblings, 1 reply; 2+ messages in thread
From: Borislav Petkov @ 2016-09-02  5:35 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML, Emanuel Czirai, Yaowu Xu

From: Emanuel Czirai <icanrealizeum@gmail.com>

AMD F12h machines have an erratum which can cause DIV/IDIV to behave
unpredictably. The workaround is to set MSRC001_1029[31] but sometimes
there is no BIOS update containing that workaround so let's do it
ourselves in that case. It is simple enough.

Signed-off-by: Emanuel Czirai <icanrealizeum@gmail.com>
Cc: Yaowu Xu <yaowu@google.com>
[ Write commit message. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/amd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f5c69d8974e1..eaf938e9df88 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -669,6 +669,14 @@ static void init_amd_gh(struct cpuinfo_x86 *c)
 		set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
 }
 
+static void init_amd_ln(struct cpuinfo_x86 *c)
+{
+#define MSR_AMD64_DE_CFG		0xC0011029
+
+	/* Apply erratum 665 fix to machines without a BIOS fix.  */
+	msr_set_bit(MSR_AMD64_DE_CFG, 31);
+}
+
 static void init_amd_bd(struct cpuinfo_x86 *c)
 {
 	u64 value;
@@ -726,6 +734,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	case 6:	   init_amd_k7(c); break;
 	case 0xf:  init_amd_k8(c); break;
 	case 0x10: init_amd_gh(c); break;
+	case 0x12: init_amd_ln(c); break;
 	case 0x15: init_amd_bd(c); break;
 	}
 
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:x86/urgent] x86/AMD: Apply erratum 665 on machines without a BIOS fix
  2016-09-02  5:35 [PATCH] x86/AMD: Apply erratum 665 on machines without a BIOS fix Borislav Petkov
@ 2016-09-02 19:37 ` tip-bot for Emanuel Czirai
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Emanuel Czirai @ 2016-09-02 19:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bp, hpa, icanrealizeum, mingo, tglx, linux-kernel, yaowu

Commit-ID:  d1992996753132e2dafe955cccb2fb0714d3cfc4
Gitweb:     http://git.kernel.org/tip/d1992996753132e2dafe955cccb2fb0714d3cfc4
Author:     Emanuel Czirai <icanrealizeum@gmail.com>
AuthorDate: Fri, 2 Sep 2016 07:35:50 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Sep 2016 20:42:28 +0200

x86/AMD: Apply erratum 665 on machines without a BIOS fix

AMD F12h machines have an erratum which can cause DIV/IDIV to behave
unpredictably. The workaround is to set MSRC001_1029[31] but sometimes
there is no BIOS update containing that workaround so let's do it
ourselves unconditionally. It is simple enough.

[ Borislav: Wrote commit message. ]

Signed-off-by: Emanuel Czirai <icanrealizeum@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Yaowu Xu <yaowu@google.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20160902053550.18097-1-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/cpu/amd.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f5c69d8..b81fe2d 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -669,6 +669,17 @@ static void init_amd_gh(struct cpuinfo_x86 *c)
 		set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
 }
 
+#define MSR_AMD64_DE_CFG	0xC0011029
+
+static void init_amd_ln(struct cpuinfo_x86 *c)
+{
+	/*
+	 * Apply erratum 665 fix unconditionally so machines without a BIOS
+	 * fix work.
+	 */
+	msr_set_bit(MSR_AMD64_DE_CFG, 31);
+}
+
 static void init_amd_bd(struct cpuinfo_x86 *c)
 {
 	u64 value;
@@ -726,6 +737,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	case 6:	   init_amd_k7(c); break;
 	case 0xf:  init_amd_k8(c); break;
 	case 0x10: init_amd_gh(c); break;
+	case 0x12: init_amd_ln(c); break;
 	case 0x15: init_amd_bd(c); break;
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-02 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02  5:35 [PATCH] x86/AMD: Apply erratum 665 on machines without a BIOS fix Borislav Petkov
2016-09-02 19:37 ` [tip:x86/urgent] " tip-bot for Emanuel Czirai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).