Module Name:    src
Committed By:   mrg
Date:           Wed Oct 27 04:15:42 UTC 2021

Modified Files:
        src/sys/arch/x86/x86: cpu_topology.c
        src/usr.sbin/cpuctl/arch: i386.c

Log Message:
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.19 -r1.20 src/sys/arch/x86/x86/cpu_topology.c
cvs rdiff -u -r1.122 -r1.123 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.19 src/sys/arch/x86/x86/cpu_topology.c:1.20
--- src/sys/arch/x86/x86/cpu_topology.c:1.19	Sat Feb 15 07:20:41 2020
+++ src/sys/arch/x86/x86/cpu_topology.c	Wed Oct 27 04:15:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_topology.c,v 1.19 2020/02/15 07:20:41 skrll Exp $	*/
+/*	$NetBSD: cpu_topology.c,v 1.20 2021/10/27 04:15:41 mrg 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.19 2020/02/15 07:20:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.20 2021/10/27 04:15:41 mrg Exp $");
 
 #include "acpica.h"
 
@@ -185,8 +185,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.122 src/usr.sbin/cpuctl/arch/i386.c:1.123
--- src/usr.sbin/cpuctl/arch/i386.c:1.122	Thu Oct  7 13:04:18 2021
+++ src/usr.sbin/cpuctl/arch/i386.c	Wed Oct 27 04:15:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.122 2021/10/07 13:04:18 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.123 2021/10/27 04:15:42 mrg 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.122 2021/10/07 13:04:18 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.123 2021/10/27 04:15:42 mrg Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -1892,7 +1892,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