CVS commit: src/sys/arch/x86/include

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb  1 05:27:40 UTC 2022

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
s/shareing/sharing/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/arch/x86/include/specialreg.h

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/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.188 src/sys/arch/x86/include/specialreg.h:1.189
--- src/sys/arch/x86/include/specialreg.h:1.188	Sat Jan 29 08:18:22 2022
+++ src/sys/arch/x86/include/specialreg.h	Tue Feb  1 05:27:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.188 2022/01/29 08:18:22 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.189 2022/02/01 05:27:40 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -311,7 +311,7 @@
 #define CPUID_DCP_CACHELEVEL	__BITS(7, 5)	/* Cache level (start at 1) */
 #define CPUID_DCP_SELFINITCL	__BIT(8)	/* Self initializing cachelvl*/
 #define CPUID_DCP_FULLASSOC	__BIT(9)	/* Full associative */
-#define CPUID_DCP_SHAREING	__BITS(25, 14)	/* shareing */
+#define CPUID_DCP_SHARING	__BITS(25, 14)	/* sharing */
 #define CPUID_DCP_CORE_P_PKG	__BITS(31, 26)	/* Cores/package */
 
 /* %ebx */
@@ -648,7 +648,7 @@
 #define CPUID_DATP_TCTYPE_S	5		/*   Store only TLB */
 #define CPUID_DATP_TCLEVEL	__BITS(7, 5)	/* TLB level (start at 1) */
 #define CPUID_DATP_FULLASSOC	__BIT(8)	/* Full associative */
-#define CPUID_DATP_SHAREING	__BITS(25, 14)	/* shareing */
+#define CPUID_DATP_SHARING	__BITS(25, 14)	/* sharing */
 
 /*
  * Intel Hybrid Information Enumeration.



CVS commit: src/sys/arch/x86/include

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb  1 05:27:40 UTC 2022

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
s/shareing/sharing/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/arch/x86/include/specialreg.h

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



CVS commit: src/sys/dev/pci/ixgbe

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb  1 04:59:16 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
Increment legacy interrupt counter after checking INTx sharing.


To generate a diff of this commit:
cvs rdiff -u -r1.305 -r1.306 src/sys/dev/pci/ixgbe/ixgbe.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/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.305 src/sys/dev/pci/ixgbe/ixgbe.c:1.306
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.305	Tue Jan 25 01:56:22 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb  1 04:59:16 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.305 2022/01/25 01:56:22 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.306 2022/02/01 04:59:16 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.305 2022/01/25 01:56:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.306 2022/02/01 04:59:16 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5273,12 +5273,12 @@ ixgbe_legacy_irq(void *arg)
 	/* Read and clear EICR */
 	eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
 
-	IXGBE_EVC_ADD(>stats.pf.legint, 1);
 	if (eicr == 0) {
 		IXGBE_EVC_ADD(>stats.pf.intzero, 1);
 		IXGBE_WRITE_REG(hw, IXGBE_EIMS, eims_orig);
 		return 0;
 	}
