CVS commit: src

2019-02-12 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Wed Feb 13 07:55:33 UTC 2019

Modified Files:
src/distrib/pmax/ramdisk: Makefile
src/sys/arch/pmax/conf: RAMDISK

Log Message:
Bump pmax install ramdisk size by another 100k, as 3500k is no longer
enough with GCC 7.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/distrib/pmax/ramdisk/Makefile
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/pmax/conf/RAMDISK

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

Modified files:

Index: src/distrib/pmax/ramdisk/Makefile
diff -u src/distrib/pmax/ramdisk/Makefile:1.48 src/distrib/pmax/ramdisk/Makefile:1.49
--- src/distrib/pmax/ramdisk/Makefile:1.48	Sun Jul 16 14:24:29 2017
+++ src/distrib/pmax/ramdisk/Makefile	Wed Feb 13 07:55:33 2019
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile,v 1.48 2017/07/16 14:24:29 christos Exp $
+#	$NetBSD: Makefile,v 1.49 2019/02/13 07:55:33 gson Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
 IMAGETAR=	diskimage.tgz
-IMAGESIZE=	3500k
+IMAGESIZE=	3600k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1

Index: src/sys/arch/pmax/conf/RAMDISK
diff -u src/sys/arch/pmax/conf/RAMDISK:1.14 src/sys/arch/pmax/conf/RAMDISK:1.15
--- src/sys/arch/pmax/conf/RAMDISK:1.14	Fri Jul 14 12:27:55 2017
+++ src/sys/arch/pmax/conf/RAMDISK	Wed Feb 13 07:55:33 2019
@@ -1,4 +1,4 @@
-# 	$NetBSD: RAMDISK,v 1.14 2017/07/14 12:27:55 christos Exp $
+# 	$NetBSD: RAMDISK,v 1.15 2019/02/13 07:55:33 gson Exp $
 #
 # Install kernel with ramdisk added.
 # The ramdisk is be too big to netboot directly via ECOFF on some machines,
@@ -13,7 +13,7 @@ include	"arch/pmax/conf/INSTALL"
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=7000	# size of memory disk, in blocks (3500kB)
+options 	MEMORY_DISK_ROOT_SIZE=7200	# size of memory disk, in blocks (3500kB)
 #options 	MEMORY_DISK_ROOT_SIZE=2880	# 1.44M, same as a floppy
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 



CVS commit: src/sys/dev/nvmm/x86

2019-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Feb 13 07:04:13 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_svm.c

Log Message:
Micro optimization: the STAR/LSTAR/CSTAR/SFMASK MSRs are static, so rather
than saving them on each VMENTRY, save them only once, at VCPU creation
time.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/nvmm/x86/nvmm_x86_svm.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/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.20 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.21
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.20	Tue Feb 12 14:54:59 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Wed Feb 13 07:04:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.20 2019/02/12 14:54:59 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.21 2019/02/13 07:04:12 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.20 2019/02/12 14:54:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.21 2019/02/13 07:04:12 maxv Exp $");
 
 #include 
 #include 
@@ -1157,10 +1157,6 @@ svm_vcpu_guest_misc_enter(struct nvmm_cp
 {
 	struct svm_cpudata *cpudata = vcpu->cpudata;
 
-	cpudata->star = rdmsr(MSR_STAR);
-	cpudata->lstar = rdmsr(MSR_LSTAR);
-	cpudata->cstar = rdmsr(MSR_CSTAR);
-	cpudata->sfmask = rdmsr(MSR_SFMASK);
 	cpudata->fsbase = rdmsr(MSR_FSBASE);
 	cpudata->kernelgsbase = rdmsr(MSR_KERNELGSBASE);
 }
@@ -1592,6 +1588,12 @@ svm_vcpu_init(struct nvmm_machine *mach,
 
 	/* Bluntly hide the host TSC. */
 	cpudata->tsc_offset = rdtsc();
+
+	/* These MSRs are static. */
+	cpudata->star = rdmsr(MSR_STAR);
+	cpudata->lstar = rdmsr(MSR_LSTAR);
+	cpudata->cstar = rdmsr(MSR_CSTAR);
+	cpudata->sfmask = rdmsr(MSR_SFMASK);
 }
 
 static int



CVS commit: src/sys/arch/xen

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 06:52:43 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenpmap.h
src/sys/arch/xen/xen: evtchn.c hypervisor.c xen_machdep.c

Log Message:
Further restrict the scope of XENPV to relevant parts.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/xen_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/xen/include/xenpmap.h
diff -u src/sys/arch/xen/include/xenpmap.h:1.40 src/sys/arch/xen/include/xenpmap.h:1.41
--- src/sys/arch/xen/include/xenpmap.h:1.40	Thu Jul 26 17:20:08 2018
+++ src/sys/arch/xen/include/xenpmap.h	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenpmap.h,v 1.40 2018/07/26 17:20:08 maxv Exp $	*/
+/*	$NetBSD: xenpmap.h,v 1.41 2019/02/13 06:52:43 cherry Exp $	*/
 
 /*
  *
@@ -72,6 +72,7 @@ void xen_kpm_sync(struct pmap *, int);
 #define xpq_queue_pin_l4_table(pa)	\
 	xpq_queue_pin_table(pa, MMUEXT_PIN_L4_TABLE)
 
+#ifdef XENPV
 extern unsigned long *xpmap_phys_to_machine_mapping;
 
 static __inline paddr_t
@@ -121,6 +122,8 @@ xpmap_ptom_isvalid(paddr_t ppa)
 	!= INVALID_P2M_ENTRY);
 }
 
+#endif /* XENPV */
+
 static inline void
 MULTI_update_va_mapping(
 	multicall_entry_t *mcl, vaddr_t va,

Index: src/sys/arch/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.84 src/sys/arch/xen/xen/evtchn.c:1.85
--- src/sys/arch/xen/xen/evtchn.c:1.84	Wed Feb 13 05:01:58 2019
+++ src/sys/arch/xen/xen/evtchn.c	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.84 2019/02/13 05:01:58 cherry Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.85 2019/02/13 06:52:43 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.84 2019/02/13 05:01:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.85 2019/02/13 06:52:43 cherry Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -256,6 +256,7 @@ void
 events_init(void)
 {
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
+#ifdef XENPV
 	debug_port = bind_virq_to_evtch(VIRQ_DEBUG);
 
 	KASSERT(debug_port != -1);
@@ -273,6 +274,7 @@ events_init(void)
 #if NPCI > 0 || NISA > 0
 	hypervisor_ack_pirq_event(debug_port);
 #endif /* NPCI > 0 || NISA > 0 */
+#endif /* XENPV */
 	x86_enable_intr();		/* at long last... */
 }
 
@@ -1080,6 +1082,7 @@ xen_debug_handler(void *arg)
 	return 0;
 }
 
+#ifdef XENPV
 static struct evtsource *
 event_get_handler(const char *intrid)
 {
@@ -1207,3 +1210,4 @@ interrupt_construct_intrids(const kcpuse
 
 	return ii_handler;
 }
+#endif /* XENPV */

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.70 src/sys/arch/xen/xen/hypervisor.c:1.71
--- src/sys/arch/xen/xen/hypervisor.c:1.70	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/xen/hypervisor.c	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.70 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.70 2019/02/02 12:32:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $");
 
 #include 
 #include 
@@ -373,20 +373,22 @@ hypervisor_attach(device_t parent, devic
 static bool
 hypervisor_suspend(device_t dev, const pmf_qual_t *qual)
 {
+#ifdef XENPV
 	events_suspend();
 	xengnt_suspend();
-
+#endif
 	return true;
 }
 
 static bool
 hypervisor_resume(device_t dev, const pmf_qual_t *qual)
 {
+#ifdef XENPV
 	hypervisor_machdep_resume();
 
 	xengnt_resume();
 	events_resume();
-
+#endif
 	return true;
 }
 

Index: src/sys/arch/xen/xen/xen_machdep.c
diff -u src/sys/arch/xen/xen/xen_machdep.c:1.20 src/sys/arch/xen/xen/xen_machdep.c:1.21
--- src/sys/arch/xen/xen/xen_machdep.c:1.20	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/xen/xen_machdep.c	Wed Feb 13 06:52:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_machdep.c,v 1.20 2019/02/02 12:32:55 cherry Exp $	*/
+/*	$NetBSD: xen_machdep.c,v 1.21 2019/02/13 06:52:43 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.20 2019/02/02 12:32:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.21 2019/02/13 06:52:43 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -80,6 +80,7 @@ u_int	tsc_get_timecount(struct timecount
 
 bool xen_suspend_allow;
 
+#ifdef XENPV
 extern uint64_t tsc_freq;	/* XXX */
 
 static int sysctl_xen_suspend(SYSCTLFN_ARGS);
@@ -419,6 +420,7 @@ xen_suspend_domain(void)
 	aprint_verbose("domain resumed\n");
 
 }
+#endif /* XENPV */
 
 #define PRINTK_BUFSIZE 1024
 void



CVS commit: src/sys/dev/nvmm/x86

2019-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Feb 13 06:32:45 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86.h

Log Message:
Reorder the GPRs to match the CPU encoding, simplifies things on Intel.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/nvmm/x86/nvmm_x86.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/nvmm/x86/nvmm_x86.h
diff -u src/sys/dev/nvmm/x86/nvmm_x86.h:1.3 src/sys/dev/nvmm/x86/nvmm_x86.h:1.4
--- src/sys/dev/nvmm/x86/nvmm_x86.h:1.3	Sun Jan  6 16:10:51 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86.h	Wed Feb 13 06:32:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86.h,v 1.3 2019/01/06 16:10:51 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86.h,v 1.4 2019/02/13 06:32:45 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -47,21 +47,21 @@
 
 /* General Purpose Registers. */
 #define NVMM_X64_GPR_RAX		0
-#define NVMM_X64_GPR_RBX		1
-#define NVMM_X64_GPR_RCX		2
-#define NVMM_X64_GPR_RDX		3
-#define NVMM_X64_GPR_R8			4
-#define NVMM_X64_GPR_R9			5
-#define NVMM_X64_GPR_R10		6
-#define NVMM_X64_GPR_R11		7
-#define NVMM_X64_GPR_R12		8
-#define NVMM_X64_GPR_R13		9
-#define NVMM_X64_GPR_R14		10
-#define NVMM_X64_GPR_R15		11
-#define NVMM_X64_GPR_RDI		12
-#define NVMM_X64_GPR_RSI		13
-#define NVMM_X64_GPR_RBP		14
-#define NVMM_X64_GPR_RSP		15
+#define NVMM_X64_GPR_RCX		1
+#define NVMM_X64_GPR_RDX		2
+#define NVMM_X64_GPR_RBX		3
+#define NVMM_X64_GPR_RSP		4
+#define NVMM_X64_GPR_RBP		5
+#define NVMM_X64_GPR_RSI		6
+#define NVMM_X64_GPR_RDI		7
+#define NVMM_X64_GPR_R8			8
+#define NVMM_X64_GPR_R9			9
+#define NVMM_X64_GPR_R10		10
+#define NVMM_X64_GPR_R11		11
+#define NVMM_X64_GPR_R12		12
+#define NVMM_X64_GPR_R13		13
+#define NVMM_X64_GPR_R14		14
+#define NVMM_X64_GPR_R15		15
 #define NVMM_X64_GPR_RIP		16
 #define NVMM_X64_GPR_RFLAGS		17
 #define NVMM_X64_NGPR			18



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

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 06:15:51 UTC 2019

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
Catchup with struct intrstub; unification.

This should fix dom0 build breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/x86/pintr.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/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.9 src/sys/arch/xen/x86/pintr.c:1.10
--- src/sys/arch/xen/x86/pintr.c:1.9	Wed Oct 10 02:34:08 2018
+++ src/sys/arch/xen/x86/pintr.c	Wed Feb 13 06:15:51 2019
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.9 2018/10/10 02:34:08 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.10 2019/02/13 06:15:51 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -135,17 +135,19 @@ __KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.
 /* XXX: todo - compat with lapic.c and XEN for x2apic */
 bool x2apic_mode __read_mostly = false;
 /* for x86/i8259.c */
-struct intrstub legacy_stubs[NUM_LEGACY_IRQS] = {{0,0}};
+struct intrstub legacy_stubs[NUM_LEGACY_IRQS] = {{0,0,0}};
 /* for x86/ioapic.c */
-struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0,0}};
-struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};
-struct intrstub x2apic_edge_stubs[MAX_INTR_SOURCES] = {{0,0}};
-struct intrstub x2apic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};
+struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
+struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
+struct intrstub x2apic_edge_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
+struct intrstub x2apic_level_stubs[MAX_INTR_SOURCES] = {{0,0,0}};
 #include 
+#endif /* NIOAPIC */
+
 int irq2port[NR_EVENT_CHANNELS] = {0}; /* actually port + 1, so that 0 is invaid */
 static int irq2vect[256] = {0};
 static int vect2irq[256] = {0};
-#endif /* NIOAPIC */
+
 #if NACPICA > 0
 #include 
 #include 



CVS commit: src/sys/arch

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:36:59 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S

Log Message:
Rig the hypercall callback page such that when the kernel happens to
run without a XEN domain loader having previously overwritten the
hypercall page with its hypercall trampoline machine code, we still
get to detect its presence by calling the xen_version hypercall stub.

