Module Name: src
Committed By: mrg
Date: Mon Feb 19 09:22:31 UTC 2024
Modified Files:
src/sys/arch/x86/x86: tsc.c
Log Message:
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"
To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 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.58 src/sys/arch/x86/x86/tsc.c:1.59
--- src/sys/arch/x86/x86/tsc.c:1.58 Sat Sep 9 18:37:03 2023
+++ src/sys/arch/x86/x86/tsc.c Mon Feb 19 09:22:31 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: tsc.c,v 1.58 2023/09/09 18:37:03 ad Exp $ */
+/* $NetBSD: tsc.c,v 1.59 2024/02/19 09:22:31 mrg 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.58 2023/09/09 18:37:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.59 2024/02/19 09:22:31 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -132,6 +132,19 @@ 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:
+ printf("%s: invariant %d (base fam %x)\n", __func__, invariant, CPUID_TO_FAMILY(ci->ci_signature));
+ return false;
+ }
}
/*