+	IXGBE_EVC_ADD(>stats.pf.legint, 1);
 
 	/* Queue (0) intr */
 	if ((eicr & IXGBE_EIMC_RTX_QUEUE) != 0) {



CVS commit: src/sys/dev/pci/ixgbe

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb  1 04:59:16 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
Increment legacy interrupt counter after checking INTx sharing.


To generate a diff of this commit:
cvs rdiff -u -r1.305 -r1.306 src/sys/dev/pci/ixgbe/ixgbe.c

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



CVS commit: src/sys/dev/pci

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb  1 01:28:26 UTC 2022

Modified Files:
src/sys/dev/pci: pci_subr.c

Log Message:
Fix typo. Found by rillig. s/vendor specific/vendor-specific/


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/sys/dev/pci/pci_subr.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/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.241 src/sys/dev/pci/pci_subr.c:1.242
--- src/sys/dev/pci/pci_subr.c:1.241	Mon Jan 31 10:14:55 2022
+++ src/sys/dev/pci/pci_subr.c	Tue Feb  1 01:28:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.241 2022/01/31 10:14:55 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.242 2022/02/01 01:28:26 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.241 2022/01/31 10:14:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.242 2022/02/01 01:28:26 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -157,7 +157,7 @@ static const struct pci_class pci_subcla
 
 /* SCSI programming interface */
 static const struct pci_class pci_interface_scsi[] = {
-	{ "vendor specifi",	PCI_INTERFACE_SCSI_VND,		NULL,	},
+	{ "vendor-specific",	PCI_INTERFACE_SCSI_VND,		NULL,	},
 	{ "PQI storage",	PCI_INTERFACE_SCSI_PQI_STORAGE,	NULL,	},
 	{ "PQI controller",	PCI_INTERFACE_SCSI_PQI_CNTRL,	NULL,	},
 	{ "PQI storage and controller",	PCI_INTERFACE_SCSI_PQI_STORAGE_CNTRL,
@@ -175,7 +175,7 @@ static const struct pci_class pci_interf
 
 /* SATA programming interface */
 static const struct pci_class pci_interface_sata[] = {
-	{ "vendor specific",	PCI_INTERFACE_SATA_VND,		NULL,	},
+	{ "vendor-specific",	PCI_INTERFACE_SATA_VND,		NULL,	},
 	{ "AHCI 1.0",		PCI_INTERFACE_SATA_AHCI10,	NULL,	},
 	{ "Serial Storage Bus Interface", PCI_INTERFACE_SATA_SSBI, NULL, },
 	{ NULL,			0,NULL,	},
@@ -183,7 +183,7 @@ static const struct pci_class pci_interf
 
 /* Flash programming interface */
 static const struct pci_class pci_interface_nvm[] = {
-	{ "vendor specific",	PCI_INTERFACE_NVM_VND,		NULL,	},
+	{ "vendor-specific",	PCI_INTERFACE_NVM_VND,		NULL,	},
 	{ "NVMHCI 1.0",		PCI_INTERFACE_NVM_NVMHCI10,	NULL,	},
 	{ "NVMe I/O",		PCI_INTERFACE_NVM_NVME_IO,	NULL,	},
 	{ "NVMe admin",		PCI_INTERFACE_NVM_NVME_ADMIN,	NULL,	},
@@ -192,7 +192,7 @@ static const struct pci_class pci_interf
 
 /* UFS programming interface */
 static const struct pci_class pci_interface_ufs[] = {
-	{ "vendor specific",	PCI_INTERFACE_UFS_VND,		NULL,	},
+	{ "vendor-specific",	PCI_INTERFACE_UFS_VND,		NULL,	},
 	{ "UFSHCI",		PCI_INTERFACE_UFS_UFSHCI,	NULL,	},
 	{ NULL,			0,NULL,	},
 };
@@ -264,7 +264,7 @@ static const struct pci_class pci_subcla
 /* HD Audio programming interface */
 static const struct pci_class pci_interface_hda[] = {
 	{ "HD Audio 1.0",	PCI_INTERFACE_HDAUDIO,		NULL,	},
-	{ "HD Audio 1.0 + vendor ext",	PCI_INTERFACE_HDAUDIO_VND, NULL, },
+	{ "HD Audio 1.0 + vendor-ext",	PCI_INTERFACE_HDAUDIO_VND, NULL, },
 	{ NULL,			0,NULL,	},
 };
 



CVS commit: src/sys/dev/pci

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb  1 01:28:26 UTC 2022

Modified Files:
src/sys/dev/pci: pci_subr.c

Log Message:
Fix typo. Found by rillig. s/vendor specific/vendor-specific/


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/sys/dev/pci/pci_subr.c

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



CVS commit: src/usr.bin/make

2022-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 31 22:58:26 UTC 2022

Modified Files:
src/usr.bin/make: hash.h

Log Message:
make: remove redundant declaration of HashIter_Init

Since hash.h 1.41 from 2021-12-07.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/hash.h

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

Modified files:

Index: src/usr.bin/make/hash.h
diff -u src/usr.bin/make/hash.h:1.45 src/usr.bin/make/hash.h:1.46
--- src/usr.bin/make/hash.h:1.45	Wed Dec 15 12:58:01 2021
+++ src/usr.bin/make/hash.h	Mon Jan 31 22:58:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.h,v 1.45 2021/12/15 12:58:01 rillig Exp $	*/
+/*	$NetBSD: hash.h,v 1.46 2022/01/31 22:58:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -141,7 +141,6 @@ void HashTable_Set(HashTable *, const ch
 void HashTable_DeleteEntry(HashTable *, HashEntry *);
 void HashTable_DebugStats(HashTable *, const char *);
 
-void HashIter_Init(HashIter *, HashTable *);
 HashEntry *HashIter_Next(HashIter *);
 
 MAKE_INLINE void



CVS commit: src/usr.bin/make

2022-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 31 22:58:26 UTC 2022

Modified Files:
src/usr.bin/make: hash.h

Log Message:
make: remove redundant declaration of HashIter_Init

Since hash.h 1.41 from 2021-12-07.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/hash.h

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



CVS commit: src/usr.bin/make

2022-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 31 20:49:28 UTC 2022

Modified Files:
src/usr.bin/make: make.h

Log Message:
make: make DEBUG0 simpler

All arguments to DEBUG0 are string literals, and none of them contains a
'%', which makes them safe to pass to printf directly.  Any accidental
'%' would be caught by the compiler.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/usr.bin/make/make.h

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.295 src/usr.bin/make/make.h:1.296
--- src/usr.bin/make/make.h:1.295	Sun Jan 30 13:21:08 2022
+++ src/usr.bin/make/make.h	Mon Jan 31 20:49:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.295 2022/01/30 13:21:08 christos Exp $	*/
+/*	$NetBSD: make.h,v 1.296 2022/01/31 20:49:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -642,8 +642,8 @@ void debug_printf(const char *, ...) MAK
 			debug_printf args; \
 	} while (false)
 
-#define DEBUG0(module, text) \
-	DEBUG_IMPL(module, ("%s", text))
+#define DEBUG0(module, fmt) \
+	DEBUG_IMPL(module, (fmt))
 #define DEBUG1(module, fmt, arg1) \
 	DEBUG_IMPL(module, (fmt, arg1))
 #define DEBUG2(module, fmt, arg1, arg2) \



CVS commit: src/usr.bin/make

2022-01-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 31 20:49:28 UTC 2022

Modified Files:
src/usr.bin/make: make.h

Log Message:
make: make DEBUG0 simpler

All arguments to DEBUG0 are string literals, and none of them contains a
'%', which makes them safe to pass to printf directly.  Any accidental
'%' would be caught by the compiler.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/usr.bin/make/make.h

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



CVS commit: src/bin/sh

2022-01-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 31 18:15:45 UTC 2022

Modified Files:
src/bin/sh: histedit.c

Log Message:
When we initialize libedit (editline) always call ourselves "sh" no
matter what $0 is (or is not) set to.   This means that editrc(5)
lines that start "sh:" are used (in addition to those with no prefix,
which will usually be most of them), regardless of the name or manner in
which we were invoked.

OK christos@


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/bin/sh/histedit.c

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

Modified files:

Index: src/bin/sh/histedit.c
diff -u src/bin/sh/histedit.c:1.58 src/bin/sh/histedit.c:1.59
--- src/bin/sh/histedit.c:1.58	Mon Jan 31 16:54:28 2022
+++ src/bin/sh/histedit.c	Mon Jan 31 18:15:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: histedit.c,v 1.58 2022/01/31 16:54:28 kre Exp $	*/
+/*	$NetBSD: histedit.c,v 1.59 2022/01/31 18:15:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)histedit.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: histedit.c,v 1.58 2022/01/31 16:54:28 kre Exp $");
+__RCSID("$NetBSD: histedit.c,v 1.59 2022/01/31 18:15:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -115,7 +115,7 @@ histedit(void)
 			/*
 			 * turn editing on
 			 */
-			char *term, *shname;
+			char *term;
 
 			INTOFF;
 			if (el_in == NULL)
@@ -151,10 +151,7 @@ histedit(void)
 setenv("TERM", term, 1);
 			else
 unsetenv("TERM");
-			shname = arg0;
-			if (shname[0] == '-')
-shname++;
-			el = el_init(shname, el_in, el_out, el_err);
+			el = el_init("sh", el_in, el_out, el_err);
 			if (el != NULL) {
 if (hist)
 	el_set(el, EL_HIST, history, hist);



CVS commit: src/bin/sh

2022-01-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 31 18:15:45 UTC 2022

Modified Files:
src/bin/sh: histedit.c

Log Message:
When we initialize libedit (editline) always call ourselves "sh" no
matter what $0 is (or is not) set to.   This means that editrc(5)
lines that start "sh:" are used (in addition to those with no prefix,
which will usually be most of them), regardless of the name or manner in
which we were invoked.

OK christos@


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/bin/sh/histedit.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/doc

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

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Tickets #1730 - #1733


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.118 -r1.1.2.119 src/doc/CHANGES-8.3

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



CVS commit: [netbsd-8] src/doc

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

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Tickets #1730 - #1733


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.118 -r1.1.2.119 src/doc/CHANGES-8.3

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.118 src/doc/CHANGES-8.3:1.1.2.119
--- src/doc/CHANGES-8.3:1.1.2.118	Sun Jan 30 16:08:14 2022
+++ src/doc/CHANGES-8.3	Mon Jan 31 17:59:40 2022
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.118 2022/01/30 16:08:14 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.119 2022/01/31 17:59:40 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -2479,3 +2479,50 @@ sys/dev/pci/ixgbe/ixv.c1.170, 1.174-
 	- Whitespace fix.
 	[msaitoh, ticket #1729]
 
+sys/dev/pci/ixgbe/if_sriov.c			1.17
+sys/dev/pci/ixgbe/ixgbe.c			1.301
+sys/dev/pci/ixgbe/ixgbe_82599.c			1.29
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.16
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.17
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.18
+sys/dev/pci/ixgbe/ixgbe_mbx.h			1.19
+sys/dev/pci/ixgbe/ixgbe_type.h			1.55
+sys/dev/pci/ixgbe/ixgbe_vf.c			1.31
+sys/dev/pci/ixgbe/ixgbe_x540.c			1.23
+sys/dev/pci/ixgbe/ixv.c1.172
+sys/dev/pci/ixgbe/ixv.c1.173
+
+	Add code to support mailbox API 1.5.
+	[msaitoh, ticket #1730]
+
+sys/arch/x86/include/specialreg.h		1.179-1.188 (patch)
+
+	- Add CPUID definitions of Last Branch Record, Thread Director,
+	  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
+	  LBR, Linear Address Masking and Hybrid Information from the latest
+	  Intel SDM.
+	- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
+	  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
+	- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
+	  say so.
+	- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
+	  No functional change.
+	[msaitoh, ticket #1731]
+
+usr.sbin/cpuctl/arch/i386.c			1.125-1.127
+
+	- Add Alder Lake, Rocket Lake and Sapphire Rapids.
+	- Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).
+	- Remove debug code and simplify. No functional change.
+	[msaitoh, ticket #1732]
+
+sys/arch/x86/x86/procfs_machdep.c		1.43-1.44
+
+	- The CPUID table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux
+	  mapping.
+	- The CPUID table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID
+	  0x07 leaf 1 %eax. Print avx_vnni and avx512_bf16.
+	- Print cppc, enqcmd and arch_lbr.
+	- Modify linux mapping. Not used on NetBSD.
+	[msaitoh, ticket #1733]
+



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-9] src/doc

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

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Tickets #1415 - #1419


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.69 -r1.1.2.70 src/doc/CHANGES-9.3

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



CVS commit: [netbsd-9] src/doc

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

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Tickets #1415 - #1419


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.69 -r1.1.2.70 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.69 src/doc/CHANGES-9.3:1.1.2.70
--- src/doc/CHANGES-9.3:1.1.2.69	Sun Jan 30 16:03:50 2022
+++ src/doc/CHANGES-9.3	Mon Jan 31 17:56:28 2022
@@ -1,4 +1,4 @@
-29~# $NetBSD: CHANGES-9.3,v 1.1.2.69 2022/01/30 16:03:50 martin Exp $
+29~# $NetBSD: CHANGES-9.3,v 1.1.2.70 2022/01/31 17:56:28 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -1330,3 +1330,55 @@ sys/dev/pci/ixgbe/ixv.c1.170, 1.174-
 	- Whitespace fix.
 	[msaitoh, ticket #1414]
 
+sys/dev/usb/usbnet.c1.44 (patch)
+
+	usbnet(9): defer hardware multicast filter updates to USB task.
+	[riastradh, ticket #1415]
+
+sys/dev/pci/ixgbe/if_sriov.c			1.17
+sys/dev/pci/ixgbe/ixgbe.c			1.301
+sys/dev/pci/ixgbe/ixgbe_82599.c			1.29
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.16
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.17
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.18
+sys/dev/pci/ixgbe/ixgbe_mbx.h			1.19
+sys/dev/pci/ixgbe/ixgbe_type.h			1.55
+sys/dev/pci/ixgbe/ixgbe_vf.c			1.31
+sys/dev/pci/ixgbe/ixgbe_x540.c			1.23
+sys/dev/pci/ixgbe/ixv.c1.172
+sys/dev/pci/ixgbe/ixv.c1.173
+
+	Add code to support mailbox API 1.5.
+	[msaitoh, ticket #1416]
+
+sys/arch/x86/include/specialreg.h		1.179-1.188 (patch)
+
+	- Add CPUID definitions of Last Branch Record, Thread Director,
+	  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
+	  LBR, Linear Address Masking and Hybrid Information from the latest
+	  Intel SDM.
+	- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
+	  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
+	- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
+	  say so.
+	- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
+	  No functional change.
+	[msaitoh, ticket #1417]
+
+usr.sbin/cpuctl/arch/i386.c			1.125-1.127
+
+	- Add Alder Lake, Rocket Lake and Sapphire Rapids.
+	- Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).
+	- Remove debug code and simplify. No functional change.
+	[msaitoh, ticket #1418]
+
+sys/arch/x86/x86/procfs_machdep.c		1.43-1.44
+
+	- The CPUID table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux
+	  mapping.
+	- The CPUID table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID
+	  0x07 leaf 1 %eax. Print avx_vnni and avx512_bf16.
+	- Print cppc, enqcmd and arch_lbr.
+	- Modify linux mapping. Not used on NetBSD.
+	[msaitoh, ticket #1419]
+



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

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

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

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

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.33.2.4 -r1.33.2.5 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.33.2.4 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.5
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.4	Fri Dec  3 19:49:35 2021
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jan 31 17:54:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 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], x86_features[12], p 

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

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

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

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

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.33.2.4 -r1.33.2.5 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/usr.sbin/cpuctl/arch

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

Modified Files:
src/usr.sbin/cpuctl/arch [netbsd-8]: i386.c

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

usr.sbin/cpuctl/arch/i386.c: revision 1.125
usr.sbin/cpuctl/arch/i386.c: revision 1.126
usr.sbin/cpuctl/arch/i386.c: revision 1.127

Add Alder Lake, Rocket Lake and Sapphire Rapids. From the latest Intel SDM.
Remove debug code and simplify. No functional change.
Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.74.6.13 -r1.74.6.14 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/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.74.6.13 src/usr.sbin/cpuctl/arch/i386.c:1.74.6.14
--- src/usr.sbin/cpuctl/arch/i386.c:1.74.6.13	Fri Dec 24 13:02:24 2021
+++ src/usr.sbin/cpuctl/arch/i386.c	Mon Jan 31 17:52:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.74.6.13 2021/12/24 13:02:24 martin Exp $	*/
+/*	$NetBSD: i386.c,v 1.74.6.14 2022/01/31 17:52:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.74.6.13 2021/12/24 13:02:24 martin Exp $");
+__RCSID("$NetBSD: i386.c,v 1.74.6.14 2022/01/31 17:52:44 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -351,11 +351,17 @@ const struct cpu_cpuid_nameclass i386_cp
 [0x8c] = "11th gen Core (Tiger Lake)",
 [0x8d] = "11th gen Core (Tiger Lake)",
 [0x8e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)",
+[0x8f] = "future Xeon (Sapphire Rapids)",
 [0x96] = "Atom x6000E (Elkhart Lake)",
+[0x97] = "12th gen Core (Alder Lake)",
+[0x9a] = "12th gen Core (Alder Lake)",
 [0x9c] = "Pentium Silver N6xxx, Celeron N45xx, Celeron N51xx (Jasper Lake)",
 [0x9e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)",
 [0xa5] = "10th gen Core (Comet Lake)",
 [0xa6] = "10th gen Core (Comet Lake)",
+[0xa7] = "11th gen Core (Rocket Lake)",
+[0xa8] = "11th gen Core (Rocket Lake)",
+[0xbf] = "12th gen Core (Alder Lake)",
 			},
 			"Pentium Pro, II or III",	/* Default */
 			NULL,
@@ -2164,31 +2170,25 @@ identifycpu(int fd, const char *cpuname)
 			CPUID_AMD_ENCMEM_FLAGS, descs[0]);
 		}
 	} else if (cpu_vendor == CPUVENDOR_INTEL) {
-		int32_t bi_index;
-
-		for (bi_index = 1; bi_index <= ci->ci_max_cpuid; bi_index++) {
-			x86_cpuid(bi_index, descs);
-			switch (bi_index) {
-			case 0x0a:
-print_bits(cpuname, "Perfmon-eax",
-CPUID_PERF_FLAGS0, descs[0]);
-print_bits(cpuname, "Perfmon-ebx",
-CPUID_PERF_FLAGS1, descs[1]);
-print_bits(cpuname, "Perfmon-edx",
-CPUID_PERF_FLAGS3, descs[3]);
-break;
-			default:
-#if 0
-aprint_verbose("%s: basic %08x-eax %08x\n",
-cpuname, bi_index, descs[0]);
-aprint_verbose("%s: basic %08x-ebx %08x\n",
-cpuname, bi_index, descs[1]);
-aprint_verbose("%s: basic %08x-ecx %08x\n",
-cpuname, bi_index, descs[2]);
-aprint_verbose("%s: basic %08x-edx %08x\n",
-cpuname, bi_index, descs[3]);
-#endif
-break;
+		if (ci->ci_max_cpuid >= 0x0a) {
+			x86_cpuid(0x0a, descs);
+			print_bits(cpuname, "Perfmon-eax",
+			CPUID_PERF_FLAGS0, descs[0]);
+			print_bits(cpuname, "Perfmon-ebx",
+			CPUID_PERF_FLAGS1, descs[1]);
+			print_bits(cpuname, "Perfmon-edx",
+			CPUID_PERF_FLAGS3, descs[3]);
+		}
+		if (ci->ci_max_cpuid >= 0x1a) {
+			x86_cpuid(0x1a, descs);
+			if (descs[0] != 0) {
+aprint_verbose("%s: Hybrid: Core type %02x, "
+"Native Model ID %07x\n",
+cpuname,
+(uint8_t)__SHIFTOUT(descs[0],
+	CPUID_HYBRID_CORETYPE),
+(uint32_t)__SHIFTOUT(descs[0],
+	CPUID_HYBRID_NATIVEID));
 			}
 		}
 	}



CVS commit: [netbsd-8] src/usr.sbin/cpuctl/arch

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

Modified Files:
src/usr.sbin/cpuctl/arch [netbsd-8]: i386.c

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

usr.sbin/cpuctl/arch/i386.c: revision 1.125
usr.sbin/cpuctl/arch/i386.c: revision 1.126
usr.sbin/cpuctl/arch/i386.c: revision 1.127

Add Alder Lake, Rocket Lake and Sapphire Rapids. From the latest Intel SDM.
Remove debug code and simplify. No functional change.
Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.74.6.13 -r1.74.6.14 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.



CVS commit: [netbsd-9] src/usr.sbin/cpuctl/arch

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

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

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

usr.sbin/cpuctl/arch/i386.c: revision 1.125
usr.sbin/cpuctl/arch/i386.c: revision 1.126
usr.sbin/cpuctl/arch/i386.c: revision 1.127

Add Alder Lake, Rocket Lake and Sapphire Rapids. From the latest Intel SDM.
Remove debug code and simplify. No functional change.
Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.104.2.9 -r1.104.2.10 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.



CVS commit: [netbsd-9] src/usr.sbin/cpuctl/arch

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

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

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

usr.sbin/cpuctl/arch/i386.c: revision 1.125
usr.sbin/cpuctl/arch/i386.c: revision 1.126
usr.sbin/cpuctl/arch/i386.c: revision 1.127

Add Alder Lake, Rocket Lake and Sapphire Rapids. From the latest Intel SDM.
Remove debug code and simplify. No functional change.
Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.104.2.9 -r1.104.2.10 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/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.104.2.9 src/usr.sbin/cpuctl/arch/i386.c:1.104.2.10
--- src/usr.sbin/cpuctl/arch/i386.c:1.104.2.9	Fri Dec 24 12:58:14 2021
+++ src/usr.sbin/cpuctl/arch/i386.c	Mon Jan 31 17:51:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.104.2.9 2021/12/24 12:58:14 martin Exp $	*/
+/*	$NetBSD: i386.c,v 1.104.2.10 2022/01/31 17:51:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.104.2.9 2021/12/24 12:58:14 martin Exp $");
+__RCSID("$NetBSD: i386.c,v 1.104.2.10 2022/01/31 17:51:00 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -351,11 +351,17 @@ const struct cpu_cpuid_nameclass i386_cp
 [0x8c] = "11th gen Core (Tiger Lake)",
 [0x8d] = "11th gen Core (Tiger Lake)",
 [0x8e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)",
+[0x8f] = "future Xeon (Sapphire Rapids)",
 [0x96] = "Atom x6000E (Elkhart Lake)",
+[0x97] = "12th gen Core (Alder Lake)",
+[0x9a] = "12th gen Core (Alder Lake)",
 [0x9c] = "Pentium Silver N6xxx, Celeron N45xx, Celeron N51xx (Jasper Lake)",
 [0x9e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)",
 [0xa5] = "10th gen Core (Comet Lake)",
 [0xa6] = "10th gen Core (Comet Lake)",
+[0xa7] = "11th gen Core (Rocket Lake)",
+[0xa8] = "11th gen Core (Rocket Lake)",
+[0xbf] = "12th gen Core (Alder Lake)",
 			},
 			"Pentium Pro, II or III",	/* Default */
 			NULL,
@@ -2238,31 +2244,25 @@ identifycpu(int fd, const char *cpuname)
 			CPUID_AMD_ENCMEM_FLAGS, descs[0]);
 		}
 	} else if (cpu_vendor == CPUVENDOR_INTEL) {
-		int32_t bi_index;
-
-		for (bi_index = 1; bi_index <= ci->ci_max_cpuid; bi_index++) {
-			x86_cpuid(bi_index, descs);
-			switch (bi_index) {
-			case 0x0a:
-print_bits(cpuname, "Perfmon-eax",
-CPUID_PERF_FLAGS0, descs[0]);
-print_bits(cpuname, "Perfmon-ebx",
-CPUID_PERF_FLAGS1, descs[1]);
-print_bits(cpuname, "Perfmon-edx",
-CPUID_PERF_FLAGS3, descs[3]);
-break;
-			default:
-#if 0
-aprint_verbose("%s: basic %08x-eax %08x\n",
-cpuname, bi_index, descs[0]);
-aprint_verbose("%s: basic %08x-ebx %08x\n",
-cpuname, bi_index, descs[1]);
-aprint_verbose("%s: basic %08x-ecx %08x\n",
-cpuname, bi_index, descs[2]);
-aprint_verbose("%s: basic %08x-edx %08x\n",
-cpuname, bi_index, descs[3]);
-#endif
-break;
+		if (ci->ci_max_cpuid >= 0x0a) {
+			x86_cpuid(0x0a, descs);
+			print_bits(cpuname, "Perfmon-eax",
+			CPUID_PERF_FLAGS0, descs[0]);
+			print_bits(cpuname, "Perfmon-ebx",
+			CPUID_PERF_FLAGS1, descs[1]);
+			print_bits(cpuname, "Perfmon-edx",
+			CPUID_PERF_FLAGS3, descs[3]);
+		}
+		if (ci->ci_max_cpuid >= 0x1a) {
+			x86_cpuid(0x1a, descs);
+			if (descs[0] != 0) {
+aprint_verbose("%s: Hybrid: Core type %02x, "
+"Native Model ID %07x\n",
+cpuname,
+(uint8_t)__SHIFTOUT(descs[0],
+	CPUID_HYBRID_CORETYPE),
+(uint32_t)__SHIFTOUT(descs[0],
+	CPUID_HYBRID_NATIVEID));
 			}
 		}
 	}



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

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

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h

Log Message:
Pull up the following revisions (all via patch), requested by
msaitoh in ticket #1731:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.22 -r1.98.2.23 src/sys/arch/x86/include/specialreg.h

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/include

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

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h

Log Message:
Pull up the following revisions (all via patch), requested by
msaitoh in ticket #1731:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.22 -r1.98.2.23 src/sys/arch/x86/include/specialreg.h

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/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.22 src/sys/arch/x86/include/specialreg.h:1.98.2.23
--- src/sys/arch/x86/include/specialreg.h:1.98.2.22	Wed Dec  8 15:56:17 2021
+++ src/sys/arch/x86/include/specialreg.h	Mon Jan 31 17:46:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.22 2021/12/08 15:56:17 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.23 2022/01/31 17:46:36 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -90,29 +90,29 @@
 /*
  * CR4
  */
-#define CR4_VME		0x0001 /* virtual 8086 mode extension enable */
-#define CR4_PVI		0x0002 /* protected mode virtual interrupt enable */
-#define CR4_TSD		0x0004 /* restrict RDTSC instruction to cpl 0 */
-#define CR4_DE		0x0008 /* debugging extension */
-#define CR4_PSE		0x0010 /* large (4MB) page size enable */
-#define CR4_PAE		0x0020 /* physical address extension enable */
-#define CR4_MCE		0x0040 /* machine check enable */
-#define CR4_PGE		0x0080 /* page global enable */
-#define CR4_PCE		0x0100 /* enable RDPMC instruction for all cpls */
-#define CR4_OSFXSR	0x0200 /* enable fxsave/fxrestor and SSE */
-#define CR4_OSXMMEXCPT	0x0400 /* enable unmasked SSE exceptions */
-#define CR4_UMIP	0x0800 /* user-mode instruction prevention */
+#define CR4_VME		0x0001 /* Virtual 8086 mode extension enable */
+#define CR4_PVI		0x0002 /* Protected mode virtual interrupt enable */
+#define CR4_TSD		0x0004 /* Restrict RDTSC instruction to cpl 0 */
+#define CR4_DE		0x0008 /* Debugging extension */
+#define CR4_PSE		0x0010 /* Large (4MB) page size enable */
+#define CR4_PAE		0x0020 /* Physical address extension enable */
+#define CR4_MCE		0x0040 /* Machine check enable */
+#define CR4_PGE		0x0080 /* Page global enable */
+#define CR4_PCE		0x0100 /* Enable RDPMC instruction for all cpls */
+#define CR4_OSFXSR	0x0200 /* Enable fxsave/fxrestor and SSE */
+#define CR4_OSXMMEXCPT	0x0400 /* Enable unmasked SSE exceptions */
+#define CR4_UMIP	0x0800 /* User Mode Instruction Prevention */
 #define CR4_LA57	0x1000 /* 57-bit linear addresses */
-#define CR4_VMXE	0x2000 /* enable VMX operations */
-#define CR4_SMXE	0x4000 /* enable SMX operations */
-#define CR4_FSGSBASE	0x0001 /* enable *FSBASE and *GSBASE instructions */
-#define CR4_PCIDE	0x0002 /* enable Process Context IDentifiers */
-#define CR4_OSXSAVE	0x0004 /* enable xsave and xrestore */
-#define CR4_SMEP	0x0010 /* enable SMEP support */
-#define CR4_SMAP	0x0020 /* enable SMAP support */
-#define CR4_PKE		0x0040 /* enable Protection Keys for user pages */
-#define CR4_CET		0x0080 /* enable CET */
-#define CR4_PKS		0x0100 /* enable Protection Keys for kern pages */
+#define CR4_VMXE	0x2000 /* Enable VMX operations */
+#define CR4_SMXE	0x4000 /* Enable SMX operations */
+#define CR4_FSGSBASE	0x0001 /* Enable *FSBASE and *GSBASE instructions */
+#define CR4_PCIDE	0x0002 /* Enable Process Context IDentifiers */
+#define CR4_OSXSAVE	0x0004 /* Enable xsave and xrestore */
+#define CR4_SMEP	0x0010 /* Enable SMEP support */
+#define CR4_SMAP	0x0020 /* Enable SMAP support */
+#define CR4_PKE		0x0040 /* Enable Protection Keys for user pages */
+#define CR4_CET		0x0080 /* Enable CET */
+#define CR4_PKS		0x0100 /* Enable Protection Keys for kern pages */
 
 /*
  * Extended Control Register XCR0
@@ -130,14 +130,15 @@
 #define XCR0_CET_U	0x0800	/* User CET state */
 #define XCR0_CET_S	0x1000	/* Kern CET state */
 #define XCR0_HDC	0x2000	/* Hardware Duty Cycle state */
+#define XCR0_LBR	0x8000	/* Last Branch Record */
 #define XCR0_HWP	0x0001	/* Hardware P-states */
 
-#define XCR0_FLAGS1	"\20" \
-	"\1" "x87"		"\2" "SSE"		"\3" "AVX"	\
-	"\4" "BNDREGS"		"\5" "BNDCSR"		"\6" 

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

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

Modified Files:
src/sys/arch/x86/include [netbsd-9]: specialreg.h

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1417:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.9 -r1.150.2.10 src/sys/arch/x86/include/specialreg.h

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/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.9 src/sys/arch/x86/include/specialreg.h:1.150.2.10
--- src/sys/arch/x86/include/specialreg.h:1.150.2.9	Wed Dec  8 15:44:16 2021
+++ src/sys/arch/x86/include/specialreg.h	Mon Jan 31 17:42:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.9 2021/12/08 15:44:16 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.10 2022/01/31 17:42:17 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -97,29 +97,29 @@
 /*
  * CR4
  */
-#define CR4_VME		0x0001 /* virtual 8086 mode extension enable */
-#define CR4_PVI		0x0002 /* protected mode virtual interrupt enable */
-#define CR4_TSD		0x0004 /* restrict RDTSC instruction to cpl 0 */
-#define CR4_DE		0x0008 /* debugging extension */
-#define CR4_PSE		0x0010 /* large (4MB) page size enable */
-#define CR4_PAE		0x0020 /* physical address extension enable */
-#define CR4_MCE		0x0040 /* machine check enable */
-#define CR4_PGE		0x0080 /* page global enable */
-#define CR4_PCE		0x0100 /* enable RDPMC instruction for all cpls */
-#define CR4_OSFXSR	0x0200 /* enable fxsave/fxrestor and SSE */
-#define CR4_OSXMMEXCPT	0x0400 /* enable unmasked SSE exceptions */
-#define CR4_UMIP	0x0800 /* user-mode instruction prevention */
+#define CR4_VME		0x0001 /* Virtual 8086 mode extension enable */
+#define CR4_PVI		0x0002 /* Protected mode virtual interrupt enable */
+#define CR4_TSD		0x0004 /* Restrict RDTSC instruction to cpl 0 */
+#define CR4_DE		0x0008 /* Debugging extension */
+#define CR4_PSE		0x0010 /* Large (4MB) page size enable */
+#define CR4_PAE		0x0020 /* Physical address extension enable */
+#define CR4_MCE		0x0040 /* Machine check enable */
+#define CR4_PGE		0x0080 /* Page global enable */
+#define CR4_PCE		0x0100 /* Enable RDPMC instruction for all cpls */
+#define CR4_OSFXSR	0x0200 /* Enable fxsave/fxrestor and SSE */
+#define CR4_OSXMMEXCPT	0x0400 /* Enable unmasked SSE exceptions */
+#define CR4_UMIP	0x0800 /* User Mode Instruction Prevention */
 #define CR4_LA57	0x1000 /* 57-bit linear addresses */
-#define CR4_VMXE	0x2000 /* enable VMX operations */
-#define CR4_SMXE	0x4000 /* enable SMX operations */
-#define CR4_FSGSBASE	0x0001 /* enable *FSBASE and *GSBASE instructions */
-#define CR4_PCIDE	0x0002 /* enable Process Context IDentifiers */
-#define CR4_OSXSAVE	0x0004 /* enable xsave and xrestore */
-#define CR4_SMEP	0x0010 /* enable SMEP support */
-#define CR4_SMAP	0x0020 /* enable SMAP support */
-#define CR4_PKE		0x0040 /* enable Protection Keys for user pages */
-#define CR4_CET		0x0080 /* enable CET */
-#define CR4_PKS		0x0100 /* enable Protection Keys for kern pages */
+#define CR4_VMXE	0x2000 /* Enable VMX operations */
+#define CR4_SMXE	0x4000 /* Enable SMX operations */
+#define CR4_FSGSBASE	0x0001 /* Enable *FSBASE and *GSBASE instructions */
+#define CR4_PCIDE	0x0002 /* Enable Process Context IDentifiers */
+#define CR4_OSXSAVE	0x0004 /* Enable xsave and xrestore */
+#define CR4_SMEP	0x0010 /* Enable SMEP support */
+#define CR4_SMAP	0x0020 /* Enable SMAP support */
+#define CR4_PKE		0x0040 /* Enable Protection Keys for user pages */
+#define CR4_CET		0x0080 /* Enable CET */
+#define CR4_PKS		0x0100 /* Enable Protection Keys for kern pages */
 
 /*
  * Extended Control Register XCR0
@@ -137,14 +137,15 @@
 #define XCR0_CET_U	0x0800	/* User CET state */
 #define XCR0_CET_S	0x1000	/* Kern CET state */
 #define XCR0_HDC	0x2000	/* Hardware Duty Cycle state */
+#define XCR0_LBR	0x8000	/* Last Branch Record */
 #define XCR0_HWP	0x0001	/* Hardware P-states */
 
-#define XCR0_FLAGS1	"\20" \
-	"\1" "x87"		"\2" "SSE"		"\3" "AVX"	\
-	"\4" "BNDREGS"		"\5" "BNDCSR"		

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

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

Modified Files:
src/sys/arch/x86/include [netbsd-9]: specialreg.h

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1417:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.9 -r1.150.2.10 src/sys/arch/x86/include/specialreg.h

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/dev/pci/ixgbe

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

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_sriov.c ixgbe.c ixgbe_82599.c
ixgbe_mbx.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.7 -r1.1.4.8 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.47 -r1.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.14.8.8 -r1.14.8.9 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.6.8.5 -r1.6.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.10.8.4 -r1.10.8.5 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.15 -r1.22.2.16 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.8 -r1.12.8.9 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.9.6.7 -r1.9.6.8 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.56.2.35 -r1.56.2.36 src/sys/dev/pci/ixgbe/ixv.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/dev/pci/ixgbe

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

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_sriov.c ixgbe.c ixgbe_82599.c
ixgbe_mbx.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.7 -r1.1.4.8 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.47 -r1.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.14.8.8 -r1.14.8.9 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.6.8.5 -r1.6.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.10.8.4 -r1.10.8.5 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.15 -r1.22.2.16 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.8 -r1.12.8.9 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.9.6.7 -r1.9.6.8 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.56.2.35 -r1.56.2.36 src/sys/dev/pci/ixgbe/ixv.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/dev/pci/ixgbe/if_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.7 src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.8
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.7	Sun Jan 30 16:06:35 2022
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Mon Jan 31 17:38:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sriov.c,v 1.1.4.7 2022/01/30 16:06:35 martin Exp $ */
+/* $NetBSD: if_sriov.c,v 1.1.4.8 2022/01/31 17:38:36 martin Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -34,7 +34,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.1.4.7 2022/01/30 16:06:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.1.4.8 2022/01/31 17:38:36 martin Exp $");
 
 #include "ixgbe.h"
 #include "ixgbe_sriov.h"
@@ -99,7 +99,7 @@ ixgbe_send_vf_msg(struct ixgbe_hw *hw, s
 	if (vf->flags & IXGBE_VF_CTS)
 		msg |= IXGBE_VT_MSGTYPE_CTS;
 
-	hw->mbx.ops.write(hw, , 1, vf->pool);
+	hw->mbx.ops[vf->pool].write(hw, , 1, vf->pool);
 }
 
 static inline void
@@ -594,7 +594,8 @@ ixgbe_process_vf_msg(struct adapter *ada
 
 	hw = >hw;
 
-	error = hw->mbx.ops.read(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool);
+	error = hw->mbx.ops[vf->pool].read(hw, msg, IXGBE_VFMAILBOX_SIZE,
+	vf->pool);
 
 	if (error != 0)
 		return;
@@ -654,16 +655,17 @@ ixgbe_handle_mbx(void *context)
 	for (i = 0; i < adapter->num_vfs; i++) {
 		vf = >vfs[i];
 
-		if (vf->flags & IXGBE_VF_ACTIVE) {
-			if (hw->mbx.ops.check_for_rst(hw, vf->pool) == 0)
-ixgbe_process_vf_reset(adapter, vf);
-
-			if (hw->mbx.ops.check_for_msg(hw, vf->pool) == 0)
-ixgbe_process_vf_msg(adapter, vf);
-
-			if (hw->mbx.ops.check_for_ack(hw, vf->pool) == 0)
-ixgbe_process_vf_ack(adapter, vf);
-		}
+		if ((vf->flags & IXGBE_VF_ACTIVE) == 0)
+			continue;
+
+		if (hw->mbx.ops[vf->pool].check_for_rst(hw, vf->pool) == 0)
+			ixgbe_process_vf_reset(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_msg(hw, vf->pool) == 0)
+			ixgbe_process_vf_msg(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_ack(hw, vf->pool) == 0)
+			ixgbe_process_vf_ack(adapter, vf);
 	}
 	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mbx */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.47 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.48
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.47	Sun Jan 30 16:06:35 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 31 17:38:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.47 2022/01/30 16:06:35 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.48 2022/01/31 17:38:36 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, 

CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

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

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: if_sriov.c ixgbe.c ixgbe_82599.c
ixgbe_mbx.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.199.2.17 -r1.199.2.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.21.4.3 -r1.21.4.4 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.11.2.2 -r1.11.2.3 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.41.2.5 -r1.41.2.6 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.18.2.5 -r1.18.2.6 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.16.8.3 -r1.16.8.4 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.125.2.15 -r1.125.2.16 src/sys/dev/pci/ixgbe/ixv.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/dev/pci/ixgbe/if_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.6.2.2 src/sys/dev/pci/ixgbe/if_sriov.c:1.6.2.3
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.6.2.2	Sun Jan 30 15:58:28 2022
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Mon Jan 31 17:36:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sriov.c,v 1.6.2.2 2022/01/30 15:58:28 martin Exp $ */
+/* $NetBSD: if_sriov.c,v 1.6.2.3 2022/01/31 17:36:25 martin Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -34,7 +34,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.6.2.2 2022/01/30 15:58:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.6.2.3 2022/01/31 17:36:25 martin Exp $");
 
 #include "ixgbe.h"
 #include "ixgbe_sriov.h"
@@ -99,7 +99,7 @@ ixgbe_send_vf_msg(struct ixgbe_hw *hw, s
 	if (vf->flags & IXGBE_VF_CTS)
 		msg |= IXGBE_VT_MSGTYPE_CTS;
 
-	hw->mbx.ops.write(hw, , 1, vf->pool);
+	hw->mbx.ops[vf->pool].write(hw, , 1, vf->pool);
 }
 
 static inline void
@@ -594,7 +594,8 @@ ixgbe_process_vf_msg(struct adapter *ada
 
 	hw = >hw;
 
-	error = hw->mbx.ops.read(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool);
+	error = hw->mbx.ops[vf->pool].read(hw, msg, IXGBE_VFMAILBOX_SIZE,
+	vf->pool);
 
 	if (error != 0)
 		return;
@@ -654,16 +655,17 @@ ixgbe_handle_mbx(void *context)
 	for (i = 0; i < adapter->num_vfs; i++) {
 		vf = >vfs[i];
 
-		if (vf->flags & IXGBE_VF_ACTIVE) {
-			if (hw->mbx.ops.check_for_rst(hw, vf->pool) == 0)
-ixgbe_process_vf_reset(adapter, vf);
-
-			if (hw->mbx.ops.check_for_msg(hw, vf->pool) == 0)
-ixgbe_process_vf_msg(adapter, vf);
-
-			if (hw->mbx.ops.check_for_ack(hw, vf->pool) == 0)
-ixgbe_process_vf_ack(adapter, vf);
-		}
+		if ((vf->flags & IXGBE_VF_ACTIVE) == 0)
+			continue;
+
+		if (hw->mbx.ops[vf->pool].check_for_rst(hw, vf->pool) == 0)
+			ixgbe_process_vf_reset(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_msg(hw, vf->pool) == 0)
+			ixgbe_process_vf_msg(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_ack(hw, vf->pool) == 0)
+			ixgbe_process_vf_ack(adapter, vf);
 	}
 	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mbx */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.17 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.18
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.17	Sun Jan 30 15:58:28 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 31 17:36:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.17 2022/01/30 15:58:28 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.18 2022/01/31 17:36:25 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 

CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

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

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: if_sriov.c ixgbe.c ixgbe_82599.c
ixgbe_mbx.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.199.2.17 -r1.199.2.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.21.4.3 -r1.21.4.4 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.11.2.2 -r1.11.2.3 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.41.2.5 -r1.41.2.6 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.18.2.5 -r1.18.2.6 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.16.8.3 -r1.16.8.4 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.125.2.15 -r1.125.2.16 src/sys/dev/pci/ixgbe/ixv.c

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



CVS commit: [netbsd-9] src/sys/dev/usb

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

Modified Files:
src/sys/dev/usb [netbsd-9]: usbnet.c

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

sys/dev/usb/usbnet.c: revision 1.44 (via patch)

usbnet: Defer hardware multicast filter updates to USB task.

Breaks deadlock:
- usbnet_detach holds usbnet lock, awaits kpause in ure_reset
- callout holds softclock `lock' (sequential softints, blocks kpause
  wakeup), awaits softnet_lock in tcp_timer_keep, frag6_fasttimo, 
- soclose holds softnet_lock, awaits usbnet lock in SIOCDELMULTI

This change breaks the deadlock by not passing the SIOCADDMULTI or
SIOCDELMULTI ioctl synchronously to the driver, which typically takes
the usbnet lock.

With this change, the ethernet layer still maintains the list of
multicast addresses synchronously, but we defer the driver logic that
updates the hardware multicast filter to an asynchronous USB task
without softnet_lock held.

This doesn't cause exactly the same ioctl to be sent to the driver --
usbnet just sends SIOCDELMULTI with an all-zero struct ifreq, and
might drop some ioctls if issued in quick succession.  This is OK
because none of the drivers actually distinguish between SIOCADDMULTI
and SIOCDELMULTI, or examine the argument; the drivers just commit
whatever multicast addresses are listed in the ethercom.

Other than the different ioctl submitted, there is no change to the
ABI or locking scheme of usbnet, so this is safe to pull up to
netbsd-9.  This means we unfortunately can't guarantee that if a
process issues SIOCADDMULTI and then sendto, the multicast filter
update will be done by the time of the sendto -- and, more
importantly, the packets received in reply to it.  But failing to
guarantee that is better than deadlocking!  Later changes on HEAD
will restore the synchronous multicast filter updates with much more
extensive ABI changes and API simplifications in usbnet(9).
Proposed on tech-net:

https://mail-index.netbsd.org/tech-net/2021/12/30/msg008164.html

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.25.2.5 -r1.25.2.6 src/sys/dev/usb/usbnet.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/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.25.2.5 src/sys/dev/usb/usbnet.c:1.25.2.6
--- src/sys/dev/usb/usbnet.c:1.25.2.5	Fri Aug 28 19:36:34 2020
+++ src/sys/dev/usb/usbnet.c	Mon Jan 31 17:30:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.25.2.5 2020/08/28 19:36:34 martin Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.25.2.6 2022/01/31 17:30:21 martin Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.25.2.5 2020/08/28 19:36:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.25.2.6 2022/01/31 17:30:21 martin Exp $");
 
 #include 
 #include 
@@ -75,6 +75,7 @@ struct usbnet_private {
 
 	struct ethercom		unp_ec;
 	struct mii_data		unp_mii;
+	struct usb_task		unp_mcasttask;
 	struct usb_task		unp_ticktask;
 	struct callout		unp_stat_ch;
 	struct usbd_pipe	*unp_ep[USBNET_ENDPT_MAX];
@@ -1048,12 +1049,64 @@ usbnet_ioctl(struct ifnet *ifp, u_long c
 		return uno_override_ioctl(un, ifp, cmd, data);
 
 	error = ether_ioctl(ifp, cmd, data);
-	if (error == ENETRESET)
-		error = uno_ioctl(un, ifp, cmd, data);
+	if (error == ENETRESET) {
+		switch (cmd) {
+		case SIOCADDMULTI:
+		case SIOCDELMULTI:
+			usb_add_task(un->un_udev, >unp_mcasttask,
+			USB_TASKQ_DRIVER);
+			error = 0;
+			break;
+		default:
+			error = uno_ioctl(un, ifp, cmd, data);
+		}
+	}
 
 	return error;
 }
 
+static void
+usbnet_mcast_task(void *arg)
+{
+	USBNETHIST_FUNC();
+	struct usbnet * const un = arg;
+	struct usbnet_private * const unp = un->un_pri;
+	struct ifnet * const ifp = usbnet_ifp(un);
+	bool dying;
+	struct ifreq ifr;
+
+	USBNETHIST_CALLARGSN(10, "%d: enter", unp->unp_number, 0, 0, 0);
+
+	/*
+	 * If we're detaching, we must check unp_dying _before_
+	 * touching IFNET_LOCK -- the ifnet may have been detached by
+	 * the time this task runs.  This is racy -- unp_dying may be
+	 * set immediately after we test it -- but nevertheless safe,
+	 * because usbnet_detach waits for the task to complete before
+	 * issuing if_detach, and necessary, so that we don't touch
+	 * IFNET_LOCK after if_detach.  See usbnet_detach for details.
+	 */
+	mutex_enter(>unp_lock);
+	dying = unp->unp_dying;
+	mutex_exit(>unp_lock);
+	if (dying)
+		return;
+
+	/*
+	 * Pass a bogus ifr with SIOCDELMULTI -- the goal is to just
+	 * notify the driver to reprogram any hardware multicast
+	 * filter, according to what's already stored in the ethercom.
+	 * None of the drivers actually examine this argument, so it
+	 * doesn't change the ABI as far as they can tell.
+	 */
+	IFNET_LOCK(ifp);
+	if (ifp->if_flags & IFF_RUNNING) {
+		memset(, 0, sizeof(ifr));
+		

CVS commit: [netbsd-9] src/sys/dev/usb

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

Modified Files:
src/sys/dev/usb [netbsd-9]: usbnet.c

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

sys/dev/usb/usbnet.c: revision 1.44 (via patch)

usbnet: Defer hardware multicast filter updates to USB task.

Breaks deadlock:
- usbnet_detach holds usbnet lock, awaits kpause in ure_reset
- callout holds softclock `lock' (sequential softints, blocks kpause
  wakeup), awaits softnet_lock in tcp_timer_keep, frag6_fasttimo, 
- soclose holds softnet_lock, awaits usbnet lock in SIOCDELMULTI

This change breaks the deadlock by not passing the SIOCADDMULTI or
SIOCDELMULTI ioctl synchronously to the driver, which typically takes
the usbnet lock.

With this change, the ethernet layer still maintains the list of
multicast addresses synchronously, but we defer the driver logic that
updates the hardware multicast filter to an asynchronous USB task
without softnet_lock held.

This doesn't cause exactly the same ioctl to be sent to the driver --
usbnet just sends SIOCDELMULTI with an all-zero struct ifreq, and
might drop some ioctls if issued in quick succession.  This is OK
because none of the drivers actually distinguish between SIOCADDMULTI
and SIOCDELMULTI, or examine the argument; the drivers just commit
whatever multicast addresses are listed in the ethercom.

Other than the different ioctl submitted, there is no change to the
ABI or locking scheme of usbnet, so this is safe to pull up to
netbsd-9.  This means we unfortunately can't guarantee that if a
process issues SIOCADDMULTI and then sendto, the multicast filter
update will be done by the time of the sendto -- and, more
importantly, the packets received in reply to it.  But failing to
guarantee that is better than deadlocking!  Later changes on HEAD
will restore the synchronous multicast filter updates with much more
extensive ABI changes and API simplifications in usbnet(9).
Proposed on tech-net:

https://mail-index.netbsd.org/tech-net/2021/12/30/msg008164.html

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.25.2.5 -r1.25.2.6 src/sys/dev/usb/usbnet.c

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



CVS commit: src/tests/fs/vfs

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 17:23:37 UTC 2022

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Extend the time to wait for the thread to quit.

It seems that alarm(1) is not enough time for the thread to actually exit after 
quittingtime = 1.
It randomly failed with "Test program received signal 14" on a slow environment.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/tests/fs/vfs/t_renamerace.c

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

Modified files:

Index: src/tests/fs/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.43 src/tests/fs/vfs/t_renamerace.c:1.44
--- src/tests/fs/vfs/t_renamerace.c:1.43	Sat Nov 27 15:23:33 2021
+++ src/tests/fs/vfs/t_renamerace.c	Mon Jan 31 17:23:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.43 2021/11/27 15:23:33 gson Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.44 2022/01/31 17:23:37 ryo Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -244,7 +244,7 @@ renamerace_cycle(const atf_tc_t *tc, con
 	sleep(10);
 	quittingtime = 1;
 
-	alarm(1);
+	alarm(5);
 	pthread_join(pt_rmdir, NULL);
 	pthread_join(pt_rename1, NULL);
 	pthread_join(pt_rename2, NULL);



CVS commit: src/tests/fs/vfs

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 17:23:37 UTC 2022

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Extend the time to wait for the thread to quit.

It seems that alarm(1) is not enough time for the thread to actually exit after 
quittingtime = 1.
It randomly failed with "Test program received signal 14" on a slow environment.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/tests/fs/vfs/t_renamerace.c

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



CVS commit: src/bin/sh

2022-01-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 31 16:54:28 UTC 2022

Modified Files:
src/bin/sh: cd.c histedit.c

Log Message:
Add some comments explaining accesses to the environment via
getenv()/setenv()/unsetenv() which manipulate the envornoment
the shell was passed at entry.

These are a little odd in sh as that environment is copied into
the shell's internal variable data struct at shell startup, and
normally never accessed after that - in builtin commands (test.
printf, ...) getenv() is #defined to become an internal sh lookup
function instead, so even those never use the startup environment).

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/sh/cd.c
cvs rdiff -u -r1.57 -r1.58 src/bin/sh/histedit.c

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

Modified files:

Index: src/bin/sh/cd.c
diff -u src/bin/sh/cd.c:1.52 src/bin/sh/cd.c:1.53
--- src/bin/sh/cd.c:1.52	Tue Nov 16 16:57:15 2021
+++ src/bin/sh/cd.c	Mon Jan 31 16:54:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.52 2021/11/16 16:57:15 kre Exp $	*/
+/*	$NetBSD: cd.c,v 1.53 2022/01/31 16:54:28 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)cd.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: cd.c,v 1.52 2021/11/16 16:57:15 kre Exp $");
+__RCSID("$NetBSD: cd.c,v 1.53 2022/01/31 16:54:28 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -404,6 +404,20 @@ getpwd(int noerror)
 		return;
 
 	if (first) {
+		/*
+		 * Note that this happens via the call from initpwd()
+		 * just above, which is called early from main() during
+		 * sh startup, so fetching PWD from the entry environment
+		 * (which is what getenv() does) is acceptable.   Here we
+		 * could use normal sh var lookup functions instead, as
+		 * the arriving environment has already been imported before
+		 * we get here, but it makes little difference.
+		 *
+		 * XXX What would be better perhaps would be to move all of
+		 * this into initpwd() instead of here, so we could get rid of
+		 * this "first" static - that function is only ever called once.
+		 * XXX Some other day.
+		 */
 		first = 0;
 		pwd = getenv("PWD");
 		if (is_curdir(pwd)) {

Index: src/bin/sh/histedit.c
diff -u src/bin/sh/histedit.c:1.57 src/bin/sh/histedit.c:1.58
--- src/bin/sh/histedit.c:1.57	Tue Sep 14 15:04:09 2021
+++ src/bin/sh/histedit.c	Mon Jan 31 16:54:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: histedit.c,v 1.57 2021/09/14 15:04:09 christos Exp $	*/
+/*	$NetBSD: histedit.c,v 1.58 2022/01/31 16:54:28 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)histedit.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: histedit.c,v 1.57 2021/09/14 15:04:09 christos Exp $");
+__RCSID("$NetBSD: histedit.c,v 1.58 2022/01/31 16:54:28 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -129,6 +129,23 @@ histedit(void)
 			if (tracefile)
 el_err = tracefile;
 #endif
+			/*
+			 * This odd piece of code doesn't affect the shell
+			 * at all, the environment modified here is the
+			 * stuff accessed via "environ" (the incoming
+			 * envoironment to the shell) which is only ever
+			 * touched at sh startup time (long before we get
+			 * here) and ignored thereafter.
+			 *
+			 * But libedit calls getenv() to discover TERM
+			 * and that searches the "environ" environment,
+			 * not the shell's internal variable data struct,
+			 * so we need to make sure that TERM in there is
+			 * correct.
+			 *
+			 * This sequence copies TERM from the shell into
+			 * the old "environ" environment.
+			 */
 			term = lookupvar("TERM");
 			if (term)
 setenv("TERM", term, 1);



CVS commit: src/bin/sh

2022-01-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 31 16:54:28 UTC 2022

Modified Files:
src/bin/sh: cd.c histedit.c

Log Message:
Add some comments explaining accesses to the environment via
getenv()/setenv()/unsetenv() which manipulate the envornoment
the shell was passed at entry.

These are a little odd in sh as that environment is copied into
the shell's internal variable data struct at shell startup, and
normally never accessed after that - in builtin commands (test.
printf, ...) getenv() is #defined to become an internal sh lookup
function instead, so even those never use the startup environment).

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/sh/cd.c
cvs rdiff -u -r1.57 -r1.58 src/bin/sh/histedit.c

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



CVS commit: src/lib/libedit

2022-01-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 31 14:44:49 UTC 2022

Modified Files:
src/lib/libedit: readline.c
src/lib/libedit/readline: readline.h

Log Message:
PR/56622: Walter Lozano: Improve readline compatibility by adding
rl_readline_state support.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/lib/libedit/readline.c
cvs rdiff -u -r1.50 -r1.51 src/lib/libedit/readline/readline.h

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

Modified files:

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.170 src/lib/libedit/readline.c:1.171
--- src/lib/libedit/readline.c:1.170	Sat Jan 29 15:52:45 2022
+++ src/lib/libedit/readline.c	Mon Jan 31 09:44:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.170 2022/01/29 20:52:45 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.171 2022/01/31 14:44:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.170 2022/01/29 20:52:45 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.171 2022/01/31 14:44:49 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -128,7 +128,7 @@ VFunction *rl_completion_display_matches
 VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal;
 VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal;
 KEYMAP_ENTRY_ARRAY emacs_meta_keymap;
-unsigned long rl_readline_state;
+unsigned long rl_readline_state = RL_STATE_NONE;
 int _rl_complete_mark_directories;
 rl_icppfunc_t *rl_directory_completion_hook;
 int rl_completion_suppress_append;
@@ -311,6 +311,8 @@ rl_initialize(void)
 	if (h != NULL)
 		history_end(h);
 
+	RL_UNSETSTATE(RL_STATE_DONE);
+
 	if (!rl_instream)
 		rl_instream = stdin;
 	if (!rl_outstream)
@@ -2145,6 +2147,7 @@ rl_callback_read_char(void)
 		if (done == 2) {
 			if ((wbuf = strdup(buf)) != NULL)
 wbuf[count] = '\0';
+			RL_SETSTATE(RL_STATE_DONE);
 		} else
 			wbuf = NULL;
 		(*(void (*)(const char *))rl_linefunc)(wbuf);

Index: src/lib/libedit/readline/readline.h
diff -u src/lib/libedit/readline/readline.h:1.50 src/lib/libedit/readline/readline.h:1.51
--- src/lib/libedit/readline/readline.h:1.50	Fri Jan 14 08:31:05 2022
+++ src/lib/libedit/readline/readline.h	Mon Jan 31 09:44:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.h,v 1.50 2022/01/14 13:31:05 christos Exp $	*/
+/*	$NetBSD: readline.h,v 1.51 2022/01/31 14:44:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -94,6 +94,13 @@ typedef KEYMAP_ENTRY *Keymap;
 #define RL_PROMPT_START_IGNORE	'\1'
 #define RL_PROMPT_END_IGNORE	'\2'
 
+#define RL_STATE_NONE		0x00
+#define RL_STATE_DONE		0x01
+
+#define RL_SETSTATE(x)		(rl_readline_state |= ((unsigned long) x))
+#define RL_UNSETSTATE(x)	(rl_readline_state &= ~((unsigned long) x))
+#define RL_ISSTATE(x)		(rl_readline_state & ((unsigned long) x))
+
 /* global variables used by readline enabled applications */
 #ifdef __cplusplus
 extern "C" {



CVS commit: src/lib/libedit

2022-01-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 31 14:44:49 UTC 2022

Modified Files:
src/lib/libedit: readline.c
src/lib/libedit/readline: readline.h

Log Message:
PR/56622: Walter Lozano: Improve readline compatibility by adding
rl_readline_state support.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/lib/libedit/readline.c
cvs rdiff -u -r1.50 -r1.51 src/lib/libedit/readline/readline.h

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



Re: CVS commit: src/usr.bin/make

2022-01-31 Thread Christos Zoulas

> On Jan 30, 2022, at 2:41 PM, Roland Illig  wrote:
> 
> Am 30.01.2022 um 14:21 schrieb Christos Zoulas:
>> Module Name: src
>> Committed By:christos
>> Date:Sun Jan 30 13:21:09 UTC 2022
>> 
>> Modified Files:
>>  src/usr.bin/make: dir.c job.c make.h
>> 
>> Log Message:
>> Make the GNode lineno unsigned to fix lint warning in var.c calling
>> PrintLocation()
> 
> Hi Christos,
> 
> Did you get that warning on i386?  On x86_64 I didn't get any lint
> warnings, as these would have made my pre-commit hook fail.

Yes: https://releng.netbsd.org/builds/HEAD-lint/202201300710Z/i386.build.failed 

Do you know it would only fail on i386?

> Since usr.bin/make is also used in tools/make, it needs to follow the
> rules in tools/README, which say that all tools should stick to C89.
> The format specifier %zu comes from C99 though.

Yes, %zu is annoying because windows does not have it either (until very
recently I think). But cygwin does have it(?) so there is no issue?

> Or can we drop the C89 rule from tools/README?  In the past few years,
> usr.bin/make used several features from C99 (end-of-line comments, long
> long, %zu, snprintf), and nobody cared to fix the C99-isms, so either
> nobody needed the C89 restriction or we simply ignored the complaints.

I think that we should ask in tech-toolchain. Yes, I prefer to require c99
at this point.

Best,

christos


signature.asc
Description: Message signed with OpenPGP


CVS commit: src/sys/dev/pci

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 31 10:14:55 UTC 2022

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
Decode SCSI programming interface. Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/pci/pcireg.h

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



CVS commit: src/sys/dev/pci

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 31 10:14:55 UTC 2022

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
Decode SCSI programming interface. Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.240 src/sys/dev/pci/pci_subr.c:1.241
--- src/sys/dev/pci/pci_subr.c:1.240	Mon Jan 31 10:11:33 2022
+++ src/sys/dev/pci/pci_subr.c	Mon Jan 31 10:14:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.240 2022/01/31 10:11:33 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.241 2022/01/31 10:14:55 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.240 2022/01/31 10:11:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.241 2022/01/31 10:14:55 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -155,6 +155,17 @@ static const struct pci_class pci_subcla
  * Mass storage controller
  */
 
+/* SCSI programming interface */
+static const struct pci_class pci_interface_scsi[] = {
+	{ "vendor specifi",	PCI_INTERFACE_SCSI_VND,		NULL,	},
+	{ "PQI storage",	PCI_INTERFACE_SCSI_PQI_STORAGE,	NULL,	},
+	{ "PQI controller",	PCI_INTERFACE_SCSI_PQI_CNTRL,	NULL,	},
+	{ "PQI storage and controller",	PCI_INTERFACE_SCSI_PQI_STORAGE_CNTRL,
+	  NULL,	},
+	{ "NVME",		PCI_INTERFACE_SCSI_NVME,	NULL,	},
+	{ NULL,			0,NULL,	},
+};
+
 /* ATA programming interface */
 static const struct pci_class pci_interface_ata[] = {
 	{ "with single DMA",	PCI_INTERFACE_ATA_SINGLEDMA,	NULL,	},
@@ -188,15 +199,16 @@ static const struct pci_class pci_interf
 
 /* Subclasses */
 static const struct pci_class pci_subclass_mass_storage[] = {
-	{ "SCSI",		PCI_SUBCLASS_MASS_STORAGE_SCSI,	NULL,	},
+	{ "SCSI",		PCI_SUBCLASS_MASS_STORAGE_SCSI,
+	  pci_interface_scsi },
 	{ "IDE",		PCI_SUBCLASS_MASS_STORAGE_IDE,	NULL,	},
 	{ "floppy",		PCI_SUBCLASS_MASS_STORAGE_FLOPPY, NULL, },
 	{ "IPI",		PCI_SUBCLASS_MASS_STORAGE_IPI,	NULL,	},
 	{ "RAID",		PCI_SUBCLASS_MASS_STORAGE_RAID,	NULL,	},
 	{ "ATA",		PCI_SUBCLASS_MASS_STORAGE_ATA,
-	  pci_interface_ata, },
+	  pci_interface_ata },
 	{ "SATA",		PCI_SUBCLASS_MASS_STORAGE_SATA,
-	  pci_interface_sata, },
+	  pci_interface_sata },
 	{ "SAS",		PCI_SUBCLASS_MASS_STORAGE_SAS,	NULL,	},
 	{ "Flash",		PCI_SUBCLASS_MASS_STORAGE_NVM,
 	  pci_interface_nvm,	},
@@ -310,13 +322,13 @@ static const struct pci_class pci_subcla
 	{ "EISA",		PCI_SUBCLASS_BRIDGE_EISA,	NULL,	},
 	{ "MicroChannel",	PCI_SUBCLASS_BRIDGE_MC,		NULL,	},
 	{ "PCI",		PCI_SUBCLASS_BRIDGE_PCI,
-	  pci_interface_pcibridge,	},
+	  pci_interface_pcibridge },
 	{ "PCMCIA",		PCI_SUBCLASS_BRIDGE_PCMCIA,	NULL,	},
 	{ "NuBus",		PCI_SUBCLASS_BRIDGE_NUBUS,	NULL,	},
 	{ "CardBus",		PCI_SUBCLASS_BRIDGE_CARDBUS,	NULL,	},
 	{ "RACEway",		PCI_SUBCLASS_BRIDGE_RACEWAY,	NULL,	},
 	{ "Semi-transparent PCI", PCI_SUBCLASS_BRIDGE_STPCI,
-	  pci_interface_stpci,	},
+	  pci_interface_stpci, },
 	{ "InfiniBand",		PCI_SUBCLASS_BRIDGE_INFINIBAND,	NULL,	},
 	{ "advanced switching",	PCI_SUBCLASS_BRIDGE_ADVSW,
 	  pci_interface_advsw,	},

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.164 src/sys/dev/pci/pcireg.h:1.165
--- src/sys/dev/pci/pcireg.h:1.164	Mon Jan 31 10:11:33 2022
+++ src/sys/dev/pci/pcireg.h	Mon Jan 31 10:14:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.164 2022/01/31 10:11:33 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.165 2022/01/31 10:14:55 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -188,6 +188,11 @@ typedef u_int8_t pci_revision_t;
 
 /* 0x01 mass storage subclasses */
 #define	PCI_SUBCLASS_MASS_STORAGE_SCSI		0x00
+#define		PCI_INTERFACE_SCSI_VND			0x00
+#define		PCI_INTERFACE_SCSI_PQI_STORAGE		0x11
+#define		PCI_INTERFACE_SCSI_PQI_CNTRL		0x12
+#define		PCI_INTERFACE_SCSI_PQI_STORAGE_CNTRL	0x13
+#define		PCI_INTERFACE_SCSI_NVME			0x21
 #define	PCI_SUBCLASS_MASS_STORAGE_IDE		0x01
 #define	PCI_SUBCLASS_MASS_STORAGE_FLOPPY	0x02
 #define	PCI_SUBCLASS_MASS_STORAGE_IPI		0x03



CVS commit: src/sys/dev/pci

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 31 10:11:33 UTC 2022

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
Add three new extended capabilities:

  - Physical Layer 32.0 GT/s
  - Alternate Protocol
  - System Firmware Intermediary


To generate a diff of this commit:
cvs rdiff -u -r1.239 -r1.240 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.239 src/sys/dev/pci/pci_subr.c:1.240
--- src/sys/dev/pci/pci_subr.c:1.239	Sat Jan  8 12:59:34 2022
+++ src/sys/dev/pci/pci_subr.c	Mon Jan 31 10:11:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.239 2022/01/08 12:59:34 tnn Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.240 2022/01/31 10:11:33 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.239 2022/01/08 12:59:34 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.240 2022/01/31 10:11:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -4572,6 +4572,12 @@ static struct {
 	  NULL },
 	{ PCI_EXTCAP_NPEM,	"Native PCIe Enclosure Management",
 	  NULL },
+	{ PCI_EXTCAP_PL32G,	"Physical Layer 32.0 GT/s",
+	  NULL },
+	{ PCI_EXTCAP_AP,	"Alternate Protocol",
+	  NULL },
+	{ PCI_EXTCAP_SFI,	"System Firmware Intermediary",
+	  NULL },
 };
 
 static int

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.163 src/sys/dev/pci/pcireg.h:1.164
--- src/sys/dev/pci/pcireg.h:1.163	Sat Jan  1 03:27:53 2022
+++ src/sys/dev/pci/pcireg.h	Mon Jan 31 10:11:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.163 2022/01/01 03:27:53 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.164 2022/01/31 10:11:33 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1571,6 +1571,9 @@ struct pci_rom {
 #define	PCI_EXTCAP_LMR		0x0027	/* Lane Margining at the Receiver */
 #define	PCI_EXTCAP_HIERARCHYID	0x0028	/* Hierarchy ID */
 #define	PCI_EXTCAP_NPEM		0x0029	/* Native PCIe Enclosure Management */
+#define	PCI_EXTCAP_PL32G	0x002a	/* Physical Layer 32.0 GT/s */
+#define	PCI_EXTCAP_AP		0x002b	/* Alternate Protocol */
+#define	PCI_EXTCAP_SFI		0x002c	/* System Firmware Intermediary */
 
 /*
  * Extended capability ID: 0x0001



CVS commit: src/sys/dev/pci

2022-01-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 31 10:11:33 UTC 2022

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
Add three new extended capabilities:

  - Physical Layer 32.0 GT/s
  - Alternate Protocol
  - System Firmware Intermediary


To generate a diff of this commit:
cvs rdiff -u -r1.239 -r1.240 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/pcireg.h

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



CVS commit: src/sys/arch

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 09:16:09 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_machdep.c cpufunc.c fault.c
locore.S pmap.c
src/sys/arch/aarch64/conf: files.aarch64
src/sys/arch/aarch64/include: cpufunc.h
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
add support Hardware updates to Access flag and Dirty state (FEAT_HAFDBS)

- The DBM bit of the PTE is now used to determine if it is writable, and
  the AF bit is treated entirely as a reference bit. A valid PTE is always
  treated as readable. There can be no valid PTE that is not readable.
- LX_BLKPAG_OS_{READ,WRITE} are used only for debugging purposes,
  and has been superseded by LX_BLKPAG_AF and LX_BLKPAG_DBM.
- Improve comment

The need for reference/modify emulation has been eliminated,
and access/permission faults have been reduced, however,
there has been little change in overall performance.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/aarch64/aarch64/aarch64_machdep.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/cpufunc.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/fault.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/conf/files.aarch64
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/include/cpufunc.h
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/evbarm/conf/GENERIC64

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



CVS commit: src/sys/arch

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 09:16:09 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_machdep.c cpufunc.c fault.c
locore.S pmap.c
src/sys/arch/aarch64/conf: files.aarch64
src/sys/arch/aarch64/include: cpufunc.h
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
add support Hardware updates to Access flag and Dirty state (FEAT_HAFDBS)

- The DBM bit of the PTE is now used to determine if it is writable, and
  the AF bit is treated entirely as a reference bit. A valid PTE is always
  treated as readable. There can be no valid PTE that is not readable.
- LX_BLKPAG_OS_{READ,WRITE} are used only for debugging purposes,
  and has been superseded by LX_BLKPAG_AF and LX_BLKPAG_DBM.
- Improve comment

The need for reference/modify emulation has been eliminated,
and access/permission faults have been reduced, however,
there has been little change in overall performance.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/aarch64/aarch64/aarch64_machdep.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/cpufunc.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/fault.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/conf/files.aarch64
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/include/cpufunc.h
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/evbarm/conf/GENERIC64

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/aarch64/aarch64/aarch64_machdep.c
diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.63 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.64
--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.63	Sun Oct 31 16:23:47 2021
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c	Mon Jan 31 09:16:09 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.63 2021/10/31 16:23:47 skrll Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.64 2022/01/31 09:16:09 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.63 2021/10/31 16:23:47 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.64 2022/01/31 09:16:09 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cpuoptions.h"
@@ -533,6 +533,14 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 	NULL, 0,
 	_bti_enabled, 0,
 	CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(clog, 0, NULL, NULL,
+	CTLFLAG_PERMANENT,
+	CTLTYPE_INT, "hafdbs",
+	SYSCTL_DESCR("Whether Hardware updates to Access flag and Dirty state is enabled"),
+	NULL, 0,
+	_hafdbs_enabled, 0,
+	CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 }
 
 void

Index: src/sys/arch/aarch64/aarch64/cpufunc.c
diff -u src/sys/arch/aarch64/aarch64/cpufunc.c:1.32 src/sys/arch/aarch64/aarch64/cpufunc.c:1.33
--- src/sys/arch/aarch64/aarch64/cpufunc.c:1.32	Sun Oct 31 16:23:47 2021
+++ src/sys/arch/aarch64/aarch64/cpufunc.c	Mon Jan 31 09:16:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.32 2021/10/31 16:23:47 skrll Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.33 2022/01/31 09:16:09 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.32 2021/10/31 16:23:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.33 2022/01/31 09:16:09 ryo Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ u_int arm_dcache_maxline;
 u_int aarch64_cache_vindexsize;
 u_int aarch64_cache_prefer_mask;
 
+int aarch64_hafdbs_enabled __read_mostly;
 int aarch64_pan_enabled __read_mostly;
 int aarch64_pac_enabled __read_mostly;
 
@@ -464,6 +465,71 @@ aarch64_setcpufuncs(struct cpu_info *ci)
 }
 
 void
+aarch64_hafdbs_init(int primary)
+{
+#ifdef ARMV81_HAFDBS
+	uint64_t tcr;
+	int hafdbs;
+
+	hafdbs = __SHIFTOUT(reg_id_aa64mmfr1_el1_read(),
+	ID_AA64MMFR1_EL1_HAFDBS);
+
+	/*
+	 * hafdbs
+	 *   0:HAFDBS_NONE - no support for any hardware flags
+	 *   1:HAFDBS_A- only hardware access flag supported
+	 *   2:HAFDBS_AD   - hardware access and modified flags supported.
+	 */
+
+	if (primary) {
+		/* CPU0 does the detection. */
+		switch (hafdbs) {
+		case ID_AA64MMFR1_EL1_HAFDBS_NONE:
+		default:
+			aarch64_hafdbs_enabled = 0;
+			break;
+		case ID_AA64MMFR1_EL1_HAFDBS_A:
+		case ID_AA64MMFR1_EL1_HAFDBS_AD:
+			aarch64_hafdbs_enabled = hafdbs;
+			break;
+		}
+	} else {
+		/*
+		 * The support status of HAFDBS on the primary CPU is different
+		 * from that of the application processor.
+		 *
+		 * XXX:
+		 *  The correct way to do this is to disable it on all cores,
+		 *  or call pmap_fault_fixup() only on the unsupported cores,
+		 *  but for now, do panic().
+		 */
+		if (aarch64_hafdbs_enabled != hafdbs)
+			panic("HAFDBS is supported (%d) on 

CVS commit: src/sys/arch/aarch64/aarch64

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 08:43:05 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
Skip unnecessary PTE operations and TLB invalidation.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/aarch64/aarch64/pmap.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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.125 src/sys/arch/aarch64/aarch64/pmap.c:1.126
--- src/sys/arch/aarch64/aarch64/pmap.c:1.125	Sun Jan 16 10:50:02 2022
+++ src/sys/arch/aarch64/aarch64/pmap.c	Mon Jan 31 08:43:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.125 2022/01/16 10:50:02 rillig Exp $	*/
+/*	$NetBSD: pmap.c,v 1.126 2022/01/31 08:43:05 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.125 2022/01/16 10:50:02 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.126 2022/01/31 08:43:05 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -2515,6 +2515,8 @@ pmap_clear_modify(struct vm_page *pg)
  tryagain:
 		if (!l3pte_valid(pte))
 			continue;
+		if ((pte & LX_BLKPAG_AP) == LX_BLKPAG_AP_RO)
+			continue;
 
 		/* clear write permission */
 		pte &= ~LX_BLKPAG_AP;
@@ -2576,6 +2578,8 @@ pmap_clear_reference(struct vm_page *pg)
  tryagain:
 		if (!l3pte_valid(pte))
 			continue;
+		if ((pte & LX_BLKPAG_AF) == 0)
+			continue;
 
 		/* clear access permission */
 		pte &= ~LX_BLKPAG_AF;



CVS commit: src/sys/arch/aarch64/aarch64

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 08:43:05 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
Skip unnecessary PTE operations and TLB invalidation.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/aarch64/aarch64/pmap.c

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