Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 stopgap fix: restrict XSAVEOPT to Intel CPUs



details:   https://anonhg.NetBSD.org/src/rev/d5698e9e5872
branches:  trunk
changeset: 829653:d5698e9e5872
user:      maya <maya%NetBSD.org@localhost>
date:      Wed Feb 07 22:49:32 2018 +0000

description:
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

diffstat:

 sys/arch/x86/x86/identcpu.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r ecbb1695b911 -r d5698e9e5872 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c       Wed Feb 07 20:42:17 2018 +0000
+++ b/sys/arch/x86/x86/identcpu.c       Wed Feb 07 22:49:32 2018 +0000
@@ -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 @@
 
        /* 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 */



Home | Main Index | Thread Index | Old Index