Module Name:    src
Committed By:   martin
Date:           Mon Nov 22 17:05:32 UTC 2021

Modified Files:
        src/sys/arch/x86/x86 [netbsd-9]: cpu_topology.c
        src/usr.sbin/cpuctl/arch [netbsd-9]: i386.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1375):

        usr.sbin/cpuctl/arch/i386.c: revision 1.123
        sys/arch/x86/x86/cpu_topology.c: revision 1.20

decode SMT parts for AMD family >= 0x17, not just 0x17.

now zen3 systems are properly identified by cpu topology for the
scheduler and cpuctl identify.


To generate a diff of this commit:
cvs rdiff -u -r1.14.4.1 -r1.14.4.2 src/sys/arch/x86/x86/cpu_topology.c
cvs rdiff -u -r1.104.2.6 -r1.104.2.7 src/usr.sbin/cpuctl/arch/i386.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/cpu_topology.c
diff -u src/sys/arch/x86/x86/cpu_topology.c:1.14.4.1 src/sys/arch/x86/x86/cpu_topology.c:1.14.4.2
--- src/sys/arch/x86/x86/cpu_topology.c:1.14.4.1	Mon May 25 15:39:54 2020
+++ src/sys/arch/x86/x86/cpu_topology.c	Mon Nov 22 17:05:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_topology.c,v 1.14.4.1 2020/05/25 15:39:54 martin Exp $	*/
+/*	$NetBSD: cpu_topology.c,v 1.14.4.2 2021/11/22 17:05:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009 Mindaugas Rasiukevicius <rmind at NetBSD org>,
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.14.4.1 2020/05/25 15:39:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.14.4.2 2021/11/22 17:05:32 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -152,8 +152,8 @@ x86_cpu_topology(struct cpu_info *ci)
 		}
 	}
 
-	/* Family 0x17 supports SMT */
-	if (cpu_vendor == CPUVENDOR_AMD && cpu_family == 0x17) { /* XXX */
+	/* Family 0x17 and above support SMT */
+	if (cpu_vendor == CPUVENDOR_AMD && cpu_family >= 0x17) { /* XXX */
 		x86_cpuid(0x8000001e, descs);
 		const u_int threads = ((descs[1] >> 8) & 0xff) + 1;
 

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.104.2.6 src/usr.sbin/cpuctl/arch/i386.c:1.104.2.7
--- src/usr.sbin/cpuctl/arch/i386.c:1.104.2.6	Fri Jul 10 11:20:29 2020
+++ src/usr.sbin/cpuctl/arch/i386.c	Mon Nov 22 17:05:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.104.2.6 2020/07/10 11:20:29 martin Exp $	*/
+/*	$NetBSD: i386.c,v 1.104.2.7 2021/11/22 17:05:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.104.2.6 2020/07/10 11:20:29 martin Exp $");
+__RCSID("$NetBSD: i386.c,v 1.104.2.7 2021/11/22 17:05:32 martin Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -1935,7 +1935,7 @@ identifycpu_cpuids_amd(struct cpu_info *
 	}
 #endif
 
-	if (cpu_family == 0x17) {
+	if (cpu_family >= 0x17) {
 		x86_cpuid(0x8000001e, descs);
 		const u_int threads = ((descs[1] >> 8) & 0xff) + 1;
 		smt_bits = ilog2(threads);

Reply via email to