CVS commit: [netbsd-8] src/sys/arch/x86/x86

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:44:21 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: viac7temp.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1959):

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.20.1 src/sys/arch/x86/x86/viac7temp.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/viac7temp.c
diff -u src/sys/arch/x86/x86/viac7temp.c:1.8 src/sys/arch/x86/x86/viac7temp.c:1.8.20.1
--- src/sys/arch/x86/x86/viac7temp.c:1.8	Sun Aug 10 16:44:34 2014
+++ src/sys/arch/x86/x86/viac7temp.c	Thu Apr 18 16:44:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $ */
+/* $NetBSD: viac7temp.c,v 1.8.20.1 2024/04/18 16:44:20 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8.20.1 2024/04/18 16:44:20 martin Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -162,3 +163,32 @@ viac7temp_refresh_xcall(void *arg0, void
 	edata->value_cur += 27315;
 	edata->state = ENVSYS_SVALID;
 }
+
+MODULE(MODULE_CLASS_DRIVER, viac7temp, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+viac7temp_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:44:21 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: viac7temp.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1959):

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.20.1 src/sys/arch/x86/x86/viac7temp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 11:03:21 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: coretemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1857):

sys/arch/x86/x86/coretemp.c: revision 1.38-1.39 (patch)

coretemp(4): Change limits of Tjmax.
 - Change the lower limit from 70 to 60. At least, some BIOSes can change
   the value down to 62.
 - Change the upper limit from 110 to 120. At least, some BIOSes can change
   the value up to 115.
 - Print error message when rdmsr(TEMPERATURE_TARGET) failed.
 - When Tjmax exceeded the limit, print warning message and use the value
   as it is.
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.35.10.2 -r1.35.10.3 src/sys/arch/x86/x86/coretemp.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/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.35.10.2 src/sys/arch/x86/x86/coretemp.c:1.35.10.3
--- src/sys/arch/x86/x86/coretemp.c:1.35.10.2	Wed Aug  5 16:05:49 2020
+++ src/sys/arch/x86/x86/coretemp.c	Sat Jul 29 11:03:21 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.35.10.2 2020/08/05 16:05:49 martin Exp $ */
+/* $NetBSD: coretemp.c,v 1.35.10.3 2023/07/29 11:03:21 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35.10.2 2020/08/05 16:05:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35.10.3 2023/07/29 11:03:21 martin Exp $");
 
 #include 
 #include 
@@ -102,6 +102,10 @@ __KERNEL_RCSID(0, "$NetBSD: coretemp.c,v
 
 #define MSR_TEMP_TARGET_READOUT		__BITS(16, 23)
 
+#define TJMAX_DEFAULT		100
+#define TJMAX_LIMIT_LOW		60
+#define TJMAX_LIMIT_HIGH	120
+
 static int	coretemp_match(device_t, cfdata_t, void *);
 static void	coretemp_attach(device_t, device_t, void *);
 static int	coretemp_detach(device_t, int);
@@ -259,16 +263,15 @@ coretemp_tjmax(device_t self)
 {
 	struct coretemp_softc *sc = device_private(self);
 	struct cpu_info *ci = sc->sc_ci;
-	uint32_t model, stepping;
 	uint64_t msr;
+	uint32_t model, stepping;
+	int tjmax;
 
 	model = CPUID_TO_MODEL(ci->ci_signature);
 	stepping = CPUID_TO_STEPPING(ci->ci_signature);
 
-	/*
-	 * Use 100C as the initial value.
-	 */
-	sc->sc_tjmax = 100;
+	/* Set the initial value. */
+	sc->sc_tjmax = TJMAX_DEFAULT;
 
 	if ((model == 0x0f && stepping >= 2) || (model == 0x0e)) {
 		/*
@@ -304,20 +307,20 @@ coretemp_tjmax(device_t self)
 			sc->sc_tjmax = 90;
 	} else {
 notee:
-		/*
-		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET,
-		 * but only consider the interval [70, 110] C as valid.
-		 * It is not fully known which CPU models have the MSR.
-		 */
-		if (rdmsr_safe(MSR_TEMPERATURE_TARGET, ) == EFAULT)
-			return;
-
-		msr = __SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT);
-
-		if (msr >= 70 && msr <= 110) {
-			sc->sc_tjmax = msr;
+		/* Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET. */
+		if (rdmsr_safe(MSR_TEMPERATURE_TARGET, ) == EFAULT) {
+			aprint_error_dev(sc->sc_dev,
+			"Failed to read TEMPERATURE_TARGET MSR. "
+			"Use the default (%d)\n", sc->sc_tjmax);
 			return;
 		}
+
+		tjmax = __SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT);
+		if ((tjmax < TJMAX_LIMIT_LOW) || (tjmax > TJMAX_LIMIT_HIGH))
+			aprint_error_dev(sc->sc_dev,
+			"WARNING: Tjmax(%d) might exceeded the limit.\n",
+			tjmax);
+		sc->sc_tjmax = tjmax;
 	}
 }
 