We use this hack to detect the presence or absence of the hypervisor,
without relying on the MSR support on HVM domains.

This works as an added sanity check that the hypercall page
registration has indeed succeeded in HVM mode.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/i386/i386/locore.S

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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.176 src/sys/arch/amd64/amd64/locore.S:1.177
--- src/sys/arch/amd64/amd64/locore.S:1.176	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/locore.S	Wed Feb 13 05:36:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.176 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: locore.S,v 1.177 2019/02/13 05:36:59 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -278,6 +278,8 @@
 #define __ASSEMBLY__
 #include 
 #include 
+#endif	/* XEN */
+
 #ifdef XENPV	
 #define ELFNOTE(name, type, desctype, descdata...) \
 .pushsection .note.name			;	\
@@ -312,7 +314,6 @@
 	ELFNOTE(Xen, XEN_ELFNOTE_BSD_SYMTAB, .asciz, "yes")
 #endif
 #endif  /* XENPV */	
-#endif	/* XEN */
 
 /*
  * Initialization
@@ -979,9 +980,12 @@ END(start)
 #if defined(XEN)
 /* space for the hypercall call page */
 #define HYPERCALL_PAGE_OFFSET 0x1000
-.org HYPERCALL_PAGE_OFFSET
-ENTRY(hypercall_page)
-.skip 0x1000
+.align HYPERCALL_PAGE_OFFSET
+ENTRY(hypercall_page) /* Returns -1, on HYPERVISOR_xen_version() */
+.skip	(__HYPERVISOR_xen_version*32), 0x90
+	movq	$-1, %rax
+	retq
+.align HYPERCALL_PAGE_OFFSET, 0x90
 END(hypercall_page)
 #endif /* XEN */
 

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.163 src/sys/arch/i386/i386/locore.S:1.164
--- src/sys/arch/i386/i386/locore.S:1.163	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/i386/locore.S	Wed Feb 13 05:36:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.163 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: locore.S,v 1.164 2019/02/13 05:36:59 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.163 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.164 2019/02/13 05:36:59 cherry Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -242,6 +242,20 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 	loop	1b			;
 
 
+#ifdef XEN
+/*
+ * Unfortunately, the Xen codebase uses nonstandard preprocessing tools.
+ * See: https://xenbits.xen.org/gitweb/?p=xen.git=search=HEAD=grep=__UnDeF__
+ * for a fine selection of examples.
+ *
+ * What this means for us here is that we can't include the standard
+ * xen.h header in assembler code.
+ *
+ * So we have to manually define, and keep track of the values we need, ourselves.
+ */
+#define __HYPERVISOR_xen_version  17
+#endif	/* XEN */
+
 #ifdef XENPV
 /*
  * Xen guest identifier and loader selection
@@ -916,9 +930,12 @@ END(start)
 #if defined(XEN)
 /* space for the hypercall call page */
 #define HYPERCALL_PAGE_OFFSET 0x1000
-.org HYPERCALL_PAGE_OFFSET
-ENTRY(hypercall_page)
-.skip 0x1000
+.align HYPERCALL_PAGE_OFFSET
+ENTRY(hypercall_page) /* Returns -1, on HYPERVISOR_xen_version() */
+.skip	(__HYPERVISOR_xen_version*32), 0x90
+	movl	$-1, %eax
+	retl
+.align HYPERCALL_PAGE_OFFSET, 0x90
 END(hypercall_page)
 
 #ifdef XENPV



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

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:28:50 UTC 2019

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

Log Message:
Missed the crucial header file in previous commit.

struct intrstub; is now uniform across native and XEN

This should fix the XEN builds.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x86/include/intr.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/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.58 src/sys/arch/x86/include/intr.h:1.59
--- src/sys/arch/x86/include/intr.h:1.58	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/x86/include/intr.h	Wed Feb 13 05:28:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.58 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: intr.h,v 1.59 2019/02/13 05:28:50 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -71,9 +71,7 @@
  */
 
 struct intrstub {
-#if !defined(XENPV)
 	void *ist_entry;
-#endif
 	void *ist_recurse;
 	void *ist_resume;
 };



CVS commit: src/sys/arch

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 05:01:58 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: vector.S
src/sys/arch/i386/i386: vector.S
src/sys/arch/xen/xen: evtchn.c

Log Message:
In preparation for debut-ing PVHVM mode:

 - Make the struct intrstub uniform across native and XEN.
 - Introduce vector callback entrypoints for PVHVM mode.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/xen/xen/evtchn.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/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.66 src/sys/arch/amd64/amd64/vector.S:1.67
--- src/sys/arch/amd64/amd64/vector.S:1.66	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/vector.S	Wed Feb 13 05:01:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.66 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: vector.S,v 1.67 2019/02/13 05:01:57 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -631,19 +631,7 @@ LABEL(name ## _stubs); \
 	INTRSTUB_ENTRY(name ## 31)		; \
 END(name ## _stubs)
 
-	.section .rodata
-
-INTRSTUB_ARRAY_16(legacy)
-
-#if NIOAPIC > 0
-INTRSTUB_ARRAY_32(ioapic_edge)
-INTRSTUB_ARRAY_32(ioapic_level)
-
-INTRSTUB_ARRAY_32(x2apic_edge)
-INTRSTUB_ARRAY_32(x2apic_level)
-#endif
-
-#endif /* !defined(XENPV) */
+#endif /* !XENPV */
 
 #if defined(XEN)
 /* Resume/recurse procedures for spl() */
@@ -715,39 +703,49 @@ XENINTRSTUB(xenev,29,voidop,voidop,voido
 XENINTRSTUB(xenev,30,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
 XENINTRSTUB(xenev,31,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
 
+/* On Xen, the xenev_stubs are purely for spl entry, since there is no
+ * vector based mechanism. We however provide the entrypoint to ensure
+ * that native and Xen struct intrstub ; definitions are uniform.
+ */
+panicmsg:	.ascii "vector Xen event entry path entered."
+LABEL(entry_xenev)
+	movq $panicmsg, %rdi
+	callq _C_LABEL(panic)
+END(entry_xenev)
+
 LABEL(xenev_stubs)
-	.quad _C_LABEL(Xrecurse_xenev0), _C_LABEL(Xresume_xenev0)
-	.quad _C_LABEL(Xrecurse_xenev1) ,_C_LABEL(Xresume_xenev1)
-	.quad _C_LABEL(Xrecurse_xenev2) ,_C_LABEL(Xresume_xenev2)
-	.quad _C_LABEL(Xrecurse_xenev3) ,_C_LABEL(Xresume_xenev3)
-	.quad _C_LABEL(Xrecurse_xenev4) ,_C_LABEL(Xresume_xenev4)
-	.quad _C_LABEL(Xrecurse_xenev5) ,_C_LABEL(Xresume_xenev5)
-	.quad _C_LABEL(Xrecurse_xenev6) ,_C_LABEL(Xresume_xenev6)
-	.quad _C_LABEL(Xrecurse_xenev7) ,_C_LABEL(Xresume_xenev7)
-	.quad _C_LABEL(Xrecurse_xenev8) ,_C_LABEL(Xresume_xenev8)
-	.quad _C_LABEL(Xrecurse_xenev9) ,_C_LABEL(Xresume_xenev9)
-	.quad _C_LABEL(Xrecurse_xenev10), _C_LABEL(Xresume_xenev10)
-	.quad _C_LABEL(Xrecurse_xenev11), _C_LABEL(Xresume_xenev11)
-	.quad _C_LABEL(Xrecurse_xenev12), _C_LABEL(Xresume_xenev12)
-	.quad _C_LABEL(Xrecurse_xenev13), _C_LABEL(Xresume_xenev13)
-	.quad _C_LABEL(Xrecurse_xenev14), _C_LABEL(Xresume_xenev14)
-	.quad _C_LABEL(Xrecurse_xenev15), _C_LABEL(Xresume_xenev15)
-	.quad _C_LABEL(Xrecurse_xenev16), _C_LABEL(Xresume_xenev16)
-	.quad _C_LABEL(Xrecurse_xenev17), _C_LABEL(Xresume_xenev17)
-	.quad _C_LABEL(Xrecurse_xenev18), _C_LABEL(Xresume_xenev18)
-	.quad _C_LABEL(Xrecurse_xenev19), _C_LABEL(Xresume_xenev19)
-	.quad _C_LABEL(Xrecurse_xenev20), _C_LABEL(Xresume_xenev20)
-	.quad _C_LABEL(Xrecurse_xenev21), _C_LABEL(Xresume_xenev21)
-	.quad _C_LABEL(Xrecurse_xenev22), _C_LABEL(Xresume_xenev22)
-	.quad _C_LABEL(Xrecurse_xenev23), _C_LABEL(Xresume_xenev23)
-	.quad _C_LABEL(Xrecurse_xenev24), _C_LABEL(Xresume_xenev24)
-	.quad _C_LABEL(Xrecurse_xenev25), _C_LABEL(Xresume_xenev25)
-	.quad _C_LABEL(Xrecurse_xenev26), _C_LABEL(Xresume_xenev26)
-	.quad _C_LABEL(Xrecurse_xenev27), _C_LABEL(Xresume_xenev27)
-	.quad _C_LABEL(Xrecurse_xenev28), _C_LABEL(Xresume_xenev28)
-	.quad _C_LABEL(Xrecurse_xenev29), _C_LABEL(Xresume_xenev29)
-	.quad _C_LABEL(Xrecurse_xenev30), _C_LABEL(Xresume_xenev30)
-	.quad _C_LABEL(Xrecurse_xenev31), _C_LABEL(Xresume_xenev31)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev0), _C_LABEL(Xresume_xenev0)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev1) ,_C_LABEL(Xresume_xenev1)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev2) ,_C_LABEL(Xresume_xenev2)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev3) ,_C_LABEL(Xresume_xenev3)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev4) ,_C_LABEL(Xresume_xenev4)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev5) ,_C_LABEL(Xresume_xenev5)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev6) ,_C_LABEL(Xresume_xenev6)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev7) ,_C_LABEL(Xresume_xenev7)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev8) ,_C_LABEL(Xresume_xenev8)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev9) ,_C_LABEL(Xresume_xenev9)
+	.quad entry_xenev, _C_LABEL(Xrecurse_xenev10), 

CVS commit: src/sys/dev/mii

2019-02-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 04:35:58 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.138 src/sys/dev/mii/miidevs.h:1.139
--- src/sys/dev/mii/miidevs.h:1.138	Wed Feb 13 03:54:53 2019
+++ src/sys/dev/mii/miidevs.h	Wed Feb 13 04:35:58 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.138 2019/02/13 03:54:53 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.139 2019/02/13 04:35:58 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.136 2019/02/13 03:54:16 msaitoh Exp
+ *	NetBSD: miidevs,v 1.139 2019/02/13 04:35:28 msaitoh Exp
  */
 
 /*-
@@ -161,10 +161,10 @@
 /* Don't know the model for ACXXX */
 #define	MII_MODEL_ALTIMA_ACXXX	0x0001
 #define	MII_STR_ALTIMA_ACXXX	"ACXXX 10/100 media interface"
-#define	MII_MODEL_ALTIMA_AC101	0x0021
-#define	MII_STR_ALTIMA_AC101	"AC101 10/100 media interface"
 #define	MII_MODEL_ALTIMA_AC101L	0x0012
 #define	MII_STR_ALTIMA_AC101L	"AC101L 10/100 media interface"
+#define	MII_MODEL_ALTIMA_AC101	0x0021
+#define	MII_STR_ALTIMA_AC101	"AC101 10/100 media interface"
 /* AMD Am79C87[45] have ALTIMA OUI */
 #define	MII_MODEL_ALTIMA_Am79C875	0x0014
 #define	MII_STR_ALTIMA_Am79C875	"Am79C875 10/100 media interface"
@@ -187,12 +187,12 @@
 #define	MII_STR_xxBROADCOM_3C905B	"Broadcom 3c905B internal PHY"
 #define	MII_MODEL_xxBROADCOM_3C905C	0x0017
 #define	MII_STR_xxBROADCOM_3C905C	"Broadcom 3c905C internal PHY"
+#define	MII_MODEL_xxBROADCOM_BCM5221	0x001e
+#define	MII_STR_xxBROADCOM_BCM5221	"BCM5221 10/100 media interface"
 #define	MII_MODEL_xxBROADCOM_BCM5201	0x0021
 #define	MII_STR_xxBROADCOM_BCM5201	"BCM5201 10/100 media interface"
 #define	MII_MODEL_xxBROADCOM_BCM5214	0x0028
 #define	MII_STR_xxBROADCOM_BCM5214	"BCM5214 Quad 10/100 media interface"
-#define	MII_MODEL_xxBROADCOM_BCM5221	0x001e
-#define	MII_STR_xxBROADCOM_BCM5221	"BCM5221 10/100 media interface"
 #define	MII_MODEL_xxBROADCOM_BCM5222	0x0032
 #define	MII_STR_xxBROADCOM_BCM5222	"BCM5222 Dual 10/100 media interface"
 #define	MII_MODEL_xxBROADCOM_BCM4401	0x0036
@@ -203,8 +203,14 @@
 #define	MII_STR_BROADCOM_BCM5400	"BCM5400 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM_BCM5401	0x0005
 #define	MII_STR_BROADCOM_BCM5401	"BCM5401 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM_BCM5402	0x0006
