Module Name:    src
Committed By:   maya
Date:           Wed Feb  7 22:49:32 UTC 2018

Modified Files:
        src/sys/arch/x86/x86: identcpu.c

Log Message:
stopgap fix: restrict XSAVEOPT to Intel CPUs

The current code causes floating point miscalculations on AMD Ryzen.
PR port-amd64/52966: amd64 FPU handling broken on AMD


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/x86/x86/identcpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.67 src/sys/arch/x86/x86/identcpu.c:1.68
--- src/sys/arch/x86/x86/identcpu.c:1.67	Sat Nov 11 11:00:46 2017
+++ src/sys/arch/x86/x86/identcpu.c	Wed Feb  7 22:49:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.67 2017/11/11 11:00:46 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.68 2018/02/07 22:49:32 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.67 2017/11/11 11:00:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.68 2018/02/07 22:49:32 maya Exp $");
 
 #include "opt_xen.h"
 
@@ -761,7 +761,8 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	/* xsaveopt ought to be faster than xsave */
 	x86_cpuid2(0xd, 1, descs);
-	if (descs[0] & CPUID_PES1_XSAVEOPT)
+	if ((descs[0] & CPUID_PES1_XSAVEOPT) &&
+	    (cpu_vendor == CPUVENDOR_INTEL)) /* XXX PR 52966 */
 		x86_fpu_save = FPU_SAVE_XSAVEOPT;
 
 	/* Get features and maximum size of the save area */

Reply via email to