@@ -334,7 +337,7 @@ coretemp_refresh(struct sysmon_envsys *s
 static void
 coretemp_refresh_xcall(void *arg0, void *arg1)
 {
-struct coretemp_softc *sc = arg0;
+	struct coretemp_softc *sc = arg0;
 	envsys_data_t *edata = arg1;
 	uint64_t msr;
 



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 11:03:21 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: coretemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1857):

sys/arch/x86/x86/coretemp.c: revision 1.38-1.39 (patch)

coretemp(4): Change limits of Tjmax.
 - Change the lower limit from 70 to 60. At least, some BIOSes can change
   the value down to 62.
 - Change the upper limit from 110 to 120. At least, some BIOSes can change
   the value up to 115.
 - Print error message when rdmsr(TEMPERATURE_TARGET) failed.
 - When Tjmax exceeded the limit, print warning message and use the value
   as it is.
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.35.10.2 -r1.35.10.3 src/sys/arch/x86/x86/coretemp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:42:04 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: errata.c

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

sys/arch/x86/x86/errata.c: revision 1.32

fix the cpuids for the zen2 client CPUs.

i'm not exactly how i came up with the values i had, though one
of them was still valid and matched my test systems.


To generate a diff of this commit:
cvs rdiff -u -r1.23.10.2 -r1.23.10.3 src/sys/arch/x86/x86/errata.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/errata.c
diff -u src/sys/arch/x86/x86/errata.c:1.23.10.2 src/sys/arch/x86/x86/errata.c:1.23.10.3
--- src/sys/arch/x86/x86/errata.c:1.23.10.2	Tue Jul 25 09:15:28 2023
+++ src/sys/arch/x86/x86/errata.c	Thu Jul 27 16:42:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: errata.c,v 1.23.10.2 2023/07/25 09:15:28 martin Exp $	*/
+/*	$NetBSD: errata.c,v 1.23.10.3 2023/07/27 16:42:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.23.10.2 2023/07/25 09:15:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.23.10.3 2023/07/27 16:42:04 martin Exp $");
 
 #include 
 #include 
@@ -96,8 +96,8 @@ static const u_int cpurevs[] = {
 	ML_A1, 0x0730F01, ZP_B1, 0x0800F11, ZP_B2, 0x0800F12,
 	PiR_B2, 0x0800F82, Rome_B0, 0x0830F10,
 	/* XXX client Zen2 names aren't known yet. */
-	Z2_XB, 0x0840F70, Z2_Ren, 0x0860F80, Z2_Luc, 0x0870F10,
-	Z2_Mat, 0x0890F70, Z2_VG, 0x0890F80, Z2_Men, 0x08A0F10,
+	Z2_XB, 0x0840F70, Z2_Ren, 0x0860F01, Z2_Luc, 0x0860F81,
+	Z2_Mat, 0x0870F10, Z2_VG, 0x0890F02, Z2_Men, 0x08A0F00,
 	Milan_B1, 0x0A00F11, Milan_B2, 0x0A00F12,
 	Genoa_B1, 0x0A10F11,
 	OINK



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:42:04 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: errata.c

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

sys/arch/x86/x86/errata.c: revision 1.32

fix the cpuids for the zen2 client CPUs.

i'm not exactly how i came up with the values i had, though one
of them was still valid and matched my test systems.


To generate a diff of this commit:
cvs rdiff -u -r1.23.10.2 -r1.23.10.3 src/sys/arch/x86/x86/errata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:54:02 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1830):

sys/arch/x86/x86/procfs_machdep.c: revision 1.47

Add Intel lam and AMD vnmi.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.15 -r1.15.2.16 src/sys/arch/x86/x86/procfs_machdep.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/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.15 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.16
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.15	Mon Jan 23 12:25:06 2023
+++ src/sys/arch/x86/x86/procfs_machdep.c	Wed Jun 21 19:54:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.15 2023/01/23 12:25:06 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.16 2023/06/21 19:54:02 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.15 2023/01/23 12:25:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.16 2023/06/21 19:54:02 martin Exp $");
 
 #include 
 #include 
@@ -151,7 +151,7 @@ static const char * const x86_features[]
 	"avx_vnni", "avx512_bf16", NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, NULL, "lam", NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
@@ -172,7 +172,7 @@ static const char * const x86_features[]
 	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
 	"v_vmsave_vmload",
 	"vgif", NULL, "x2avic", NULL, "v_spec_ctrl", NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "vnmi", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
 	NULL, "avx512vbmi", "umip", "pku",



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:54:02 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1830):