+#define	MII_STR_BROADCOM_BCM5402	"BCM5402 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM_BCM5411	0x0007
 #define	MII_STR_BROADCOM_BCM5411	"BCM5411 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM_BCM5404	0x0008
+#define	MII_STR_BROADCOM_BCM5404	"BCM5404 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM_BCM5424	0x000a
+#define	MII_STR_BROADCOM_BCM5424	"BCM5424/BCM5234 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM_BCM5464	0x000b
 #define	MII_STR_BROADCOM_BCM5464	"BCM5464 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM_BCM5461	0x000c
@@ -235,10 +241,16 @@
 #define	MII_STR_BROADCOM_BCM5780	"BCM5780 1000BASE-T/X media interface"
 #define	MII_MODEL_BROADCOM_BCM5708C	0x0036
 #define	MII_STR_BROADCOM_BCM5708C	"BCM5708C 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM_BCM5466	0x003b
+#define	MII_STR_BROADCOM_BCM5466	"BCM5466 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM2_BCM5325	0x0003
 #define	MII_STR_BROADCOM2_BCM5325	"BCM5325 10/100 5-port PHY switch"
 #define	MII_MODEL_BROADCOM2_BCM5906	0x0004
 #define	MII_STR_BROADCOM2_BCM5906	"BCM5906 10/100baseTX media interface"
+#define	MII_MODEL_BROADCOM2_BCM5478	0x0008
+#define	MII_STR_BROADCOM2_BCM5478	"BCM5478 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM2_BCM5488	0x0009
+#define	MII_STR_BROADCOM2_BCM5488	"BCM5488 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM2_BCM5481	0x000a
 #define	MII_STR_BROADCOM2_BCM5481	"BCM5481 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM2_BCM5482	0x000b
@@ -293,10 +305,10 @@
 #define	MII_STR_CICADA_CS8201B	"Cicada CS8201 10/100/1000TX PHY"
 #define	MII_MODEL_xxCICADA_VSC8221	0x0015
 #define	MII_STR_xxCICADA_VSC8221	"Vitesse VSC8221 10/100/1000BASE-T PHY"
-#define	MII_MODEL_xxCICADA_VSC8244	0x002c
-#define	MII_STR_xxCICADA_VSC8244	"Vitesse VSC8244 Quad 10/100/1000BASE-T PHY"
 #define	MII_MODEL_xxCICADA_CS8201B	0x0021
 #define	MII_STR_xxCICADA_CS8201B	"Cicada CS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8244	0x002c
+#define	MII_STR_xxCICADA_VSC8244	"Vitesse VSC8244 Quad 10/100/1000BASE-T PHY"
 
 /* Davicom Semiconductor PHYs */
 /* AMD Am79C873 seems to be a relabeled DM9101 */
@@ -324,6 +336,8 @@
 #define	MII_STR_ICS_1892	"ICS1892 10/100 media interface"
 #define	

CVS commit: src/sys/dev/mii

2019-02-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 04:35:28 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
- Sort by model number.
- Add missing white space.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.138 src/sys/dev/mii/miidevs:1.139
--- src/sys/dev/mii/miidevs:1.138	Wed Feb 13 04:15:01 2019
+++ src/sys/dev/mii/miidevs	Wed Feb 13 04:35:28 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.138 2019/02/13 04:15:01 msaitoh Exp $
+$NetBSD: miidevs,v 1.139 2019/02/13 04:35:28 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -221,8 +221,8 @@ model CICADA VSC8211		0x000b Cicada VSC8
 model CICADA CS8201A		0x0020 Cicada CS8201 10/100/1000TX PHY
 model CICADA CS8201B		0x0021 Cicada CS8201 10/100/1000TX PHY
 model xxCICADA VSC8221		0x0015 Vitesse VSC8221 10/100/1000BASE-T PHY
-model xxCICADA VSC8244		0x002c Vitesse VSC8244 Quad 10/100/1000BASE-T PHY
 model xxCICADA CS8201B		0x0021 Cicada CS8201 10/100/1000TX PHY
+model xxCICADA VSC8244		0x002c Vitesse VSC8244 Quad 10/100/1000BASE-T PHY
 
 /* Davicom Semiconductor PHYs */
 /* AMD Am79C873 seems to be a relabeled DM9101 */
@@ -340,6 +340,7 @@ model xxQUALSEMI QS6612		0x QS6612 1
 
 /* RDC Semiconductor PHYs */
 model RDC R6040			0x0003 R6040 10/100 media interface
+
 /* RealTek PHYs */
 model xxREALTEK RTL8169S	0x0011 RTL8169S/8110S/8211 1000BASE-T media interface
 model yyREALTEK RTL8201L	0x0020 RTL8201L 10/100 media interface



CVS commit: src/sys/dev/mii

2019-02-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 04:15:01 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
>From FreeBSD:
 - Add Broadcom BCM540[24], BCM5424, BCM5466 and BCM54[78]8.
 - Add ICS1893C.
 - Add Micrel KSZ8081 and KSZ9031.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.137 src/sys/dev/mii/miidevs:1.138
--- src/sys/dev/mii/miidevs:1.137	Wed Feb 13 04:02:11 2019
+++ src/sys/dev/mii/miidevs	Wed Feb 13 04:15:01 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.137 2019/02/13 04:02:11 msaitoh Exp $
+$NetBSD: miidevs,v 1.138 2019/02/13 04:15:01 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -169,7 +169,10 @@ model xxBROADCOM BCM4401	0x0036 BCM4401 
 model xxBROADCOM BCM5365	0x0037 BCM5365 10/100 5-port PHY switch
 model BROADCOM BCM5400		0x0004 BCM5400 1000BASE-T media interface
 model BROADCOM BCM5401		0x0005 BCM5401 1000BASE-T media interface
+model BROADCOM BCM5402		0x0006 BCM5402 1000BASE-T media interface
 model BROADCOM BCM5411		0x0007 BCM5411 1000BASE-T media interface
+model BROADCOM BCM5404		0x0008 BCM5404 1000BASE-T media interface
+model BROADCOM BCM5424		0x000a BCM5424/BCM5234 1000BASE-T media interface
 model BROADCOM BCM5464		0x000b BCM5464 1000BASE-T media interface
 model BROADCOM BCM5461		0x000c BCM5461 1000BASE-T media interface
 model BROADCOM BCM5462		0x000d BCM5462 1000BASE-T media interface
@@ -185,8 +188,11 @@ model BROADCOM BCM54K2		0x002e BCM54K2 1
 model BROADCOM BCM5714		0x0034 BCM5714 1000BASE-T/X media interface
 model BROADCOM BCM5780		0x0035 BCM5780 1000BASE-T/X media interface
 model BROADCOM BCM5708C		0x0036 BCM5708C 1000BASE-T media interface
+model BROADCOM BCM5466		0x003b BCM5466 1000BASE-T media interface
 model BROADCOM2 BCM5325		0x0003 BCM5325 10/100 5-port PHY switch
 model BROADCOM2 BCM5906		0x0004 BCM5906 10/100baseTX media interface
+model BROADCOM2 BCM5478		0x0008 BCM5478 1000BASE-T media interface
+model BROADCOM2 BCM5488		0x0009 BCM5488 1000BASE-T media interface
 model BROADCOM2 BCM5481		0x000a BCM5481 1000BASE-T media interface
 model BROADCOM2 BCM5482		0x000b BCM5482 1000BASE-T media interface
 model BROADCOM2 BCM5755		0x000c BCM5755 1000BASE-T media interface
@@ -234,6 +240,7 @@ model ICS 1889			0x0001 ICS1889 10/100 m
 model ICS 1890			0x0002 ICS1890 10/100 media interface
 model ICS 1892			0x0003 ICS1892 10/100 media interface
 model ICS 1893			0x0004 ICS1893 10/100 media interface
+model ICS 1893C			0x0005 ICS1893C 10/100 media interface
 
 /* Intel PHYs */
 model xxINTEL I82553		0x i82553 10/100 media interface
@@ -304,7 +311,9 @@ model MARVELL E1000_6		0x0006 Marvell 88
 model MARVELL E		0x000c Marvell 88E Gigabit PHY
 
 /* Micrel PHYs */
+model MICREL KSZ8081		0x0016 Micrel KSZ8081 10/100 PHY
 model MICREL KSZ9021RNI		0x0021 Micrel KSZ9021RNI 10/100/1000 PHY
+model MICREL KSZ9031		0x0022 Micrel KSZ9031 10/100/1000 PHY
 
 /* Myson Technology PHYs */
 model xxMYSON MTD972		0x MTD972 10/100 media interface



CVS commit: src/sys/dev/mii

2019-02-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 04:02:11 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Sort by model number.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.136 src/sys/dev/mii/miidevs:1.137
--- src/sys/dev/mii/miidevs:1.136	Wed Feb 13 03:54:16 2019
+++ src/sys/dev/mii/miidevs	Wed Feb 13 04:02:11 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.136 2019/02/13 03:54:16 msaitoh Exp $
+$NetBSD: miidevs,v 1.137 2019/02/13 04:02:11 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -145,8 +145,8 @@ model ATTANSIC AR8035		0x0007 Atheros AR
 /* Altima Communications PHYs */
 /* Don't know the model for ACXXX */
 model ALTIMA ACXXX		0x0001 ACXXX 10/100 media interface
-model ALTIMA AC101		0x0021 AC101 10/100 media interface
 model ALTIMA AC101L		0x0012 AC101L 10/100 media interface
+model ALTIMA AC101		0x0021 AC101 10/100 media interface
 /* AMD Am79C87[45] have ALTIMA OUI */
 model ALTIMA Am79C875		0x0014 Am79C875 10/100 media interface
 model ALTIMA Am79C874		0x0021 Am79C874 10/100 media interface
@@ -161,9 +161,9 @@ model yyAMD 79c901home		0x0039 Am79C901 
 /* Broadcom Corp. PHYs */
 model xxBROADCOM 3C905B		0x0012 Broadcom 3c905B internal PHY
 model xxBROADCOM 3C905C		0x0017 Broadcom 3c905C internal PHY
+model xxBROADCOM BCM5221	0x001e BCM5221 10/100 media interface
 model xxBROADCOM BCM5201	0x0021 BCM5201 10/100 media interface
 model xxBROADCOM BCM5214	0x0028 BCM5214 Quad 10/100 media interface
-model xxBROADCOM BCM5221	0x001e BCM5221 10/100 media interface
 model xxBROADCOM BCM5222	0x0032 BCM5222 Dual 10/100 media interface
 model xxBROADCOM BCM4401	0x0036 BCM4401 10/100 media interface
 model xxBROADCOM BCM5365	0x0037 BCM5365 10/100 5-port PHY switch
@@ -264,12 +264,12 @@ model JMICRON JMC260		0x0022 JMC260 10/1
 
 /* Level 1 PHYs */
 model xxLEVEL1 LXT970		0x LXT970 10/100 media interface
-model LEVEL1 LXT971		0x000e LXT971/2 10/100 media interface
-model LEVEL1 LXT973		0x0021 LXT973 10/100 Dual PHY
+model LEVEL1 LXT1000_OLD	0x0003 LXT1000 1000BASE-T media interface
 model LEVEL1 LXT974		0x0004 LXT974 10/100 Quad PHY
 model LEVEL1 LXT975		0x0005 LXT975 10/100 Quad PHY
-model LEVEL1 LXT1000_OLD	0x0003 LXT1000 1000BASE-T media interface
 model LEVEL1 LXT1000		0x000c LXT1000 1000BASE-T media interface
+model LEVEL1 LXT971		0x000e LXT971/2 10/100 media interface
+model LEVEL1 LXT973		0x0021 LXT973 10/100 Dual PHY
 
 /* Marvell Semiconductor PHYs */
 model xxMARVELL E1000		0x Marvell 88E1000 Gigabit PHY
@@ -332,8 +332,8 @@ model xxQUALSEMI QS6612		0x QS6612 1
 /* RDC Semiconductor PHYs */
 model RDC R6040			0x0003 R6040 10/100 media interface
 /* RealTek PHYs */
-model yyREALTEK RTL8201L	0x0020 RTL8201L 10/100 media interface
 model xxREALTEK RTL8169S	0x0011 RTL8169S/8110S/8211 1000BASE-T media interface
+model yyREALTEK RTL8201L	0x0020 RTL8201L 10/100 media interface
 model REALTEK RTL8251		0x RTL8251 1000BASE-T media interface
 model REALTEK RTL8201E		0x0008 RTL8201E 10/100 media interface
 model REALTEK RTL8169S		0x0011 RTL8169S/8110S/8211 1000BASE-T media interface



CVS commit: src/sys/dev/mii

2019-02-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 03:54:16 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
- Add Tridium, Data Track Technology, Netas, Ralink Technology,
  Sunplus Technology and ADMtek's OUI.
- Sort by OUI.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.135 src/sys/dev/mii/miidevs:1.136
--- src/sys/dev/mii/miidevs:1.135	Wed Feb 13 03:44:55 2019
+++ src/sys/dev/mii/miidevs	Wed Feb 13 03:54:16 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.135 2019/02/13 03:44:55 msaitoh Exp $
+$NetBSD: miidevs,v 1.136 2019/02/13 03:54:16 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -51,14 +51,21 @@ $NetBSD: miidevs,v 1.135 2019/02/13 03:4
 
 oui AMD0x1a	Advanced Micro Devices
 oui VITESSE			0x0001c1	Vitesse
