Module Name:    src
Committed By:   martin
Date:           Wed Oct  2 18:24:35 UTC 2024

Modified Files:
        src/sys/arch/x86/x86 [netbsd-10]: tsc.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #915):

        sys/arch/x86/x86/tsc.c: revision 1.59
        sys/arch/x86/x86/tsc.c: revision 1.60

make TSC get a quality of -100 on AMD Family 15h and 16h
this should "fix" PR#56322 and is known as AMD errata
"778: Processor Core Time Stamp Counters May Experience Drift"

remove unintended printf() in previous.  (thx dh)


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.4.1 src/sys/arch/x86/x86/tsc.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/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.57 src/sys/arch/x86/x86/tsc.c:1.57.4.1
--- src/sys/arch/x86/x86/tsc.c:1.57	Fri Oct 15 18:12:48 2021
+++ src/sys/arch/x86/x86/tsc.c	Wed Oct  2 18:24:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsc.c,v 1.57 2021/10/15 18:12:48 jmcneill Exp $	*/
+/*	$NetBSD: tsc.c,v 1.57.4.1 2024/10/02 18:24:35 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.57 2021/10/15 18:12:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.57.4.1 2024/10/02 18:24:35 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -132,6 +132,18 @@ tsc_is_invariant(void)
 		 * Manual Volume 3: General-Purpose and System Instructions.
 		 * The check is done below.
 		 */
+
+		 /*
+		  * AMD Errata 778: Processor Core Time Stamp Counters May
+		  * Experience Drift
+		  *
+		  * This affects all family 15h and family 16h processors.
+		  */
+		switch (CPUID_TO_FAMILY(ci->ci_signature)) {
+		case 0x15:
+		case 0x16:
+			return false;
+		}
 	}
 
 	/*

Reply via email to