sys/arch/x86/x86/procfs_machdep.c: revision 1.47

Add Intel lam and AMD vnmi.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.15 -r1.15.2.16 src/sys/arch/x86/x86/procfs_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 19:24:59 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: efi.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1799):

sys/arch/x86/x86/efi_machdep.c: revision 1.3
(applied to sys/arch/x86/x86/efi.c)

x86/efi: Print uuids in slightly more standard notation.

Anyone need a spare hyphen?  We had a few extras, apparently.


To generate a diff of this commit:
cvs rdiff -u -r1.11.6.1 -r1.11.6.2 src/sys/arch/x86/x86/efi.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/efi.c
diff -u src/sys/arch/x86/x86/efi.c:1.11.6.1 src/sys/arch/x86/x86/efi.c:1.11.6.2
--- src/sys/arch/x86/x86/efi.c:1.11.6.1	Thu Jun  7 15:52:54 2018
+++ src/sys/arch/x86/x86/efi.c	Wed Feb 22 19:24:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efi.c,v 1.11.6.1 2018/06/07 15:52:54 martin Exp $	*/
+/*	$NetBSD: efi.c,v 1.11.6.2 2023/02/22 19:24:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.11.6.1 2018/06/07 15:52:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.11.6.2 2023/02/22 19:24:59 martin Exp $");
 
 #include 
 #include 
@@ -122,7 +122,7 @@ efi_aprintuuid(const struct uuid * uuid)
 	aprint_debug("-%04" PRIx16 "", uuid->time_mid);
 	aprint_debug("-%04" PRIx16 "", uuid->time_hi_and_version);
 	aprint_debug("-%02" PRIx8 "", uuid->clock_seq_hi_and_reserved);
-	aprint_debug("-%02" PRIx8 "", uuid->clock_seq_low);
+	aprint_debug("%02" PRIx8 "", uuid->clock_seq_low);
 	aprint_debug("-");
 	for (i = 0; i < _UUID_NODE_LEN; i++) {
 		aprint_debug("%02" PRIx8 "", uuid->node[i]);



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 19:24:59 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: efi.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1799):

sys/arch/x86/x86/efi_machdep.c: revision 1.3
(applied to sys/arch/x86/x86/efi.c)

x86/efi: Print uuids in slightly more standard notation.

Anyone need a spare hyphen?  We had a few extras, apparently.


To generate a diff of this commit:
cvs rdiff -u -r1.11.6.1 -r1.11.6.2 src/sys/arch/x86/x86/efi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:25:06 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1788):

sys/arch/x86/x86/procfs_machdep.c: revision 1.46

Add x2avic. Modify comment.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.14 -r1.15.2.15 src/sys/arch/x86/x86/procfs_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:25:06 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1788):

sys/arch/x86/x86/procfs_machdep.c: revision 1.46

Add x2avic. Modify comment.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.14 -r1.15.2.15 src/sys/arch/x86/x86/procfs_machdep.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/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.14 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.15
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.14	Fri Sep 16 18:39:16 2022
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jan 23 12:25:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.14 2022/09/16 18:39:16 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.15 2023/01/23 12:25:06 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.14 2022/09/16 18:39:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.15 2023/01/23 12:25:06 martin Exp $");
 
 #include 
 #include 
@@ -171,7 +171,7 @@ static const char * const x86_features[]
 	"tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
 	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
 	"v_vmsave_vmload",
-	"vgif", NULL, NULL, NULL, "v_spec_ctrl", NULL, NULL, NULL,
+	"vgif", NULL, "x2avic", NULL, "v_spec_ctrl", NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
@@ -183,7 +183,7 @@ static const char * const x86_features[]
 	NULL, "cldemote", NULL, "movdiri",
 	"movdir64b", "enqcmd", "sgx_lc", NULL},
 
-	{ /* (17) 0x8007 ebx */
+	{ /* (17) AMD 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2022-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 16 18:39:16 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1766):

sys/arch/x86/x86/procfs_machdep.c: revision 1.45

Add tdx_guest, brs, hfi, ibt, amx_bf16, amx_tile and amx_int8.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.13 -r1.15.2.14 src/sys/arch/x86/x86/procfs_machdep.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/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.13 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.14
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.13	Mon Jan 31 17:58:04 2022
+++ src/sys/arch/x86/x86/procfs_machdep.c	Fri Sep 16 18:39:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.13 2022/01/31 17:58:04 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.14 2022/09/16 18:39:16 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.13 2022/01/31 17:58:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.14 2022/09/16 18:39:16 martin Exp $");
 
 #include 
 #include 
@@ -122,7 +122,7 @@ static const char * const x86_features[]
 	{ /* (8) Linux mapping */
 	"tpr_shadow", "vnmi", "flexpriority", "ept", "vpid", NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmmcall",
-	NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, "ept_ad", NULL, NULL, NULL, NULL, "tdx_guest", NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (9) Intel-defined: 0007 ebx */
@@ -157,13 +157,13 @@ static const char * const x86_features[]
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
-	NULL, "virt_ssbd", NULL, "cppc", NULL, NULL, NULL, NULL},
+	NULL, "virt_ssbd", NULL, "cppc", NULL, NULL, NULL, "brs"},
 
 	{ /* (14) 0x0006 eax */
 	"dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
 	"hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req",
 	NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, "hfi", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (15) AMD 0x800a edx */
@@ -193,8 +193,8 @@ static const char * const x86_features[]
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL,
 	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL,
 	"tsxldtrk", NULL, "pconfig", "arch_lbr",
-	NULL, NULL, NULL, "avx512_fp16",
-	NULL, NULL, NULL, NULL,
+	"ibt", NULL, "amx_bf16", "avx512_fp16",
+	"amx_tile", "amx_int8", NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
 
 	{ /* (19) AMD 0x801f eax */



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2022-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 16 18:39:16 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1766):

sys/arch/x86/x86/procfs_machdep.c: revision 1.45

Add tdx_guest, brs, hfi, ibt, amx_bf16, amx_tile and amx_int8.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.13 -r1.15.2.14 src/sys/arch/x86/x86/procfs_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:58:05 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1733):