+oui TRIDIUM			0x0001f0	Tridium
+oui DATATRACK			0x0002c6	Data Track Technology
 oui CICADA			0x0003f1	Cicada Semiconductor
 oui AGERE			0x00053d	Agere
+oui NETAS			0x0009c3	Netas
 oui BROADCOM2			0x000af7	Broadcom Corporation
+oui RALINK			0x000c43	Ralink Technology
+oui ASIX			0x000ec6	ASIX
 oui BROADCOM			0x001018	Broadcom Corporation
 oui MICREL			0x0010a1	Micrel
 oui ALTIMA			0x0010a9	Altima Communications
 oui ENABLESEMI			0x0010dd	Enable Semiconductor
+oui SUNPLUS			0x001105	Sunplus Technology
 oui ATHEROS			0x001374	Atheros
+oui RALINK2			0x0017a5	Ralink Technology
 oui BROADCOM3			0x001be9	Broadcom Corporation
 oui LEVEL1			0x00207b	Level 1
 oui VIA0x004063	VIA Technologies
@@ -78,8 +85,8 @@ oui JMICRON			0x00d831	JMicron
 oui PMCSIERRA			0x00e004	PMC-Sierra
 oui SIS0x00e006	Silicon Integrated Systems
 oui REALTEK			0x00e04c	RealTek
+oui ADMTEK			0x00e092	ADMtek
 oui XAQTI			0x00e0ae	XaQti Corp.
-oui ASIX			0x000ec6	ASIX
 oui NATSEMI			0x080017	National Semiconductor
 oui TI0x080028	Texas Instruments
 oui BROADCOM4			0x18c086	Broadcom Corporation



CVS commit: src/sys/dev/mii

2019-02-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 03:54:53 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.137 src/sys/dev/mii/miidevs.h:1.138
--- src/sys/dev/mii/miidevs.h:1.137	Sat Feb  9 07:46:07 2019
+++ src/sys/dev/mii/miidevs.h	Wed Feb 13 03:54:53 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.137 2019/02/09 07:46:07 rin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.138 2019/02/13 03:54:53 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.133 2019/02/08 09:16:11 msaitoh Exp
+ *	NetBSD: miidevs,v 1.136 2019/02/13 03:54:16 msaitoh Exp
  */
 
 /*-
@@ -57,16 +57,25 @@
  */
 
 #define	MII_OUI_AMD	0x1a	/* Advanced Micro Devices */
+#define	MII_OUI_VITESSE	0x0001c1	/* Vitesse */
+#define	MII_OUI_TRIDIUM	0x0001f0	/* Tridium */
+#define	MII_OUI_DATATRACK	0x0002c6	/* Data Track Technology */
 #define	MII_OUI_CICADA	0x0003f1	/* Cicada Semiconductor */
 #define	MII_OUI_AGERE	0x00053d	/* Agere */
+#define	MII_OUI_NETAS	0x0009c3	/* Netas */
 #define	MII_OUI_BROADCOM2	0x000af7	/* Broadcom Corporation */
+#define	MII_OUI_RALINK	0x000c43	/* Ralink Technology */
+#define	MII_OUI_ASIX	0x000ec6	/* ASIX */
 #define	MII_OUI_BROADCOM	0x001018	/* Broadcom Corporation */
 #define	MII_OUI_MICREL	0x0010a1	/* Micrel */
 #define	MII_OUI_ALTIMA	0x0010a9	/* Altima Communications */
 #define	MII_OUI_ENABLESEMI	0x0010dd	/* Enable Semiconductor */
+#define	MII_OUI_SUNPLUS	0x001105	/* Sunplus Technology */
 #define	MII_OUI_ATHEROS	0x001374	/* Atheros */
+#define	MII_OUI_RALINK2	0x0017a5	/* Ralink Technology */
 #define	MII_OUI_BROADCOM3	0x001be9	/* Broadcom Corporation */
 #define	MII_OUI_LEVEL1	0x00207b	/* Level 1 */
+#define	MII_OUI_VIA	0x004063	/* VIA Technologies */
 #define	MII_OUI_MARVELL	0x005043	/* Marvell Semiconductor */
 #define	MII_OUI_QUALSEMI	0x006051	/* Quality Semiconductor */
 #define	MII_OUI_DAVICOM	0x00606e	/* Davicom Semiconductor */
@@ -83,9 +92,11 @@
 #define	MII_OUI_PMCSIERRA	0x00e004	/* PMC-Sierra */
 #define	MII_OUI_SIS	0x00e006	/* Silicon Integrated Systems */
 #define	MII_OUI_REALTEK	0x00e04c	/* RealTek */
+#define	MII_OUI_ADMTEK	0x00e092	/* ADMtek */
 #define	MII_OUI_XAQTI	0x00e0ae	/* XaQti Corp. */
 #define	MII_OUI_NATSEMI	0x080017	/* National Semiconductor */
 #define	MII_OUI_TI	0x080028	/* Texas Instruments */
+#define	MII_OUI_BROADCOM4	0x18c086	/* Broadcom Corporation */
 
 /* Some Intel 82553's use an alternative OUI. */
 #define	MII_OUI_xxINTEL	0x001f00	/* Intel */
@@ -264,6 +275,8 @@
 #define	MII_STR_BROADCOM3_BCM57765	"BCM57765 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM3_BCM5720C	0x0036
 #define	MII_STR_BROADCOM3_BCM5720C	"BCM5720C 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM4_BCM5725C	0x0038
+#define	MII_STR_BROADCOM4_BCM5725C	"BCM5725C 1000BASE-T media interface"
 #define	MII_MODEL_xxBROADCOM_ALT1_BCM5906	0x0004
 #define	MII_STR_xxBROADCOM_ALT1_BCM5906	"BCM5906 10/100baseTX media interface"
  
@@ -528,6 +541,16 @@
 #define	MII_MODEL_xxTSC_78Q2121	0x0015
 #define	MII_STR_xxTSC_78Q2121	"78Q2121 100BASE-TX media interface"
 
+/* VIA Technologies PHYs */
+#define	MII_MODEL_VIA_VT6103	0x0032
+#define	MII_STR_VIA_VT6103	"VT6103 10/100 PHY"
+#define	MII_MODEL_VIA_VT6103_2	0x0034
+#define	MII_STR_VIA_VT6103_2	"VT6103 10/100 PHY"
+
+/* Vitesse PHYs */
+#define	MII_MODEL_VITESSE_VSC8601	0x0002
+#define	MII_STR_VITESSE_VSC8601	"VSC8601 10/100/1000 PHY"
+
 /* XaQti Corp. PHYs */
 #define	MII_MODEL_xxXAQTI_XMACII	0x
 #define	MII_STR_xxXAQTI_XMACII	"XaQti Corp. XMAC II gigabit interface"

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.125 src/sys/dev/mii/miidevs_data.h:1.126
--- src/sys/dev/mii/miidevs_data.h:1.125	Sat Feb  9 07:46:07 2019
+++ src/sys/dev/mii/miidevs_data.h	Wed Feb 13 03:54:53 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.125 2019/02/09 07:46:07 rin Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.126 2019/02/13 03:54:53 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.133 2019/02/08 09:16:11 msaitoh Exp
+ *	NetBSD: miidevs,v 1.136 2019/02/13 03:54:16 msaitoh Exp
  */
 
 /*-
@@ -100,6 +100,7 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_BROADCOM3, MII_MODEL_BROADCOM3_BCM5719C, MII_STR_BROADCOM3_BCM5719C },
  { MII_OUI_BROADCOM3, MII_MODEL_BROADCOM3_BCM57765, MII_STR_BROADCOM3_BCM57765 },
  { MII_OUI_BROADCOM3, MII_MODEL_BROADCOM3_BCM5720C, MII_STR_BROADCOM3_BCM5720C },
+ { MII_OUI_BROADCOM4, MII_MODEL_BROADCOM4_BCM5725C, MII_STR_BROADCOM4_BCM5725C },
  { 

CVS commit: src/sys/dev/mii

2019-02-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 03:44:55 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
>From OpenBSD:
 - Add ASIX OUI.
 - Add VIA OUI and devices.
 - Add Vitesse OUI and devices.
>From FreeBSD:
 - Add BROADCOM4.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.134 src/sys/dev/mii/miidevs:1.135
--- src/sys/dev/mii/miidevs:1.134	Sat Feb  9 07:45:34 2019
+++ src/sys/dev/mii/miidevs	Wed Feb 13 03:44:55 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.134 2019/02/09 07:45:34 rin Exp $
+$NetBSD: miidevs,v 1.135 2019/02/13 03:44:55 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -50,6 +50,7 @@ $NetBSD: miidevs,v 1.134 2019/02/09 07:4
  */
 
 oui AMD0x1a	Advanced Micro Devices
+oui VITESSE			0x0001c1	Vitesse
 oui CICADA			0x0003f1	Cicada Semiconductor
 oui AGERE			0x00053d	Agere
 oui BROADCOM2			0x000af7	Broadcom Corporation
@@ -60,6 +61,7 @@ oui ENABLESEMI			0x0010dd	Enable Semicon
 oui ATHEROS			0x001374	Atheros
 oui BROADCOM3			0x001be9	Broadcom Corporation
 oui LEVEL1			0x00207b	Level 1
+oui VIA0x004063	VIA Technologies
 oui MARVELL			0x005043	Marvell Semiconductor
 oui QUALSEMI			0x006051	Quality Semiconductor
 oui DAVICOM			0x00606e	Davicom Semiconductor
@@ -77,8 +79,10 @@ oui PMCSIERRA			0x00e004	PMC-Sierra
 oui SIS0x00e006	Silicon Integrated Systems
 oui REALTEK			0x00e04c	RealTek
 oui XAQTI			0x00e0ae	XaQti Corp.
+oui ASIX			0x000ec6	ASIX
 oui NATSEMI			0x080017	National Semiconductor
 oui TI0x080028	Texas Instruments
+oui BROADCOM4			0x18c086	Broadcom Corporation
 
 /* Some Intel 82553's use an alternative OUI. */
 oui xxINTEL			0x001f00	Intel
@@ -194,6 +198,7 @@ model BROADCOM3 BCM5717C	0x0020 BCM5717C
 model BROADCOM3 BCM5719C	0x0022 BCM5719C 1000BASE-T media interface
 model BROADCOM3 BCM57765	0x0024 BCM57765 1000BASE-T media interface
 model BROADCOM3 BCM5720C	0x0036 BCM5720C 1000BASE-T media interface
+model BROADCOM4 BCM5725C	0x0038 BCM5725C 1000BASE-T media interface
 model xxBROADCOM_ALT1 BCM5906	0x0004 BCM5906 10/100baseTX media interface
  
 /* Cicada Semiconductor PHYs (now owned by Vitesse?) */
@@ -347,5 +352,12 @@ model TI TNETE2101		0x0003 TNETE2101 med
 model xxTSC 78Q2120		0x0014 78Q2120 10/100 media interface
 model xxTSC 78Q2121		0x0015 78Q2121 100BASE-TX media interface
 
+/* VIA Technologies PHYs */
+model VIA VT6103		0x0032	VT6103 10/100 PHY
+model VIA VT6103_2		0x0034	VT6103 10/100 PHY
+
+/* Vitesse PHYs */
+model VITESSE VSC8601		0x0002	VSC8601 10/100/1000 PHY
+
 /* XaQti Corp. PHYs */
 model xxXAQTI XMACII		0x XaQti Corp. XMAC II gigabit interface



CVS commit: src/external/mpl/bind/dist/lib/isc/unix

2019-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 13 01:16:30 UTC 2019

Modified Files:
src/external/mpl/bind/dist/lib/isc/unix: socket.c

Log Message:
cleanup unused stuff now that we execute directly and not in a separate task.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mpl/bind/dist/lib/isc/unix/socket.c

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

Modified files:

Index: src/external/mpl/bind/dist/lib/isc/unix/socket.c
diff -u src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.6 src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.7
--- src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.6	Mon Feb 11 21:38:55 2019
+++ src/external/mpl/bind/dist/lib/isc/unix/socket.c	Tue Feb 12 20:16:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.c,v 1.6 2019/02/12 02:38:55 christos Exp $	*/
+/*	$NetBSD: socket.c,v 1.7 2019/02/13 01:16:30 christos Exp $	*/
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -351,14 +351,6 @@ struct isc__socket {
 	charname[16];
 	void *tag;
 
-	/*
-	 * Internal events.  Posted when a descriptor is readable or
-	 * writable.  These are statically allocated and never freed.
-	 * They will be set to non-purgable before use.
-	 */
-	intev_t			readable_ev;
-	intev_t			writable_ev;
-
 	ISC_LIST(isc_socketevent_t)		send_list;
 	ISC_LIST(isc_socketevent_t)		recv_list;
 	ISC_LIST(isc_socket_newconnev_t)	accept_list;
@@ -366,9 +358,7 @@ struct isc__socket {
 
 	isc_sockaddr_t		peer_address;   /* remote address */
 
-	unsigned int		pending_recv : 1,
-pending_send : 1,
-listener : 1,   /* listener socket */
+	unsigned int		listener : 1,   /* listener socket */
 connected : 1,
 connecting : 1, /* connect pending */
 bound : 1,  /* bound to local addr */
@@ -380,10 +370,10 @@ struct isc__socket {
 	unsigned char		overflow; /* used for MSG_TRUNC fake */
 #endif
 
-void*fdwatcharg;
-isc_sockfdwatch_t   fdwatchcb;
-int fdwatchflags;
-isc_task_t  *fdwatchtask;
+	void			*fdwatcharg;
+	isc_sockfdwatch_t	fdwatchcb;
+	int			fdwatchflags;
+	isc_task_t  *fdwatchtask;
 	unsigned int		dscp;
 };
 
@@ -474,8 +464,8 @@ static void internal_accept(isc__socket_
 static void internal_connect(isc__socket_t *);
 static void internal_recv(isc__socket_t *);
 static void internal_send(isc__socket_t *);
-static void internal_fdwatch_write(isc_task_t *, isc_event_t *);
-static void internal_fdwatch_read(isc_task_t *, isc_event_t *);
+static void internal_fdwatch_write(isc__socket_t *);
+static void internal_fdwatch_read(isc__socket_t *);
 static void process_cmsg(isc__socket_t *, struct msghdr *, isc_socketevent_t *);
 static void build_msghdr_send(isc__socket_t *, char *, isc_socketevent_t *,
 			  struct msghdr *, struct iovec *, size_t *);
@@ -1962,8 +1952,6 @@ allocate_socket(isc__socketmgr_t *manage
 	ISC_LIST_INIT(sock->accept_list);
 	ISC_LIST_INIT(sock->connect_list);
 	sock->listener = 0;
-	sock->pending_recv = 0;
-	sock->pending_send = 0;
 	sock->connected = 0;
 	sock->connecting = 0;
 	sock->bound = 0;
@@ -1974,16 +1962,6 @@ allocate_socket(isc__socketmgr_t *manage
 	 */
 	isc_mutex_init(>lock);
 
-	/*
-	 * Initialize readable and writable events.
-	 */
-	ISC_EVENT_INIT(>readable_ev, sizeof(intev_t),
-		   ISC_EVENTATTR_NOPURGE, NULL, ISC_SOCKEVENT_INTR,
-		   NULL, sock, sock, NULL, NULL);
-	ISC_EVENT_INIT(>writable_ev, sizeof(intev_t),
-		   ISC_EVENTATTR_NOPURGE, NULL, ISC_SOCKEVENT_INTW,
-		   NULL, sock, sock, NULL, NULL);
-
 	sock->common.magic = ISCAPI_SOCKET_MAGIC;
 	sock->common.impmagic = SOCKET_MAGIC;
 	*socketp = sock;
@@ -2005,8 +1983,6 @@ free_socket(isc__socket_t **socketp) {
 	INSIST(VALID_SOCKET(sock));
 	INSIST(isc_refcount_current(>references) == 0);
 	INSIST(!sock->connecting);
-	INSIST(!sock->pending_recv);
-	INSIST(!sock->pending_send);
 	INSIST(ISC_LIST_EMPTY(sock->recv_list));
 	INSIST(ISC_LIST_EMPTY(sock->send_list));
 	INSIST(ISC_LIST_EMPTY(sock->accept_list));
@@ -2820,8 +2796,6 @@ isc_socket_close(isc_socket_t *sock0) {
 	REQUIRE(sock->fd >= 0 && sock->fd < (int)sock->manager->maxsocks);
 
 	INSIST(!sock->connecting);
-	INSIST(!sock->pending_recv);
-	INSIST(!sock->pending_send);
 	INSIST(ISC_LIST_EMPTY(sock->recv_list));
 	INSIST(ISC_LIST_EMPTY(sock->send_list));
 	INSIST(ISC_LIST_EMPTY(sock->accept_list));
@@ -2849,64 +2823,22 @@ isc_socket_close(isc_socket_t *sock0) {
 	return (ISC_R_SUCCESS);
 }
 
-/*
- * I/O is possible on a given socket.  Schedule an event to this task that
- * will call an internal function to do the I/O.  This will charge the
- * task with the I/O operation and let our select loop handler get back
- * to doing something real as fast as possible.
- *
- * The socket and manager must be locked before calling this function.
- */
 static void
 

CVS commit: src/usr.sbin/gpioctl

2019-02-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Feb 12 21:41:39 UTC 2019

Modified Files:
src/usr.sbin/gpioctl: gpioctl.8

Log Message:
Document options to select alternate GPIO modes.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/gpioctl/gpioctl.8

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/gpioctl/gpioctl.8
diff -u src/usr.sbin/gpioctl/gpioctl.8:1.20 src/usr.sbin/gpioctl/gpioctl.8:1.21
--- src/usr.sbin/gpioctl/gpioctl.8:1.20	Tue Mar 18 18:20:46 2014
+++ src/usr.sbin/gpioctl/gpioctl.8	Tue Feb 12 21:41:38 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpioctl.8,v 1.20 2014/03/18 18:20:46 riastradh Exp $
+.\" $NetBSD: gpioctl.8,v 1.21 2019/02/12 21:41:38 mlelstv Exp $
 .\"
 .\" Copyright (c) 2009, 2010, 2011, 2013 Marc Balmer 
 .\" Copyright (c) 2004 Alexander Yurchenko 
@@ -141,6 +141,8 @@ invert input
 invert output
 .It pulsate
 pulsate output at a hardware-defined frequency and duty cycle
+.It alt0 - alt7
+select alternate pin function 0 to 7
 .El
 .Pp
 Note that not all the flags may be supported by the particular GPIO controller.



CVS commit: src/tests/lib/libc/sys

2019-02-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb 12 21:35:35 UTC 2019

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Rename signal1 to signal_mask_unrelated in t_ptrace_wait*

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/tests/lib/libc/sys/t_ptrace_wait.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/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.83 src/tests/lib/libc/sys/t_ptrace_wait.c:1.84
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.83	Tue Feb 12 06:00:05 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Feb 12 21:35:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.83 2019/02/12 06:00:05 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.84 2019/02/12 21:35:35 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.83 2019/02/12 06:00:05 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.84 2019/02/12 21:35:35 kamil Exp $");
 
 #include 
 #include 
@@ -3708,15 +3708,15 @@ TRACE_THREADS(trace_thread4, true, true)
 
 /// 
 
-ATF_TC(signal1);
-ATF_TC_HEAD(signal1, tc)
+ATF_TC(signal_mask_unrelated);
+ATF_TC_HEAD(signal_mask_unrelated, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"Verify that masking single unrelated signal does not stop tracer "
 	"from catching other signals");
 }
 
-ATF_TC_BODY(signal1, tc)
+ATF_TC_BODY(signal_mask_unrelated, tc)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -3777,6 +3777,8 @@ ATF_TC_BODY(signal1, tc)
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
 }
 
+/// 
+
 ATF_TC(signal2);
 ATF_TC_HEAD(signal2, tc)
 {
@@ -5369,7 +5371,8 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, trace_thread3);
 	ATF_TP_ADD_TC(tp, trace_thread4);
 
-	ATF_TP_ADD_TC(tp, signal1);
+	ATF_TP_ADD_TC(tp, signal_mask_unrelated);
+
 	ATF_TP_ADD_TC(tp, signal2);
 	ATF_TP_ADD_TC(tp, signal3);
 	ATF_TP_ADD_TC_PT_STEP(tp, signal4);



CVS commit: src/usr.sbin/sysinst

2019-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 12 18:32:15 UTC 2019

Modified Files:
src/usr.sbin/sysinst: Makefile.inc bsddisklabel.c defs.h partman.c
util.c

Log Message:
Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/sysinst/partman.c
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/sysinst/util.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/sysinst/Makefile.inc
diff -u src/usr.sbin/sysinst/Makefile.inc:1.18 src/usr.sbin/sysinst/Makefile.inc:1.19
--- src/usr.sbin/sysinst/Makefile.inc:1.18	Mon Feb 11 19:15:38 2019
+++ src/usr.sbin/sysinst/Makefile.inc	Tue Feb 12 18:32:15 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.18 2019/02/11 19:15:38 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.19 2019/02/12 18:32:15 martin Exp $
 #
 # Makefile for sysinst
 
@@ -104,6 +104,10 @@ COPTS += -Os
 CPPFLAGS+=-DINET6
 .endif
 
+.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
+COPTS+=-Wno-format-truncation	# most useless gcc warning ever
+.endif
+
 .if defined(HAVE_GCC) || defined(HAVE_PCC)
 COPTS.label.c+=	-Wno-pointer-sign
 .endif

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.7 src/usr.sbin/sysinst/bsddisklabel.c:1.8
--- src/usr.sbin/sysinst/bsddisklabel.c:1.7	Mon Feb 11 20:40:18 2019
+++ src/usr.sbin/sysinst/bsddisklabel.c	Tue Feb 12 18:32:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.7 2019/02/11 20:40:18 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.8 2019/02/12 18:32:15 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -224,7 +224,7 @@ set_ptn_size(menudesc *m, void *arg)
 	if (size == 0)
 		size = p->dflt_size;
 	size /= sizemult;
-	trunc_snprintf(dflt, sizeof dflt, "%" PRIi64 "%s",
+	snprintf(dflt, sizeof dflt, "%" PRIi64 "%s",
 	size, p == pi->pool_part ? "+" : "");
 
 	for (;;) {

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.32 src/usr.sbin/sysinst/defs.h:1.33
--- src/usr.sbin/sysinst/defs.h:1.32	Mon Feb 11 20:40:18 2019
+++ src/usr.sbin/sysinst/defs.h	Tue Feb 12 18:32:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.32 2019/02/11 20:40:18 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.33 2019/02/12 18:32:15 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -561,9 +561,6 @@ void	do_reinstall_sets(void);
 void	restore_etc(void);
 
 /* from util.c */
-/* like snprintf, but always terminates the output */
-void trunc_snprintf(char * restrict str, size_t size,
-const char * restrict format, ...) __printflike(3, 4);
 char*	str_arg_subst(const char *, size_t, const char **);
 void	msg_display_subst(const char *, size_t, ...);
 int	ask_yesno(const char *);

Index: src/usr.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.29 src/usr.sbin/sysinst/partman.c:1.30
--- src/usr.sbin/sysinst/partman.c:1.29	Mon Feb 11 20:40:18 2019
+++ src/usr.sbin/sysinst/partman.c	Tue Feb 12 18:32:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.29 2019/02/11 20:40:18 martin Exp $ */
+/*	$NetBSD: partman.c,v 1.30 2019/02/12 18:32:15 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -260,14 +260,14 @@ pm_getdevstring(char *buf, int len, pm_d
 	if (pm_cur->isspecial)
 		snprintf(buf, len, "%s", pm_cur->diskdev);
 	else if (num + 'a' < 'a' || num + 'a' > 'a' + MAXPARTITIONS) {
-		trunc_snprintf(buf, len, "%sd", pm_cur->diskdev);
+		snprintf(buf, len, "%sd", pm_cur->diskdev);
 	} else if (pm_cur->gpt) {
 		for (i = 0; i < MAX_WEDGES; i++)
 			if (wedges[i].pm == pm_cur &&
 wedges[i].ptn == num)
 snprintf(buf, len, "dk%d", i); // XXX: xxx
 	} else {
-		trunc_snprintf(buf, len, "%s%c", pm_cur->diskdev, num + 'a');
+		snprintf(buf, len, "%s%c", pm_cur->diskdev, num + 'a');
 	}
 
 	return;
@@ -1903,7 +1903,7 @@ pm_getrefdev(pm_devs_t *pm_cur)
 		for (i = 0; i < MAX_CGD; i++)
 			if (cgds[i].blocked && cgds[i].node == dev_num) {
 pm_cur->refdev = [i];
-trunc_snprintf(pm_cur->diskdev_descr,
+snprintf(pm_cur->diskdev_descr,
 sizeof(pm_cur->diskdev_descr),
 "%s (%s, %s-%d)",
 pm_cur->diskdev_descr, cgds[i].pm_name,
@@ -1917,7 +1917,7 @@ pm_getrefdev(pm_devs_t *pm_cur)
 pm_cur->refdev = [i];
 pm_getdevstring(dev, SSTRSIZE, vnds[i].pm,
 vnds[i].pm_part);
-trunc_snprintf(pm_cur->diskdev_descr,
+snprintf(pm_cur->diskdev_descr,
 sizeof(pm_cur->diskdev_descr),
 "%s (%s, %s)",
 pm_cur->diskdev_descr, dev,
@@ -1937,7 +1937,7 @@ pm_getrefdev(pm_devs_t *pm_cur)
 		else
 			num_devs++;
 	}
-trunc_snprintf(pm_cur->diskdev_descr,
+

CVS commit: src/doc

2019-02-12 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Tue Feb 12 16:13:23 UTC 2019

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new nsd


To generate a diff of this commit:
cvs rdiff -u -r1.1597 -r1.1598 src/doc/3RDPARTY
cvs rdiff -u -r1.2500 -r1.2501 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1597 src/doc/3RDPARTY:1.1598
--- src/doc/3RDPARTY:1.1597	Thu Feb  7 21:40:40 2019
+++ src/doc/3RDPARTY	Tue Feb 12 16:13:23 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1597 2019/02/07 21:40:40 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.1598 2019/02/12 16:13:23 prlw1 Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -154,7 +154,7 @@ Use cleantags to import
 run configure and update config files in include
 
 Package:	nsd
-Version:	4.1.24
+Version:	4.1.26
 Current Vers:	4.1.26
 Maintainer:	Christos Zoulas
 Archive Site:	https://www.nlnetlabs.nl/svn/nsd/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2500 src/doc/CHANGES:1.2501
--- src/doc/CHANGES:1.2500	Fri Feb  8 09:39:14 2019
+++ src/doc/CHANGES	Tue Feb 12 16:13:23 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2500 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2501 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -327,3 +327,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	ure(4): Add driver for Realtek RTL8152/RTL8153 from OpenBSD.
 		[rin 20190206]
 	dhcpcd: Import dhcpcd-7.1.1 [roy 20190207]
+	nsd: Import 4.1.26 [prlw1 20190212]



CVS import: src/external/bsd/nsd/dist

2019-02-12 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Tue Feb 12 15:49:03 UTC 2019

Update of /cvsroot/src/external/bsd/nsd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv5840

Log Message:
Import nsd-4.1.26

29 November 2018: Wouter
- Tag for 4.1.26rc1.

27 November 2018: Wouter
- Fix parsezone failure in 4194 fix.

26 November 2018: Wouter
- Fix to not set GLOB_NOSORT so the nsd.conf include: files are
  sorted and in a predictable order.
- Added nsd-control changezone.  nsd-control changezone name pattern
  allows the change of a zone pattern option without downtime for
  the zone, in one operation.
- Fix #3433: document that reconfig does not change per-zone stats.

20 November 2018: Wouter
- Fix #4205: enable-recvmmsg in mixed IPv4/IPv6 environment fails.
  This sets the msg_hdr.msg_namelen correctly after receipt.

19 November 2018: Wouter
- Support SO_REUSEPORT_LB in FreeBSD 12 with the reuseport: yes
  option in nsd.conf.
- Fix #4202: nsd-control delzone incorrect exit code on error.
- Tab style fix to use tab for 8 spaces, from Xiaobo Liu.

25 October 2018: Wouter
- Adjust dnstap socket path for chroot.

22 October 2018: Wouter
- Fix #4194: Zone file parser derailed by non-FQDN names in RHS of
  DNSSEC RRs.
- Fix some more, neater code and checks for domain length limit.
- check that the dnstap socket file can be opened and exists, print
  error if not.

4 October 2018: Wouter
- dnstap work, the dnstap.proto is a copy of the file from Unbound,
  also dnstap.m4 configure include file.
- dnstap collector: free eventbase and memclean nicer.
- dnstap collector: send data and read it in collector.
- dnstap/dnstap.c and .h from Unbound's contribution from
  Farsight Security, added to then adapt it for dnstap logging in NSD.
- dnstap.c with auth query and auth response, and called from
  the collector.
- dnstap work, config nsd.conf parse.
- dnstap example config.

25 September 2018: Wouter
- NSD 4.1.25 released, trunk has 4.1.26 in development.

18 September 2018: Wouter
- tag for NSD 4.1.25rc1.

17 September 2018: Wouter
- Fix #4156: Fix systemd service manager state change notification

14 September 2018: Wouter
- Remove unused if clause during server service startup.

13 September 2018: Wouter
- Fix typo in clang analysis test.
- Annotate exit functions with noreturn.
- nsd-control prints neater errors for file failures.

12 September 2018: Wouter
- clang analysis test.

11 September 2018: Wouter
- Fix to combine the same error function into one, from Xiaobo Liu.
- Fix initialisation in remote.c.
- please clang analyzer and fix parse of IPSECKEY with bad gateway.
- Fix unit test code for clang analyzer.
- Fix nsd-checkconf fail on bad zone name.

10 September 2018: Wouter
- Fix coding style in nsd.c

7 September 2018: Wouter
- append_trailing_slash has one implementation and is not repeated
  differently.

4 September 2018: Wouter
- Fix codingstyle in nsd-checkconf.c in patch from Sharp Liu.

15 August 2018: Wouter
- Fix use_systemd typo/leftover in remote.c.

Status:

Vendor Tag: NLNETLABS
Release Tags:   nsd-4-1-26

U src/external/bsd/nsd/dist/nsec3.h
U src/external/bsd/nsd/dist/udbzone.c
U src/external/bsd/nsd/dist/rbtree.h
U src/external/bsd/nsd/dist/udbradtree.c
U src/external/bsd/nsd/dist/lookup3.h
U src/external/bsd/nsd/dist/configyyrename.h
C src/external/bsd/nsd/dist/configparser.h
U src/external/bsd/nsd/dist/tsig.h
U src/external/bsd/nsd/dist/edns.h
U src/external/bsd/nsd/dist/iterated_hash.c
U src/external/bsd/nsd/dist/nsd.conf.5.in
U src/external/bsd/nsd/dist/namedb.c
U src/external/bsd/nsd/dist/answer.h
U src/external/bsd/nsd/dist/difffile.h
U src/external/bsd/nsd/dist/nsd-checkzone.c
C src/external/bsd/nsd/dist/zparser.h
U src/external/bsd/nsd/dist/dbaccess.c
U src/external/bsd/nsd/dist/dbcreate.c
U src/external/bsd/nsd/dist/region-allocator.c
U src/external/bsd/nsd/dist/dns.c
C src/external/bsd/nsd/dist/zparser.c
U src/external/bsd/nsd/dist/xfrd.c
U src/external/bsd/nsd/dist/zonec.c
U src/external/bsd/nsd/dist/axfr.c
U src/external/bsd/nsd/dist/nsec3.c
U src/external/bsd/nsd/dist/query.h
U src/external/bsd/nsd/dist/nsd.h
U src/external/bsd/nsd/dist/lookup3.c
U src/external/bsd/nsd/dist/config.h.in
U src/external/bsd/nsd/dist/edns.c
C src/external/bsd/nsd/dist/server.c
C src/external/bsd/nsd/dist/util.h
U src/external/bsd/nsd/dist/xfrd-disk.h
U src/external/bsd/nsd/dist/configparser.y
U src/external/bsd/nsd/dist/rbtree.c
U src/external/bsd/nsd/dist/rrl.c
U src/external/bsd/nsd/dist/xfrd-tcp.h
U src/external/bsd/nsd/dist/zlexer.lex
U src/external/bsd/nsd/dist/zonec.h
U 

CVS commit: src/sys/dev/nvmm/x86

2019-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 12 14:54:59 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_svm.c

Log Message:
Optimize: the hardware does not clear the TLB flush command after a
VMENTRY, so clear it ourselves, to avoid uselessly flushing the guest
TLB. While here also fix the processing of EFER-induced flushes, they
shouldn't be delayed.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/nvmm/x86/nvmm_x86_svm.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/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.19 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.20
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.19	Mon Feb  4 12:11:18 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Tue Feb 12 14:54:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.19 2019/02/04 12:11:18 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.20 2019/02/12 14:54:59 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.19 2019/02/04 12:11:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.20 2019/02/12 14:54:59 maxv Exp $");
 
 #include 
 #include 
@@ -1194,12 +1194,6 @@ svm_vcpu_run(struct nvmm_machine *mach, 
 		tlb_need_flush = true;
 	}
 
-	if (cpudata->tlb_want_flush || tlb_need_flush) {
-		vmcb->ctrl.tlb_ctrl = svm_ctrl_tlb_flush;
-	} else {
-		vmcb->ctrl.tlb_ctrl = 0;
-	}
-
 	if (vcpu->hcpu_last != hcpu) {
 		vmcb->ctrl.tsc_offset = cpudata->tsc_offset +
 		curcpu()->ci_data.cpu_cc_skew;
@@ -1210,6 +1204,12 @@ svm_vcpu_run(struct nvmm_machine *mach, 
 	svm_vcpu_guest_misc_enter(vcpu);
 
 	while (1) {
+		if (cpudata->tlb_want_flush || tlb_need_flush) {
+			vmcb->ctrl.tlb_ctrl = svm_ctrl_tlb_flush;
+		} else {
+			vmcb->ctrl.tlb_ctrl = 0;
+		}
+
 		s = splhigh();
 		svm_vcpu_guest_fpu_enter(vcpu);
 		svm_vmrun(cpudata->vmcb_pa, cpudata->gprs);
@@ -1219,9 +1219,8 @@ svm_vcpu_run(struct nvmm_machine *mach, 
 		svm_vmcb_cache_default(vmcb);
 
 		if (vmcb->ctrl.exitcode != VMCB_EXITCODE_INVALID) {
-			if (cpudata->tlb_want_flush) {
-cpudata->tlb_want_flush = false;
-			}
+			cpudata->tlb_want_flush = false;
+			tlb_need_flush = false;
 			vcpu->hcpu_last = hcpu;
 		}
 



CVS commit: src/lib/libnvmm

2019-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 12 14:50:21 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c

Log Message:
Optimize: fetch only 5 bytes instead of 15, the instruction can have only
up to five prefixes.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libnvmm/libnvmm_x86.c

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

Modified files:

Index: src/lib/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.20 src/lib/libnvmm/libnvmm_x86.c:1.21
--- src/lib/libnvmm/libnvmm_x86.c:1.20	Sun Feb 10 19:30:28 2019
+++ src/lib/libnvmm/libnvmm_x86.c	Tue Feb 12 14:50:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.20 2019/02/10 19:30:28 christos Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.21 2019/02/12 14:50:21 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -2958,7 +2958,7 @@ store_to_gva(struct nvmm_x64_state *stat
 static int
 fetch_segment(struct nvmm_machine *mach, struct nvmm_x64_state *state)
 {
-	uint8_t inst_bytes[15], byte;
+	uint8_t inst_bytes[5], byte;
 	size_t i, fetchsize;
 	gvaddr_t gva;
 	int ret, seg;



CVS commit: src/sys/netinet

2019-02-12 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Feb 12 14:40:38 UTC 2019

Modified Files:
src/sys/netinet: sctp_input.c sctp_usrreq.c

Log Message:
Add some fallthrough annotations.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/sctp_input.c
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet/sctp_usrreq.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/netinet/sctp_input.c
diff -u src/sys/netinet/sctp_input.c:1.11 src/sys/netinet/sctp_input.c:1.12
--- src/sys/netinet/sctp_input.c:1.11	Fri Sep 14 05:09:51 2018
+++ src/sys/netinet/sctp_input.c	Tue Feb 12 14:40:38 2019
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_input.c,v 1.28 2005/04/21 18:36:21 nishida Exp $	*/
-/*	$NetBSD: sctp_input.c,v 1.11 2018/09/14 05:09:51 maxv Exp $	*/
+/*	$NetBSD: sctp_input.c,v 1.12 2019/02/12 14:40:38 rjs Exp $	*/
 
 /*
  * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_input.c,v 1.11 2018/09/14 05:09:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_input.c,v 1.12 2019/02/12 14:40:38 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -1156,6 +1156,7 @@ sctp_process_cookie_existing(struct mbuf
 #endif
 return (NULL);
 			}
+			/* FALLTHROUGH */
 			/* intentional fall through to below... */
 
 		case SCTP_STATE_COOKIE_ECHOED:

Index: src/sys/netinet/sctp_usrreq.c
diff -u src/sys/netinet/sctp_usrreq.c:1.14 src/sys/netinet/sctp_usrreq.c:1.15
--- src/sys/netinet/sctp_usrreq.c:1.14	Mon Jan 28 12:53:01 2019
+++ src/sys/netinet/sctp_usrreq.c	Tue Feb 12 14:40:38 2019
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $	*/
-/*	$NetBSD: sctp_usrreq.c,v 1.14 2019/01/28 12:53:01 martin Exp $	*/
+/*	$NetBSD: sctp_usrreq.c,v 1.15 2019/02/12 14:40:38 rjs Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.14 2019/01/28 12:53:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.15 2019/02/12 14:40:38 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2289,7 +2289,7 @@ sctp_optsget(struct socket *so, struct s
 		*s_info = stcb->asoc.def_send;
 		SCTP_TCB_UNLOCK(stcb);
 		sopt->sopt_size = sizeof(*s_info);
-	}
+	} /* FALLTHROUGH */
 	case SCTP_INITMSG:
 	{
 		struct sctp_initmsg *sinit;



CVS commit: src/external/cddl/osnet/dev/lockstat

2019-02-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Feb 12 14:31:45 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/lockstat: lockstat.c

Log Message:
Fix build with DIAGNOSTIC:
ASSERT() is enabled ifdef DEBUG, not DIAGNOSTIC.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dev/lockstat/lockstat.c

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

Modified files:

Index: src/external/cddl/osnet/dev/lockstat/lockstat.c
diff -u src/external/cddl/osnet/dev/lockstat/lockstat.c:1.9 src/external/cddl/osnet/dev/lockstat/lockstat.c:1.10
--- src/external/cddl/osnet/dev/lockstat/lockstat.c:1.9	Mon May 28 21:05:03 2018
+++ src/external/cddl/osnet/dev/lockstat/lockstat.c	Tue Feb 12 14:31:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lockstat.c,v 1.9 2018/05/28 21:05:03 chs Exp $	*/
+/*	$NetBSD: lockstat.c,v 1.10 2019/02/12 14:31:45 rin Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.9 2018/05/28 21:05:03 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.10 2019/02/12 14:31:45 rin Exp $");
 
 #include 
 #include 
@@ -210,7 +210,7 @@ static int
 lockstat_fini(void)
 {
 	int error;
-	bool ok __diagused;
+	bool ok __debugused;
 
 	error = dtrace_unregister(lockstat_id);
 	if (error) {



CVS commit: src/sys/dev/usb

2019-02-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Feb 12 14:17:45 UTC 2019

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Do not set p->up_serialise twice in usbd_setup_pipe_flags().
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/dev/usb/usb_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/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.229 src/sys/dev/usb/usb_subr.c:1.230
--- src/sys/dev/usb/usb_subr.c:1.229	Sun Jan 27 02:08:42 2019
+++ src/sys/dev/usb/usb_subr.c	Tue Feb 12 14:17:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.229 2019/01/27 02:08:42 pgoyette Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.230 2019/02/12 14:17:44 rin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.229 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.230 2019/02/12 14:17:44 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -794,7 +794,6 @@ usbd_setup_pipe_flags(struct usbd_device
 	p->up_repeat = 0;
 	p->up_interval = ival;
 	p->up_flags = flags;
-	p->up_serialise = true;
 	SIMPLEQ_INIT(>up_queue);
 	err = dev->ud_bus->ub_methods->ubm_open(p);
 	if (err) {



CVS commit: src/sys/dev/scsipi

2019-02-12 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Feb 12 13:49:13 UTC 2019

Modified Files:
src/sys/dev/scsipi: files.scsipi

Log Message:
 Fix, but disable the commented SUN compatibility in st.c to write
 final file marks by opening and immediately closing the device
 in O_WRONLY mode. That code has not been working since around 1998.
 It can now be enabled with options ST_SUNCOMPAT.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/scsipi/files.scsipi

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/scsipi/files.scsipi
diff -u src/sys/dev/scsipi/files.scsipi:1.41 src/sys/dev/scsipi/files.scsipi:1.42
--- src/sys/dev/scsipi/files.scsipi:1.41	Sun Dec 11 12:23:50 2005
+++ src/sys/dev/scsipi/files.scsipi	Tue Feb 12 13:49:13 2019
@@ -1,11 +1,12 @@
-#	$NetBSD: files.scsipi,v 1.41 2005/12/11 12:23:50 christos Exp $
+#	$NetBSD: files.scsipi,v 1.42 2019/02/12 13:49:13 kardel Exp $
 #
 # Config file and device description for machine-independent SCSI code.
 # Included by ports that need it.  Ports that use it must provide
 # their own "major" declarations for the appropriate devices.
 
 defflag	opt_scsi.h		SCSIVERBOSE ST_ENABLE_EARLYWARN
-SES_ENABLE_PASSTHROUGH SCSI_OLD_NOINQUIRY
+ST_SUNCOMPAT SES_ENABLE_PASSTHROUGH
+SCSI_OLD_NOINQUIRY
 defparam opt_scsi.h		ST_MOUNT_DELAY SDRETRIES SD_IO_TIMEOUT
 
 defflag	opt_scsipi_debug.h	SCSIPI_DEBUG



CVS commit: src/sys/dev/scsipi

2019-02-12 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Feb 12 13:43:40 UTC 2019

Modified Files:
src/sys/dev/scsipi: st.c

Log Message:
Fix PR kern/53949:

Fix inconsistent/incomplete file mark handling to conform again
to mtio(4) at close(2) time. This was necessary as the PREVENT/ALLOW
bracket was reduced from a whole mount session to cover only the
open(2)/close(2) time on ~2002-03-22. The rationale was to allow
robots and humans to change the media during a mount session.

Unfortunately this lead to file marks being written to potentially other
media at the beginning on drives that used the two file marks as EOM
pattern. In order for that to happen the media had to be removed after
data and at most one file mark had been written before removal.

The mount error message has been clarified and a warning about
potential data/file mark lossage on UNIT ATTENTION
during an active mount session with unfinished file marks has been
added.

While there, fix, but disable the commented SUN compatibility to write
final file marks by opening and immediately closing the device
in O_WRONLY mode. That code has not been working since around 1998.
It can now be enabled with options ST_SUNCOMPAT.

Additionally debug output coverage has been extended.


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/sys/dev/scsipi/st.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/scsipi/st.c
diff -u src/sys/dev/scsipi/st.c:1.235 src/sys/dev/scsipi/st.c:1.236
--- src/sys/dev/scsipi/st.c:1.235	Sun Feb  3 03:19:28 2019
+++ src/sys/dev/scsipi/st.c	Tue Feb 12 13:43:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: st.c,v 1.235 2019/02/03 03:19:28 mrg Exp $ */
+/*	$NetBSD: st.c,v 1.236 2019/02/12 13:43:40 kardel Exp $ */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.235 2019/02/03 03:19:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.236 2019/02/12 13:43:40 kardel Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -615,8 +615,30 @@ stopen(dev_t dev, int flags, int mode, s
 		 */
 		if ((st->flags & ST_MOUNTED) || ST_MOUNT_DELAY == 0 ||
 		(st->mt_key != SKEY_NOT_READY)) {
-			device_printf(st->sc_dev, "mount error (key=%d)\n",
-st->mt_key);
+			device_printf(st->sc_dev,
+  "mount error (sense key=%d) - "
+  "terminating mount session\n",
+  st->mt_key);
+			/*
+			 * the following should not trigger unless
+			 * something serious happened while the device
+			 * was open (PREVENT MEDIUM REMOVAL in effect)
+			 */
+			if (st->flags & ST_WRITTEN &&
+			st->mt_key == SKEY_UNIT_ATTENTION) {
+/*
+ * device / media state may have changed
+ * refrain from writing missing file marks
+ * onto potentially newly inserted/formatted
+ * media (e. g. emergency EJECT/RESET/etc.)
+ */
+st->flags &= ~(ST_WRITTEN|ST_FM_WRITTEN);
+
+device_printf(st->sc_dev,
+"CAUTION: file marks/data may be missing"
+" - ASC = 0x%02x, ASCQ = 0x%02x\n",
+	  st->asc, st->ascq);
+			}
 			goto bad;
 		}
 
@@ -727,15 +749,30 @@ stclose(dev_t dev, int flags, int mode, 
 	 */
 
 	stxx = st->flags & (ST_WRITTEN | ST_FM_WRITTEN);
-	if (((flags & FWRITE) && stxx == ST_WRITTEN) ||
-	((flags & O_ACCMODE) == FWRITE && stxx == 0)) {
-		int nm;
+	if ((flags & FWRITE) != 0) {
+		int nm = 0;
+#ifdef ST_SUNCOMPAT
+		/*
+		 * on request only
+		 * original compat code has not been working
+		 * since ~1998
+		 */
+		if ((flags & O_ACCMODE) == FWRITE && (stxx == 0)) {
+			st->flags |= ST_WRITTEN;
+			SC_DEBUG(st->sc_periph, SCSIPI_DB3,
+ ("SUN compatibility: write FM(s) at close\n"));
+	}
+#endif
 		error = st_check_eod(st, FALSE, , 0);
+		SC_DEBUG(st->sc_periph, SCSIPI_DB3,
+			 ("wrote %d FM(s) at close error=%d\n", nm, error));
 	}
 
 	/* Allow robots to eject tape if needed.  */
-	scsipi_prevent(periph, SPAMR_ALLOW,
-	XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_NOT_READY);
+	if (!(st->quirks & ST_Q_NOPREVENT)) {
+		scsipi_prevent(periph, SPAMR_ALLOW,
+		XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_NOT_READY);
+	}
 
 	switch (STMODE(dev)) {
 	case NORMAL_MODE:
@@ -769,18 +806,28 @@ stclose(dev_t dev, int flags, int mode, 
 			 * If both statements are true, then we backspace
 			 * one filemark.
 			 */
+			stxx &= ~ST_FM_WRITTEN;
 			stxx |= (st->flags & ST_2FM_AT_EOD);
 			if ((flags & FWRITE) != 0 &&
 			(stxx == (ST_2FM_AT_EOD|ST_WRITTEN))) {
 error = st_space(st, -1, SP_FILEMARKS, 0);
+SC_DEBUG(st->sc_periph, SCSIPI_DB3, ("st_space(-1) error=%d\n", error));
+			} else {
+SC_DEBUG(st->sc_periph, SCSIPI_DB3, ("no backspacing - flags = 0x%x, stxx=0x%x, st->flags=0x%x\n", flags, stxx, st->flags));
 			}
+		} else {
+			SC_DEBUG(st->sc_periph, SCSIPI_DB3, ("error %d from 

CVS commit: src/sys/external/bsd/libnv/dist

2019-02-12 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Tue Feb 12 12:52:49 UTC 2019

Modified Files:
src/sys/external/bsd/libnv/dist: nvpair.c

Log Message:
libnv: Free the data array for NV_TYPE_DESCRIPTOR_ARRAY case.
Obtained from FreeBSD rev 343987 by oshogbo@.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/libnv/dist/nvpair.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/external/bsd/libnv/dist/nvpair.c
diff -u src/sys/external/bsd/libnv/dist/nvpair.c:1.4 src/sys/external/bsd/libnv/dist/nvpair.c:1.5
--- src/sys/external/bsd/libnv/dist/nvpair.c:1.4	Tue Feb 12 12:49:23 2019
+++ src/sys/external/bsd/libnv/dist/nvpair.c	Tue Feb 12 12:52:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $	*/
+/*	$NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -36,7 +36,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $");
 #else
-__RCSID("$NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $");
+__RCSID("$NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $");
 #endif
 
 #include 
@@ -2099,6 +2099,7 @@ nvpair_free(nvpair_t *nvp)
 	case NV_TYPE_DESCRIPTOR_ARRAY:
 		for (i = 0; i < nvp->nvp_nitems; i++)
 			close(((int *)(intptr_t)nvp->nvp_data)[i]);
+		nv_free((int *)(intptr_t)nvp->nvp_data);
 		break;
 #endif
 	case NV_TYPE_NVLIST:



CVS commit: src/sys/external/bsd/libnv/dist

2019-02-12 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Tue Feb 12 12:49:23 UTC 2019

Modified Files:
src/sys/external/bsd/libnv/dist: nv_impl.h nvlist.c nvpair.c

Log Message:
libnv: fix multiple memory leaks.

- nvpair_create_stringv: free the temporary string; this fix affects
  nvlist_add_stringf() and nvlist_add_stringv().

- nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain
  of nvpairs (as resetting it prevents nvlist_destroy() from freeing it).
  Note: freeing the chain in nvlist_destroy() is not sufficient, because
  it would still leak through nvlist_take_nvlist_array().  This affects
  all nvlist_*_nvlist_array() users.

Found by clang/gcc ASAN.  These fixes have been contributed to the
upstream (FreeBSD) repository.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/libnv/dist/nv_impl.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/libnv/dist/nvlist.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/libnv/dist/nvpair.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/external/bsd/libnv/dist/nv_impl.h
diff -u src/sys/external/bsd/libnv/dist/nv_impl.h:1.5 src/sys/external/bsd/libnv/dist/nv_impl.h:1.6
--- src/sys/external/bsd/libnv/dist/nv_impl.h:1.5	Sun Sep 23 19:07:10 2018
+++ src/sys/external/bsd/libnv/dist/nv_impl.h	Tue Feb 12 12:49:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nv_impl.h,v 1.5 2018/09/23 19:07:10 rmind Exp $	*/
+/*	$NetBSD: nv_impl.h,v 1.6 2019/02/12 12:49:23 rmind Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -125,6 +125,7 @@ bool nvlist_move_nvpair(nvlist_t *nvl, n
 
 void nvlist_set_parent(nvlist_t *nvl, nvpair_t *parent);
 void nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele);
+nvpair_t *nvlist_get_array_next_nvpair(nvlist_t *nvl);
 
 const nvpair_t *nvlist_get_nvpair(const nvlist_t *nvl, const char *name);
 

Index: src/sys/external/bsd/libnv/dist/nvlist.c
diff -u src/sys/external/bsd/libnv/dist/nvlist.c:1.6 src/sys/external/bsd/libnv/dist/nvlist.c:1.7
--- src/sys/external/bsd/libnv/dist/nvlist.c:1.6	Sat Sep 22 17:13:30 2018
+++ src/sys/external/bsd/libnv/dist/nvlist.c	Tue Feb 12 12:49:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvlist.c,v 1.6 2018/09/22 17:13:30 rmind Exp $	*/
+/*	$NetBSD: nvlist.c,v 1.7 2019/02/12 12:49:23 rmind Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -36,7 +36,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvlist.c 335347 2018-06-18 22:57:32Z oshogbo $");
 #else
-__RCSID("$NetBSD: nvlist.c,v 1.6 2018/09/22 17:13:30 rmind Exp $");
+__RCSID("$NetBSD: nvlist.c,v 1.7 2019/02/12 12:49:23 rmind Exp $");
 #endif
 
 #include 
@@ -269,6 +269,15 @@ nvlist_set_array_next(nvlist_t *nvl, nvp
 	nvl->nvl_array_next = ele;
 }
 
+nvpair_t *
+nvlist_get_array_next_nvpair(nvlist_t *nvl)
+{
+
+	NVLIST_ASSERT(nvl);
+
+	return (nvl->nvl_array_next);
+}
+
 bool
 nvlist_in_array(const nvlist_t *nvl)
 {

Index: src/sys/external/bsd/libnv/dist/nvpair.c
diff -u src/sys/external/bsd/libnv/dist/nvpair.c:1.3 src/sys/external/bsd/libnv/dist/nvpair.c:1.4
--- src/sys/external/bsd/libnv/dist/nvpair.c:1.3	Sat Sep  8 14:32:25 2018
+++ src/sys/external/bsd/libnv/dist/nvpair.c	Tue Feb 12 12:49:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvpair.c,v 1.3 2018/09/08 14:32:25 christos Exp $	*/
+/*	$NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -36,7 +36,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $");
 #else
-__RCSID("$NetBSD: nvpair.c,v 1.3 2018/09/08 14:32:25 christos Exp $");
+__RCSID("$NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $");
 #endif
 
 #include 
@@ -251,8 +251,16 @@ nvpair_remove_nvlist_array(nvpair_t *nvp
 	nvlarray = __DECONST(nvlist_t **,
 	nvpair_get_nvlist_array(nvp, ));
 	for (i = 0; i < count; i++) {
-		nvlist_set_array_next(nvlarray[i], NULL);
-		nvlist_set_parent(nvlarray[i], NULL);
+		nvlist_t *nvl;
+		nvpair_t *nnvp;
+
+		nvl = nvlarray[i];
+		nnvp = nvlist_get_array_next_nvpair(nvl);
+		if (nnvp != NULL) {
+			nvpair_free_structure(nnvp);
+		}
+		nvlist_set_array_next(nvl, NULL);
+		nvlist_set_parent(nvl, NULL);
 	}
 }
 
@@ -1216,8 +1224,7 @@ nvpair_create_stringv(const char *name, 
 	if (len < 0)
 		return (NULL);
 	nvp = nvpair_create_string(name, str);
-	if (nvp == NULL)
-		nv_free(str);
+	nv_free(str);
 	return (nvp);
 }
 #endif



CVS commit: src/usr.bin/crunch/crunchgen

2019-02-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb 12 10:16:58 UTC 2019

Modified Files:
src/usr.bin/crunch/crunchgen: crunchgen.c

Log Message:
hack alert time:

on sparc and sparc64, don't remove .eh_frame section.  it leads
to failure as something is referenced, and objcopy ends up
emitting a broken binary that can't be run -- it attempts to
load at va=0, beyond having missing referenced data.

also, on sparc64 also don't remove .note.netbsd.mcmodel.

the former should be revised when we can avoid it.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/crunch/crunchgen/crunchgen.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.bin/crunch/crunchgen/crunchgen.c
diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.89 src/usr.bin/crunch/crunchgen/crunchgen.c:1.90
--- src/usr.bin/crunch/crunchgen/crunchgen.c:1.89	Thu Jul 26 08:57:32 2018
+++ src/usr.bin/crunch/crunchgen/crunchgen.c	Tue Feb 12 10:16:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: crunchgen.c,v 1.89 2018/07/26 08:57:32 wiz Exp $	*/
+/*	$NetBSD: crunchgen.c,v 1.90 2019/02/12 10:16:58 mrg Exp $	*/
 /*
  * Copyright (c) 1994 University of Maryland
  * All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: crunchgen.c,v 1.89 2018/07/26 08:57:32 wiz Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.90 2019/02/12 10:16:58 mrg Exp $");
 #endif
 
 #include 
@@ -961,6 +961,15 @@ top_makefile_rules(FILE *outmk)
 
 fprintf(outmk, "LDSTATIC=-static%s\n\n", pie ? " -pie" : "");
 fprintf(outmk, "PROG=%s\n\n", execfname);
+
+fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n");
+
+fprintf(outmk, ".if ${MACHINE} != \"sparc\" && ${MACHINE} != \"sparc64\"\n");
+fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n");
+fprintf(outmk, ".endif\n");
+fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n");
+fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .note.netbsd.mcmodel\n");
+fprintf(outmk, ".endif\n\n");
 
 fprintf(outmk, "all: ${PROG}.crunched\n");
 fprintf(outmk, "${PROG}.crunched: ${SUBMAKE_TARGETS} .WAIT ${PROG}.strip\n");
@@ -969,7 +978,7 @@ top_makefile_rules(FILE *outmk)
 fprintf(outmk, "\t@[ -f ${PROG}.unstripped -a ! ${PROG} -nt ${PROG}.unstripped ] || { \\\n");
 fprintf(outmk, "\t\t${_MKSHMSG:Uecho} \"  strip \" ${PROG}; \\\n");
 fprintf(outmk, "\t\tcp ${PROG} ${PROG}.unstripped && \\\n");
-fprintf(outmk, "\t\t${OBJCOPY} -S -R .eh_frame -R .eh_frame_hdr -R .note -R .note.netbsd.mcmodel -R .note.netbsd.pax -R .ident -R .comment -R .copyright ${PROG} && \\\n");
+fprintf(outmk, "\t\t${OBJCOPY} -S ${OBJCOPY_REMOVE_FLAGS} ${PROG} && \\\n");
 fprintf(outmk, "\t\ttouch ${PROG}.unstripped; \\\n");
 fprintf(outmk, "\t}\n");
 fprintf(outmk, "objs: $(SUBMAKE_TARGETS)\n");



CVS commit: [netbsd-8] src/doc

2019-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 12 09:28:51 UTC 2019

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

Log Message:
Fix #1187


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.106 -r1.1.2.107 src/doc/CHANGES-8.1

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.1
diff -u src/doc/CHANGES-8.1:1.1.2.106 src/doc/CHANGES-8.1:1.1.2.107
--- src/doc/CHANGES-8.1:1.1.2.106	Mon Feb 11 13:45:33 2019
+++ src/doc/CHANGES-8.1	Tue Feb 12 09:28:51 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.106 2019/02/11 13:45:33 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.107 2019/02/12 09:28:51 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2447,7 +2447,7 @@ lib/libperfuse/perfuse_priv.h			1.37
 	Fix directory filehandle usage with libufse. Fix lookup count.
 	[manu, ticket #1186]
 
-sys/arch/x86/include/specialreg.h		1.138
+sys/arch/x86/include/specialreg.h		1.138,1.139
 usr.sbin/cpuctl/arch/i386.c			1.92
 
 	- Add new CPUID flags WAITPKG, CLDEMOTE, MOVDIRI, MOVDIR64B and



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

2019-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 12 09:27:17 UTC 2019

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

Log Message:
Actually pull up rev 1.139 (as claimed, but not done in previous),
requested by msaitoh in ticket #1187:

 Fix bitstring format of Intel CPUID Architectural Performance Monitoring
Fn000a %ebx.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.10 -r1.98.2.11 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.10 src/sys/arch/x86/include/specialreg.h:1.98.2.11
--- src/sys/arch/x86/include/specialreg.h:1.98.2.10	Mon Feb 11 13:23:03 2019
+++ src/sys/arch/x86/include/specialreg.h	Tue Feb 12 09:27:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.10 2019/02/11 13:23:03 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.11 2019/02/12 09:27:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -464,8 +464,8 @@
 #define CPUID_PERF_BRMISPRRETR	__BIT(6)   /* No branch mispredict retry */
 
 #define CPUID_PERF_FLAGS1	"\177\20"  \
-	"b\0\1CORECYCL\0" "b\1\1INSTRETRY\0" "b\2\1REFCYCL\0" "b\3\1LLCREF\0" \
-	"b\4\1LLCMISS\0" "b\5\1BRINSRETR\0" "b\6\1BRMISPRRETR\0"
+	"b\0CORECYCL\0" "b\1INSTRETRY\0" "b\2REFCYCL\0" "b\3LLCREF\0" \
+	"b\4LLCMISS\0" "b\5BRINSRETR\0" "b\6BRMISPRRETR\0"
 
 /* %edx */
 #define CPUID_PERF_NFFPC	__BITS(4, 0)   /* Num of fixed-funct perfcnt */



CVS commit: src/sys/arch/xen

2019-02-12 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Tue Feb 12 08:04:53 UTC 2019

Modified Files:
src/sys/arch/xen/include: xenfunc.h
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Move xen event related code which interfaces with the NetBSD interrupt
subsystem into a separate namespace where it can co-exist with the
native equivalent in PVHVM mode.

On PV, we alias and export the native symbols - this means that
although the namespace is different, the semantics must be identical.

Eg: xen_intr_establish_xname() vs. intr_establish_xname().

The specific functions we need in PVHVM are:

 - spllower, xen_spllower (for native as well as XEN event spl
   despatch/defer)
 - xen_disable_intr()/xen_enable_intr() ,
   x86_disable_intr()/x86_enable_intr()
 - xen_read_psl()/xen_write_psl(),
   x86_read_psl()/x86_write_psl()
 - intr_establish() et. al, xen_intr_establish() et. al.

This gives us the ability to manage Paravirtualised drivers such as
xbd(4) as well as fully emulated ones such as wd(4)., for eg


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/include/xenfunc.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/x86/xen_intr.c

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

Modified files:

Index: src/sys/arch/xen/include/xenfunc.h
diff -u src/sys/arch/xen/include/xenfunc.h:1.16 src/sys/arch/xen/include/xenfunc.h:1.17
--- src/sys/arch/xen/include/xenfunc.h:1.16	Thu Jul 26 15:46:09 2018
+++ src/sys/arch/xen/include/xenfunc.h	Tue Feb 12 08:04:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenfunc.h,v 1.16 2018/07/26 15:46:09 maxv Exp $	*/
+/*	$NetBSD: xenfunc.h,v 1.17 2019/02/12 08:04:53 cherry Exp $	*/
 
 /*
  *
@@ -36,5 +36,10 @@
 #include 
 #include 
 
+void xen_disable_intr(void);
+void xen_enable_intr(void);
+u_long xen_read_psl(void);
+void xen_write_psl(u_long);
+
 void xen_set_ldt(vaddr_t, uint32_t);
 #endif /* _XEN_XENFUNC_H_ */

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.13 src/sys/arch/xen/x86/xen_intr.c:1.14
--- src/sys/arch/xen/x86/xen_intr.c:1.13	Wed Dec 26 11:12:57 2018
+++ src/sys/arch/xen/x86/xen_intr.c	Tue Feb 12 08:04:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.14 2019/02/12 08:04:53 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.14 2019/02/12 08:04:53 cherry Exp $");
 
 #include 
 #include 
@@ -66,17 +66,14 @@ __KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v
 #include 
 #endif
 
-void xen_disable_intr(void);
-void xen_enable_intr(void);
-u_long xen_read_psl(void);
-void xen_write_psl(u_long);
-
 /*
  * Restore a value to cpl (unmasking interrupts).  If any unmasked
  * interrupts are pending, call Xspllower() to process them.
  */
+void xen_spllower(int nlevel);
+
 void
-spllower(int nlevel)
+xen_spllower(int nlevel)
 {
 	struct cpu_info *ci = curcpu();
 	uint32_t xmask;
@@ -186,7 +183,7 @@ xen_intr_establish_xname(int legacy_irq,
 		return rih;
 	} 	/* Else we assume pintr */
 
-#if NPCI > 0 || NISA > 0
+#if (NPCI > 0 || NISA > 0) && defined(XENPV) /* XXX: support PVHVM pirq */
 	struct pintrhand *pih;
 	int gsi;
 	int vector, evtchn;
@@ -306,8 +303,9 @@ redzone_const_or_zero(int x)
 }
 #endif
 
+void xen_cpu_intr_init(struct cpu_info *);
 void
-cpu_intr_init(struct cpu_info *ci)
+xen_cpu_intr_init(struct cpu_info *ci)
 {
 	int i; /* XXX: duplicate */
 
@@ -393,8 +391,10 @@ legacy_intr_string(int ih, char *buf, si
 	return buf;
 }
 
+const char * xintr_string(intr_handle_t ih, char *buf, size_t len);
+
 const char *
-intr_string(intr_handle_t ih, char *buf, size_t len)
+xintr_string(intr_handle_t ih, char *buf, size_t len)
 {
 #if NIOAPIC > 0
 	struct ioapic_softc *pic;
@@ -420,7 +420,7 @@ intr_string(intr_handle_t ih, char *buf,
 		snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
 
 #elif NLAPIC > 0
-	snprintf(buf, len, "irq %d" APIC_IRQ_LEGACY_IRQ(ih));
+	snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
 #else
 	snprintf(buf, len, "irq %d", (int) ih);
 #endif
@@ -432,8 +432,11 @@ intr_string(intr_handle_t ih, char *buf,
  * Create an interrupt id such as "ioapic0 pin 9". This interrupt id is used
  * by MI code and intrctl(8).
  */
+const char * xen_intr_create_intrid(int legacy_irq, struct pic *pic,
+int pin, char *buf, size_t len);
+
 const char *
-intr_create_intrid(int legacy_irq, struct pic *pic, int pin, char *buf, size_t len)
+xen_intr_create_intrid(int legacy_irq, struct pic *pic, int pin, char *buf, size_t len)
 {
 	int ih = 0;
 
@@ -487,14 +490,19 @@ intr_create_intrid(int legacy_irq, struc
 	return NULL; /* No pic found! */
 }
 
-__weak_alias(x86_disable_intr, xen_disable_intr);
-__weak_alias(x86_enable_intr, xen_enable_intr);
-__weak_alias(x86_read_psl,