sys/arch/x86/x86/procfs_machdep.c: revision 1.43
sys/arch/x86/x86/procfs_machdep.c: revision 1.44

Update for cpuid flags:
  - The table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux mapping.
  - The table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID 0x07 leaf 1
%edx. Print avx_vnni and avx512_bf16.
  - Print cppc, enqcmd and arch_lbr.
  - Modify linux mapping. No used on NetBSD.

Fix procfs_machdep.c rev. 1.143. Print CPUID 0x0007:1 %eax correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.12 -r1.15.2.13 src/sys/arch/x86/x86/procfs_machdep.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/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.12 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.13
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.12	Fri Dec  3 19:53:32 2021
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jan 31 17:58:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.12 2021/12/03 19:53:32 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.13 2022/01/31 17:58:04 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.12 2021/12/03 19:53:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.13 2022/01/31 17:58:04 martin Exp $");
 
 #include 
 #include 
@@ -120,10 +120,8 @@ static const char * const x86_features[]
 	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL},
 
 	{ /* (8) Linux mapping */
-	"tpr_shadow", "vnmi", "flexpriority", "ept",
-	"vpid", "npt", "lbrv", "svm_lock",
-	"nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid",
-	"decodeassists", "pausefilter", "pfthreshold", "vmmcall",
+	"tpr_shadow", "vnmi", "flexpriority", "ept", "vpid", NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmmcall",
 	NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
@@ -141,15 +139,16 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (11) 0x000f:0 edx */
-	NULL, "cqm_llc", NULL, NULL, NULL, NULL, NULL, NULL,
+	{ /* (11) Linux mapping */
+	"cqm_llc", "cqm_occup_llc", "cqm_mbm_total", "cqm_mbm_local",
+	NULL, NULL, "split_lock_detect", NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (12) 0x000f:1 edx */
-	"cqm_occup_llc", "cqm_mbm_total", "cqm_mbm_local", NULL,
+	{ /* (12) Intel-defined 0x0007:1 eax */
 	NULL, NULL, NULL, NULL,
+	"avx_vnni", "avx512_bf16", NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
@@ -158,7 +157,7 @@ static const char * const x86_features[]
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
-	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "virt_ssbd", NULL, "cppc", NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */
 	"dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
@@ -181,7 +180,8 @@ static const char * const x86_features[]
 	"gfni", "vaes", "vpclmulqdq", "avx512_vnni",
 	"avx512_bitalg", "tme", "avx512_vpopcntdq", NULL,
 	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
-	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, "sgx_lc", NULL},
+	NULL, "cldemote", NULL, "movdiri",
+	"movdir64b", "enqcmd", "sgx_lc", NULL},
 
 	{ /* (17) 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
@@ -192,7 +192,8 @@ static const char * const x86_features[]
 	{ /* (18) Intel 0x0007 edx */
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL,
 	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL,
-	"tsxldtrk", NULL, "pconfig", NULL, NULL, NULL, NULL, "avx512_fp16",
+	"tsxldtrk", NULL, "pconfig", "arch_lbr",
+	NULL, NULL, NULL, "avx512_fp16",
 	NULL, NULL, NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
 
@@ -307,14 +308,11 @@ procfs_getonecpufeatures(struct cpu_info
 		diff = last - *left;
 	}
 
-	if (ci->ci_max_cpuid >= 0x0f) {
-		x86_cpuid2(0x0f, 0, descs);
-		procfs_getonefeatreg(descs[3], x86_features[11], p + diff,
-		left);
-		diff = last - *left;
+	/* x86_features[11] is Linux defined mapping */
 
-		x86_cpuid2(0x0f, 1, descs);
-		procfs_getonefeatreg(descs[3], 

CVS commit: [netbsd-8] src/sys/arch/x86/x86

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:58:05 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1733):

sys/arch/x86/x86/procfs_machdep.c: revision 1.43
sys/arch/x86/x86/procfs_machdep.c: revision 1.44

Update for cpuid flags:
  - The table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux mapping.
  - The table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID 0x07 leaf 1
%edx. Print avx_vnni and avx512_bf16.
  - Print cppc, enqcmd and arch_lbr.
  - Modify linux mapping. No used on NetBSD.

Fix procfs_machdep.c rev. 1.143. Print CPUID 0x0007:1 %eax correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.12 -r1.15.2.13 src/sys/arch/x86/x86/procfs_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:40:57 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1719):

sys/arch/x86/x86/identcpu.c: revision 1.121

make a numeric literal unsigned as it is bit-negated.


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.10 -r1.55.2.11 src/sys/arch/x86/x86/identcpu.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/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.55.2.10 src/sys/arch/x86/x86/identcpu.c:1.55.2.11
--- src/sys/arch/x86/x86/identcpu.c:1.55.2.10	Tue Dec  7 12:37:04 2021
+++ src/sys/arch/x86/x86/identcpu.c	Tue Dec  7 12:40:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.55.2.10 2021/12/07 12:37:04 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.55.2.11 2021/12/07 12:40:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.10 2021/12/07 12:37:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.11 2021/12/07 12:40:57 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -465,7 +465,7 @@ cpu_probe_cyrix_cmn(struct cpu_info *ci)
 	/* cyrix's workaround  for the "coma bug" */
 	cyrix_write_reg(0x31, cyrix_read_reg(0x31) | 0xf8);
 	cyrix_write_reg(0x32, cyrix_read_reg(0x32) | 0x7f);
-	cyrix_write_reg(0x33, cyrix_read_reg(0x33) & ~0xff);
+	cyrix_write_reg(0x33, cyrix_read_reg(0x33) & ~0xffu);
 	cyrix_write_reg(0x3c, cyrix_read_reg(0x3c) | 0x87);
 	/* disable access to ccr4/ccr5 */
 	cyrix_write_reg(0xC3, c3);



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:40:57 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1719):

sys/arch/x86/x86/identcpu.c: revision 1.121

make a numeric literal unsigned as it is bit-negated.


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.10 -r1.55.2.11 src/sys/arch/x86/x86/identcpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:37:04 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1718):

sys/arch/x86/x86/identcpu.c: revision 1.103
sys/arch/x86/x86/identcpu.c: revision 1.104
sys/arch/x86/x86/identcpu.c: revision 1.105

Add EX2 for Vortex86 SoCs (Andrius V)

use __arraycount, and fix comparison

flip the comparison again


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.9 -r1.55.2.10 src/sys/arch/x86/x86/identcpu.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/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.55.2.9 src/sys/arch/x86/x86/identcpu.c:1.55.2.10
--- src/sys/arch/x86/x86/identcpu.c:1.55.2.9	Fri Aug 16 15:36:17 2019
+++ src/sys/arch/x86/x86/identcpu.c	Tue Dec  7 12:37:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.55.2.9 2019/08/16 15:36:17 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.55.2.10 2021/12/07 12:37:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.9 2019/08/16 15:36:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.10 2021/12/07 12:37:04 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -691,7 +691,7 @@ cpu_probe_vortex86(struct cpu_info *ci)
 #define PCI_MODE1_DATA_REG	0x0cfc
 #define PCI_MODE1_ENABLE	0x8000UL
 
-	uint32_t reg;
+	uint32_t reg, idx;
 
 	if (cpu_vendor != CPUVENDOR_VORTEX86)
 		return;
@@ -705,17 +705,18 @@ cpu_probe_vortex86(struct cpu_info *ci)
 	outl(PCI_MODE1_ADDRESS_REG, PCI_MODE1_ENABLE | 0x90);
 	reg = inl(PCI_MODE1_DATA_REG);
 
-	if ((reg & 0xf8ff) != 0x30504d44) {
-		reg = 0;
+	if ((reg & 0xf0ff) != 0x30504d44) {
+		idx = 0;
 	} else {
-		reg = (reg >> 24) & 7;
+		idx = (reg >> 24) & 0xf;
 	}
 
 	static const char *cpu_vortex86_flavor[] = {
-	"??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX",
+	"??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX", "EX2",
 	};
+	idx = idx < __arraycount(cpu_vortex86_flavor) ? idx : 0;
 	snprintf(cpu_brand_string, sizeof(cpu_brand_string), "Vortex86%s",
-	cpu_vortex86_flavor[reg]);
+	cpu_vortex86_flavor[idx]);
 
 #undef PCI_MODE1_ENABLE
 #undef PCI_MODE1_ADDRESS_REG



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:37:04 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1718):

sys/arch/x86/x86/identcpu.c: revision 1.103
sys/arch/x86/x86/identcpu.c: revision 1.104
sys/arch/x86/x86/identcpu.c: revision 1.105

Add EX2 for Vortex86 SoCs (Andrius V)

use __arraycount, and fix comparison

flip the comparison again


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.9 -r1.55.2.10 src/sys/arch/x86/x86/identcpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 19:53:32 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1715:

sys/arch/x86/x86/procfs_machdep.c   1.40-1.42

- Add v_spec_ctrl, avx512_fp16, sme, sev, sev_es, sgx, sgx_lc,
  serialize and tsxldtrk.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.11 -r1.15.2.12 src/sys/arch/x86/x86/procfs_machdep.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/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.11 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.12
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.11	Mon Jul 20 18:40:08 2020
+++ src/sys/arch/x86/x86/procfs_machdep.c	Fri Dec  3 19:53:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.11 2020/07/20 18:40:08 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.12 2021/12/03 19:53:32 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.11 2020/07/20 18:40:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.12 2021/12/03 19:53:32 martin Exp $");
 
 #include 
 #include 
@@ -82,11 +82,13 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (3) Linux mapping */
-	"cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
-	"constant_tsc", NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	"cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", NULL, NULL, NULL, NULL,
+	"constant_tsc", "up", "art", "arch_perfmon",
+	"pebs", "bts", NULL, NULL,
+	"rep_good", NULL, NULL, "acc_power",
+	"nopl", NULL, "xtopology", "tsc_reliable",
+	"nonstop_tsc", "cpuid", "extd_apicid", "amd_dcm",
+	"aperfmperf", "rapl", "nonstop_tsc_s3", "tsc_known_freq"},
 
 	{ /* (4) Intel-defined: 0x0001 ecx */
 	"pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est",
@@ -112,7 +114,7 @@ static const char * const x86_features[]
 
 	{ /* (7) Linux mapping */
 	NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm",
-	"hw_pstate", "proc_feedback", "sme", NULL,
+	"hw_pstate", "proc_feedback", NULL, NULL,
 	NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL},
@@ -126,7 +128,7 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (9) Intel-defined: 0007 ebx */
-	"fsgsbase", "tsc_adjust", NULL, "bmi1", "hle", "avx2", NULL, "smep",
+	"fsgsbase", "tsc_adjust", "sgx", "bmi1", "hle", "avx2", NULL, "smep",
 	"bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", "rdt_a",
 	"avx512f", "avx512dq", "rdseed", "adx",
 	"smap", "avx512ifma", NULL, "clflushopt",
@@ -165,12 +167,12 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (15) 0x800a edx */
+	{ /* (15) AMD 0x800a edx */
 	"npt", "lbrv", "svm_lock", "nrip_save",
 	"tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
 	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
 	"v_vmsave_vmload",
-	"vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	"vgif", NULL, NULL, NULL, "v_spec_ctrl", NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
@@ -179,7 +181,7 @@ static const char * const x86_features[]
 	"gfni", "vaes", "vpclmulqdq", "avx512_vnni",
 	"avx512_bitalg", "tme", "avx512_vpopcntdq", NULL,
 	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
-	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, NULL, NULL},
+	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, "sgx_lc", NULL},
 
 	{ /* (17) 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
@@ -189,10 +191,16 @@ static const char * const x86_features[]
 
 	{ /* (18) Intel 0x0007 edx */
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL,
-	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, "pconfig", NULL, NULL, NULL, NULL, NULL,
+	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL,
+	"tsxldtrk", NULL, "pconfig", NULL, NULL, NULL, NULL, "avx512_fp16",
 	NULL, NULL, NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
+
+	{ /* (19) AMD 0x801f eax */
+	"sme", "sev", NULL, "sev_es", NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 };
 
 static int	procfs_getonecpu(int, struct cpu_info *, char *, size_t 

CVS commit: [netbsd-8] src/sys/arch/x86/x86

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 19:53:32 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1715:

sys/arch/x86/x86/procfs_machdep.c   1.40-1.42

- Add v_spec_ctrl, avx512_fp16, sme, sev, sev_es, sgx, sgx_lc,
  serialize and tsxldtrk.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.11 -r1.15.2.12 src/sys/arch/x86/x86/procfs_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:58:06 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: intr.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1437):

sys/arch/x86/x86/intr.c: revision 1.147

Fix a bug that evcnt_detach() called twice when the idt vector is full.

OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.101.2.6 -r1.101.2.7 src/sys/arch/x86/x86/intr.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/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.101.2.6 src/sys/arch/x86/x86/intr.c:1.101.2.7
--- src/sys/arch/x86/x86/intr.c:1.101.2.6	Sat Mar  9 17:10:19 2019
+++ src/sys/arch/x86/x86/intr.c	Thu Nov 14 15:58:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.101.2.6 2019/03/09 17:10:19 martin Exp $	*/
+/*	$NetBSD: intr.c,v 1.101.2.7 2019/11/14 15:58:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.6 2019/03/09 17:10:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.7 2019/11/14 15:58:06 martin Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -591,8 +591,10 @@ intr_free_io_intrsource_direct(struct in
 	SIMPLEQ_REMOVE(_interrupt_sources, isp, intrsource, is_list);
 
 	/* Is this interrupt established? */
-	if (isp->is_evname[0] != '\0')
+	if (isp->is_evname[0] != '\0') {
 		evcnt_detach(>is_evcnt);
+		isp->is_evname[0] = '\0';
+	}
 
 	kmem_free(isp->is_saved_evcnt,
 	sizeof(*(isp->is_saved_evcnt)) * ncpu);
@@ -782,6 +784,7 @@ intr_allocate_slot(struct pic *pic, int 
 	}
 	if (idtvec == 0) {
 		evcnt_detach(>ci_isources[slot]->is_evcnt);
+		ci->ci_isources[slot]->is_evname[0] = '\0';
 		ci->ci_isources[slot] = NULL;
 		return EBUSY;
 	}



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:58:06 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: intr.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1437):

sys/arch/x86/x86/intr.c: revision 1.147

Fix a bug that evcnt_detach() called twice when the idt vector is full.

OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.101.2.6 -r1.101.2.7 src/sys/arch/x86/x86/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2019-06-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun  2 08:29:30 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: spectre.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1279):

sys/arch/x86/x86/spectre.c: revision 1.29

Mmh, check the highest leaf before calling x86_cpuid(), otherwise on old
CPUs we might be getting garbage. While here fix a typo.

Likely fixes PR/54256.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/arch/x86/x86/spectre.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/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.19.2.3 src/sys/arch/x86/x86/spectre.c:1.19.2.4
--- src/sys/arch/x86/x86/spectre.c:1.19.2.3	Tue May 14 17:12:19 2019
+++ src/sys/arch/x86/x86/spectre.c	Sun Jun  2 08:29:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.19.2.3 2019/05/14 17:12:19 martin Exp $	*/
+/*	$NetBSD: spectre.c,v 1.19.2.4 2019/06/02 08:29:30 martin Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.19.2.3 2019/05/14 17:12:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.19.2.4 2019/06/02 08:29:30 martin Exp $");
 
 #include "opt_spectre.h"
 
@@ -552,6 +552,10 @@ mds_detect_method(void)
 		return;
 	}
 
+	if (cpuid_level < 7) {
+		return;
+	}
+
 	x86_cpuid(0x7, descs);
 	if (descs[3] & CPUID_SEF_ARCH_CAP) {
 		msr = rdmsr(MSR_IA32_ARCH_CAPABILITIES);
@@ -688,7 +692,7 @@ cpu_speculation_init(struct cpu_info *ci
 #endif
 
 	/*
-	 * Microarchectural Data Sampling.
+	 * Microarchitectural Data Sampling.
 	 *
 	 * cpu0 is the one that detects the method and sets the global
 	 * variable.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2019-06-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun  2 08:29:30 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: spectre.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1279):

sys/arch/x86/x86/spectre.c: revision 1.29

Mmh, check the highest leaf before calling x86_cpuid(), otherwise on old
CPUs we might be getting garbage. While here fix a typo.

Likely fixes PR/54256.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/arch/x86/x86/spectre.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2019-05-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 12 09:22:52 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1261):

sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.16
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.17

Invalidate the cache before updating the microcode. Some platforms require
this. Seen in Illumos and FreeBSD.

Clean up, and add sanity checks on the microcode lengths.


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/arch/x86/x86/cpu_ucode_intel.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_ucode_intel.c
diff -u src/sys/arch/x86/x86/cpu_ucode_intel.c:1.12.2.1 src/sys/arch/x86/x86/cpu_ucode_intel.c:1.12.2.2
--- src/sys/arch/x86/x86/cpu_ucode_intel.c:1.12.2.1	Thu Jul 26 21:02:29 2018
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c	Sun May 12 09:22:52 2019
@@ -1,10 +1,11 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.12.2.1 2018/07/26 21:02:29 snj Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.12.2.2 2019/05/12 09:22:52 martin Exp $ */
+
 /*
- * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * Copyright (c) 2012, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Matthias Drochner.
+ * by Matthias Drochner and Maxime Villard.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.12.2.1 2018/07/26 21:02:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.12.2.2 2019/05/12 09:22:52 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_cpu_ucode.h"
@@ -86,8 +87,8 @@ cpu_ucode_intel_firmware_open(firmware_h
 {
 	const char *fw_path = "cpu_x86_intel1";
 	uint32_t ucodeversion, cpu_signature;
-	int platformid;
 	char cpuspec[11];
+	int platformid;
 
 	if (fwname != NULL && fwname[0] != '\0')
 		return firmware_open(fw_path, fwname, fwh);
@@ -104,71 +105,68 @@ cpu_ucode_intel_firmware_open(firmware_h
 }
 
 #ifndef XEN
-/* Check header version and checksum */
 static int
-cpu_ucode_intel_verify(struct intel1_ucode_header *buf)
+cpu_ucode_intel_verify(struct cpu_ucode_softc *sc,
+struct intel1_ucode_header *buf)
 {
-	uint32_t data_size, total_size, payload_size, extended_table_size;
-#if 0 /* not yet */
-	struct intel1_ucode_ext_table *ext_table;
-	struct intel1_ucode_proc_signature *ext_psig;
-#endif
+	uint32_t data_size, total_size, payload_size, ext_size;
 	uint32_t sum;
 	int i;
-	
+
 	if ((buf->uh_header_ver != 1) || (buf->uh_loader_rev != 1))
 		return EINVAL;
 
-	/* Data size */
-	if (buf->uh_data_size == 0)
+	/*
+	 * Data size.
+	 */
+	if (buf->uh_data_size == 0) {
 		data_size = 2000;
-	else
+	} else {
 		data_size = buf->uh_data_size;
-
-	if ((data_size % 4) != 0) {
-		/* Wrong size */
-		return EINVAL;
 	}
+	if ((data_size % 4) != 0)
+		return EINVAL;
+	if (data_size > sc->sc_blobsize)
+		return EINVAL;
 
-	/* Total size */
-	if (buf->uh_total_size == 0)
+	/*
+	 * Total size.
+	 */
+	if (buf->uh_total_size == 0) {
 		total_size = data_size + 48;
-	else
+	} else {
 		total_size = buf->uh_total_size;
-
-	if ((total_size % 1024) != 0) {
-		/* Wrong size */
-		return EINVAL;
 	}
+	if ((total_size % 1024) != 0)
+		return EINVAL;
+	if (total_size > sc->sc_blobsize)
+		return EINVAL;
 
+	/*
+	 * Payload size.
+	 */
 	payload_size = data_size + 48;
-
-	/* Extended table size */
-	extended_table_size = total_size - payload_size;
+	if (payload_size > sc->sc_blobsize)
+		return EINVAL;
 
 	/*
-	 * Verify checksum of update data and header
-	 * (exclude extended signature).
+	 * Verify checksum of update data and header. Exclude extended
+	 * signature.
 	 */
 	sum = 0;
-	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++)
+	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) {
 		sum += *((uint32_t *)buf + i);
-	if (sum != 0) {
-		/* Checksum mismatch */
-		return EINVAL;
 	}
+	if (sum != 0)
+		return EINVAL;
 
-	if (extended_table_size == 0)
-		return 0;
-
-#if 0
-	/* Verify extended signature's checksum */
-	ext_table = (void *)buf + payload_size;
-	ext_psig = (void *)ext_table + sizeof(struct intel1_ucode_ext_table);
-	printf("ext_table = %p, extsig = %p\n", ext_table, ext_psig);
-#else
-	printf("This image has extended signature table.");
-#endif
+	/*
+	 * Extended table size. Ignored for now.
+	 */
+	ext_size = total_size - payload_size;
+	if (ext_size > 0) {
+		printf("This image has extended signature table.");
+	}
 
 	return 0;
 }
@@ -177,29 +175,28 @@ int
 cpu_ucode_intel_apply(struct cpu_ucode_softc *sc, int cpuno)
 {
 	uint32_t ucodetarget, oucodeversion, nucodeversion;
-	int platformid, cpuid;
 	struct intel1_ucode_header 

CVS commit: [netbsd-8] src/sys/arch/x86/x86

2019-05-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 12 09:22:52 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1261):

sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.16
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.17

Invalidate the cache before updating the microcode. Some platforms require
this. Seen in Illumos and FreeBSD.

Clean up, and add sanity checks on the microcode lengths.


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/arch/x86/x86/cpu_ucode_intel.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.