CVS commit: src/sys/arch

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 07:12:40 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: amd64_mainbus.c db_interface.c
src/sys/arch/i386/i386: db_interface.c
src/sys/arch/x86/x86: cpu.c

Log Message:
Fix NLAPIC, NISA and NIOAPIC related conditional compile errors.

This will allow us to now compile an amd64 kernel without PCI.

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/amd64/amd64_mainbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/i386/i386/db_interface.c
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/x86/x86/cpu.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/amd64_mainbus.c
diff -u src/sys/arch/amd64/amd64/amd64_mainbus.c:1.4 src/sys/arch/amd64/amd64/amd64_mainbus.c:1.5
--- src/sys/arch/amd64/amd64/amd64_mainbus.c:1.4	Sat Dec 22 08:35:04 2018
+++ src/sys/arch/amd64/amd64/amd64_mainbus.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $	*/
+/*	$NetBSD: amd64_mainbus.c,v 1.5 2019/02/14 07:12:40 cherry Exp $	*/
 /*	NetBSD: mainbus.c,v 1.39 2018/12/02 08:19:44 cherry Exp 	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_mainbus.c,v 1.5 2019/02/14 07:12:40 cherry Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ amd64_mainbus_match(device_t parent, cfd
 void
 amd64_mainbus_attach(device_t parent, device_t self, void *aux)
 {
-#if NPCI > 0 || NACPICA > 0 || NIPMI > 0
+#if NISA > 0 || NPCI > 0 || NACPICA > 0 || NIPMI > 0
 	union amd64_mainbus_attach_args mba;
 #endif
 

Index: src/sys/arch/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.35 src/sys/arch/amd64/amd64/db_interface.c:1.36
--- src/sys/arch/amd64/amd64/db_interface.c:1.35	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/db_interface.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.35 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.36 2019/02/14 07:12:40 cherry Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.35 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.36 2019/02/14 07:12:40 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -52,9 +52,13 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 #include 
 #include 
 #include 
+#if NIOAPIC > 0
 #include 
+#endif
+#if NLAPIC > 0
 #include 
 #include 
+#endif
 
 #include 
 #include 
@@ -145,7 +149,9 @@ db_suspend_others(void)
 #ifdef XENPV
 		xen_broadcast_ipi(XEN_IPI_DDB);
 #else
+#if NLAPIC > 0
 		x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
+#endif
 #endif /* XENPV */
 	}
 	ddb_mp_online = x86_mp_online;

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.83 src/sys/arch/i386/i386/db_interface.c:1.84
--- src/sys/arch/i386/i386/db_interface.c:1.83	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/i386/db_interface.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.83 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.84 2019/02/14 07:12:40 cherry Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.83 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.84 2019/02/14 07:12:40 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -150,7 +150,9 @@ db_suspend_others(void)
 #ifdef XENPV
 		xen_broadcast_ipi(XEN_IPI_DDB);
 #else
+#if NLAPIC > 0		
 		x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
+#endif		
 #endif /* XENPV */
 	}
 	ddb_mp_online = x86_mp_online;

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.164 src/sys/arch/x86/x86/cpu.c:1.165
--- src/sys/arch/x86/x86/cpu.c:1.164	Tue Dec  4 19:27:22 2018
+++ src/sys/arch/x86/x86/cpu.c	Thu Feb 14 07:12:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.164 2018/12/04 19:27:22 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.165 2019/02/14 07:12:40 cherry Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.164 2018/12/04 19:27:22 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.165 2019/02/14 07:12:40 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -754,12 +754,14 @@ cpu_init_idle_lwps(void)
 void
 cpu_start_secondary(struct cpu_info *ci)
 {
-	paddr_t mp_pdirpa;
 	u_long psl;
 	int i;
 
+#if NLAPIC > 0
+	paddr_t mp_pdirpa;
 	mp_pdirpa = pmap_init_tmp_pgtbl(mp_trampoline_paddr);
 	cpu_copy_trampoline(mp_pdirpa);

CVS commit: src/sys/arch/xen

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 06:59:25 UTC 2019

Modified Files:
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/include: bus_private.h
src/sys/arch/xen/include/amd64: vmparam.h

Log Message:
Snag the final bits of PV only code to conditionally compile under
-DXENPV

This completes the bifurcation.

The next step is to add -DXENPVHVM code.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/include/bus_private.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/include/amd64/vmparam.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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.176 src/sys/arch/xen/conf/files.xen:1.177
--- src/sys/arch/xen/conf/files.xen:1.176	Sun Jan 27 02:08:39 2019
+++ src/sys/arch/xen/conf/files.xen	Thu Feb 14 06:59:24 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.176 2019/01/27 02:08:39 pgoyette Exp $
+#	$NetBSD: files.xen,v 1.177 2019/02/14 06:59:24 cherry Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -36,7 +36,7 @@ defflag opt_pcifixup.h	PCI_ADDR_FIXUP PC
 
 defparam		PCI_CONF_MODE
 
-file	arch/xen/x86/autoconf.c
+file	arch/xen/x86/autoconf.c		xenpv
 ifdef i386
 file	arch/i386/i386/aout_machdep.c	exec_aout
 file	arch/i386/i386/busfunc.S
@@ -86,10 +86,10 @@ file	arch/xen/x86/hypervisor_machdep.c
 file	arch/x86/x86/kgdb_machdep.c	kgdb
 # file 	arch/x86/x86/mtrr_i686.c	mtrr
 file	arch/x86/x86/syscall.c
-file	arch/xen/x86/x86_xpmap.c
-file	arch/xen/x86/xen_pmap.c
+file	arch/xen/x86/x86_xpmap.c	xenpv
+file	arch/xen/x86/xen_pmap.c		xenpv
 file	arch/xen/x86/xen_intr.c
-file	arch/xen/x86/xenfunc.c
+file	arch/xen/x86/xenfunc.c		xenpv
 
 file	arch/x86/x86/cpu_ucode.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_amd.c	dom0ops & cpu_ucode needs-flag
@@ -97,9 +97,9 @@ file	arch/x86/x86/cpu_ucode_intel.c	dom0
 file	arch/x86/x86/compat_60_cpu_ucode.c  compat_60 & dom0ops & cpu_ucode
 
 
-file	arch/xen/xen/xen_machdep.c
+file	arch/xen/xen/xen_machdep.c	xenpv
 
-file	arch/xen/xen/clock.c
+file	arch/xen/xen/clock.c		xenpv
 file	arch/x86/isa/rtc.c		dom0ops
 file	arch/xen/xen/evtchn.c
 
@@ -133,12 +133,12 @@ file	dev/md_root.c			memory_disk_hooks
 
 file	arch/x86/x86/bus_dma.c		machdep
 file	arch/x86/x86/core_machdep.c	coredump
-file	arch/xen/x86/xen_bus_dma.c	machdep
+file	arch/xen/x86/xen_bus_dma.c	machdep & xenpv
 file	arch/x86/x86/bus_space.c	machdep
-file	arch/xen/x86/consinit.c		machdep
+file	arch/xen/x86/consinit.c		machdep & xenpv
 file	arch/x86/x86/identcpu.c		machdep
-file	arch/xen/x86/pintr.c		machdep & dom0ops
-file	arch/xen/x86/xen_ipi.c		multiprocessor
+file	arch/xen/x86/pintr.c		machdep & dom0ops & xenpv
+file	arch/xen/x86/xen_ipi.c		multiprocessor & xenpv
 file	arch/x86/x86/idt.c		machdep
 file	arch/x86/x86/pmap.c		machdep
 file	arch/x86/x86/x86_tlb.c		machdep
@@ -253,7 +253,7 @@ device	fdc {drive = -1} #XXX
 include "dev/apm/files.apm"
 
 include "dev/acpi/files.acpi"
-file	arch/xen/xen/xen_acpi_machdep.c	acpi
+file	arch/xen/xen/xen_acpi_machdep.c	acpi & xenpv
 file	arch/x86/x86/mpacpi.c		acpi
 file	arch/x86/x86/i8259.c		dom0ops
 
@@ -289,8 +289,7 @@ attach cpu at cpubus
 
 device vcpu
 attach vcpu at xendevbus
-
-file	arch/xen/x86/cpu.c		cpu | vcpu
+file	arch/xen/x86/cpu.c		xenpv & vcpu
 
 # CPU features
 #

Index: src/sys/arch/xen/include/bus_private.h
diff -u src/sys/arch/xen/include/bus_private.h:1.9 src/sys/arch/xen/include/bus_private.h:1.10
--- src/sys/arch/xen/include/bus_private.h:1.9	Wed Jan 23 19:46:45 2008
+++ src/sys/arch/xen/include/bus_private.h	Thu Feb 14 06:59:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_private.h,v 1.9 2008/01/23 19:46:45 bouyer Exp $	*/
+/*	$NetBSD: bus_private.h,v 1.10 2019/02/14 06:59:24 cherry Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -29,6 +29,7 @@
 #include 
 #include "opt_xen.h"
 
+#ifdef XENPV
 #define	_BUS_PHYS_TO_BUS(pa)	((bus_addr_t)xpmap_ptom(pa))
 #define	_BUS_BUS_TO_PHYS(ba)	((paddr_t)xpmap_mtop(ba))
 #define	_BUS_VIRT_TO_BUS(pm, va) _bus_virt_to_bus((pm), (va))
@@ -65,5 +66,6 @@ int _xen_bus_dmamem_alloc_range(bus_dma_
 #else
 #define _BUS_AVAIL_END ((bus_addr_t)0x)
 #endif
-
+#endif /* XENPV */
 #include 
+

Index: src/sys/arch/xen/include/amd64/vmparam.h
diff -u src/sys/arch/xen/include/amd64/vmparam.h:1.2 src/sys/arch/xen/include/amd64/vmparam.h:1.3
--- src/sys/arch/xen/include/amd64/vmparam.h:1.2	Thu Nov 22 16:17:02 2007
+++ src/sys/arch/xen/include/amd64/vmparam.h	Thu Feb 14 06:59:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.2 2007/11/22 16:17:02 bouyer Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.3 2019/02/14 06:59:24 cherry Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -29,10 +29,13 @@
 #if !defined(_VMPARAM_H_)
 #include 
 
+#ifdef XENPV

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

2019-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb 14 06:47:32 UTC 2019

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

Log Message:
Replace signal2 in t_ptrace_wait* with new tests

Add new tests traceme_raisesignal_masked[1-8].

New tests to verify that masking (with SIG_BLOCK) signal in tracee
stops tracer from catching this raised signal. Masked crash signals are
invisible to tracer as well.

All tests pass.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 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.85 src/tests/lib/libc/sys/t_ptrace_wait.c:1.86
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.85	Thu Feb 14 05:38:45 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 14 06:47:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.85 2019/02/14 05:38:45 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.86 2019/02/14 06:47:32 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.85 2019/02/14 05:38:45 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.86 2019/02/14 06:47:32 kamil Exp $");
 
 #include 
 #include 
@@ -188,6 +188,99 @@ TRACEME_RAISE(traceme_raise10, SIGSEGV) 
 /// 
 
 static void
+traceme_raisesignal_masked(int sigmasked)
+{
+	const int exitval = 5;
+	const int sigval = SIGSTOP;
+	pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+	sigset_t intmask;
+	struct ptrace_siginfo info;
+
+	memset(, 0, sizeof(info));
+
+	DPRINTF("Before forking process PID=%d\n", getpid());
+	SYSCALL_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		sigemptyset();
+		sigaddset(, sigmasked);
+		sigprocmask(SIG_BLOCK, , NULL);
+
+		DPRINTF("Before raising %s from child\n", strsignal(sigval));
+		FORKEE_ASSERT(raise(sigval) == 0);
+
+		DPRINTF("Before raising %s breakpoint from child\n",
+		strsignal(sigmasked));
+		FORKEE_ASSERT(raise(sigmasked) == 0);
+
+		DPRINTF("Before exiting of the child process\n");
+		_exit(exitval);
+	}
+	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigval);
+
+	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+	SYSCALL_REQUIRE(
+	ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
+
+	DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
+
+	DPRINTF("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_exited(status, exitval);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
+}
+
+#define TRACEME_RAISESIGNAL_MASKED(test, sig)\
+ATF_TC(test);\
+ATF_TC_HEAD(test, tc)			\
+{	\
+	atf_tc_set_md_var(tc, "descr",	\
+	"Verify that masking (with SIG_BLOCK) " #sig " in tracee "	\
+	"stops tracer from catching this raised signal");		\
+}	\
+	\
+ATF_TC_BODY(test, tc)			\
+{	\
+	\
+	traceme_raisesignal_masked(sig);\
+}
+
+// A signal handler for SIGKILL and SIGSTOP cannot be masked.
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked1, SIGABRT) /* abort trap */
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked2, SIGHUP)  /* hangup */
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked3, SIGCONT) /* continued? */
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked4, SIGTRAP) /* crash sig. */
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked5, SIGBUS) /* crash sig. */
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked6, SIGILL) /* crash sig. */
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked7, SIGFPE) /* crash sig. */
+TRACEME_RAISESIGNAL_MASKED(traceme_raisesignal_masked8, SIGSEGV) /* crash sig. */
+
+/// 
+
+static void
 traceme_crash(int sig)
 {
 	pid_t child, wpid;
@@ -3849,65 +3942,6 @@ 

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

2019-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb 14 05:38:45 UTC 2019

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

Log Message:
Add new regression scenarios for crash signals in t_ptrace_wait*

Verify correct behavior of crash signals (SIGTRAP, SIGBUS, SIGILL, SIGFPE,
SIGSEGV) in existing test scenarios:
 - traceme_raise
 - traceme_sendsignal_handle
 - traceme_sendsignal_masked
 - traceme_sendsignal_ignored
 - traceme_sendsignal_simple
 - traceme_vfork_raise

These tests verify signals out of the context of CPU trap. These new tests
will help to retain expected behavior in future changes in semantics of
the trapsignals in the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 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.84 src/tests/lib/libc/sys/t_ptrace_wait.c:1.85
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.84	Tue Feb 12 21:35:35 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 14 05:38:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.84 2019/02/12 21:35:35 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.85 2019/02/14 05:38:45 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.84 2019/02/12 21:35:35 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.85 2019/02/14 05:38:45 kamil Exp $");
 
 #include 
 #include 
@@ -179,6 +179,11 @@ TRACEME_RAISE(traceme_raise2, SIGSTOP) /
 TRACEME_RAISE(traceme_raise3, SIGABRT) /* regular abort trap */
 TRACEME_RAISE(traceme_raise4, SIGHUP)  /* hangup */
 TRACEME_RAISE(traceme_raise5, SIGCONT) /* continued? */
+TRACEME_RAISE(traceme_raise6, SIGTRAP) /* crash signal */
+TRACEME_RAISE(traceme_raise7, SIGBUS) /* crash signal */
+TRACEME_RAISE(traceme_raise8, SIGILL) /* crash signal */
+TRACEME_RAISE(traceme_raise9, SIGFPE) /* crash signal */
+TRACEME_RAISE(traceme_raise10, SIGSEGV) /* crash signal */
 
 /// 
 
@@ -392,6 +397,11 @@ ATF_TC_BODY(test, tc)			\
 TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle1, SIGABRT) /* abort trap */
 TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle2, SIGHUP)  /* hangup */
 TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle3, SIGCONT) /* continued? */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle4, SIGTRAP) /* crash sig. */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle5, SIGBUS) /* crash sig. */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle6, SIGILL) /* crash sig. */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle7, SIGFPE) /* crash sig. */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle8, SIGSEGV) /* crash sig. */
 
 /// 
 
@@ -475,6 +485,11 @@ ATF_TC_BODY(test, tc)			\
 TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked1, SIGABRT) /* abort trap */
 TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked2, SIGHUP)  /* hangup */
 TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked3, SIGCONT) /* continued? */
+TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked4, SIGTRAP) /* crash sig. */
+TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked5, SIGBUS) /* crash sig. */
+TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked6, SIGILL) /* crash sig. */
+TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked7, SIGFPE) /* crash sig. */
+TRACEME_SENDSIGNAL_MASKED(traceme_sendsignal_masked8, SIGSEGV) /* crash sig. */
 
 /// 
 
@@ -560,6 +575,11 @@ ATF_TC_BODY(test, tc)			\
 TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored1, SIGABRT) /* abort */
 TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored2, SIGHUP)  /* hangup */
 TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored3, SIGCONT) /* continued */
+TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored4, SIGTRAP) /* crash s. */
+TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored5, SIGBUS) /* crash s. */
+TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored6, SIGILL) /* crash s. */
+TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored7, SIGFPE) /* crash s. */
+TRACEME_SENDSIGNAL_IGNORED(traceme_sendsignal_ignored8, SIGSEGV) /* crash s. */
 
 /// 
 
@@ -571,7 +591,21 @@ traceme_sendsignal_simple(int sigsent)
 	pid_t child, wpid;
 #if defined(TWAIT_HAVE_STATUS)
 	int status;
-	int expect_core = (sigsent == SIGABRT) ? 1 : 0;
+	int expect_core;
+
+	switch (sigsent) {
+	case SIGABRT:
+	case SIGTRAP:
+	case SIGBUS:
+	case SIGILL:
+	case SIGFPE:
+	case SIGSEGV:
+		expect_core = 1;
+		break;
+	default:
+		expect_core = 0;
+		break;
+	}
 #endif
 	struct 

CVS commit: src/sys/dev/mii

2019-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb 14 04:34:37 UTC 2019

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

Log Message:
 Sort in alphebetical order a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 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.140 src/sys/dev/mii/miidevs:1.141
--- src/sys/dev/mii/miidevs:1.140	Wed Feb 13 08:39:55 2019
+++ src/sys/dev/mii/miidevs	Thu Feb 14 04:34:37 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.140 2019/02/13 08:39:55 msaitoh Exp $
+$NetBSD: miidevs,v 1.141 2019/02/14 04:34:37 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -132,6 +132,15 @@ model AGERE ET1011		0x0004 Agere ET1011 
 /* Asix semiconductor PHYs */
 model xxASIX AX88X9X		0x0031 Ax88x9x internal PHY
 
+/* Altima Communications PHYs */
+/* Don't know the model for ACXXX */
+model ALTIMA ACXXX		0x0001 ACXXX 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
+
 /* Atheros PHYs */
 model ATHEROS F1		0x0001 F1 10/100/1000 PHY
 model ATHEROS F2		0x0002 F2 10/100 PHY
@@ -142,15 +151,6 @@ model ATTANSIC L2		0x0002 L2 10/100 PHY
 model ATTANSIC AR8021		0x0004 Atheros AR8021 10/100/1000 PHY
 model ATTANSIC AR8035		0x0007 Atheros AR8035 10/100/1000 PHY
 
-/* Altima Communications PHYs */
-/* Don't know the model for ACXXX */
-model ALTIMA ACXXX		0x0001 ACXXX 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
-
 /* Advanced Micro Devices PHYs */
 /* see Davicom DM9101 for Am79C873 */
 model yyAMD 79C972_10T		0x0001 Am79C972 internal 10BASE-T interface



CVS commit: src/sys/dev/mii

2019-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb 14 04:13:40 UTC 2019

Modified Files:
src/sys/dev/mii: micphy.c

Log Message:
Add KSZ8081 support from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/mii/micphy.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/mii/micphy.c
diff -u src/sys/dev/mii/micphy.c:1.5 src/sys/dev/mii/micphy.c:1.6
--- src/sys/dev/mii/micphy.c:1.5	Tue Jan 22 17:41:06 2019
+++ src/sys/dev/mii/micphy.c	Thu Feb 14 04:13:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: micphy.c,v 1.5 2019/01/22 17:41:06 skrll Exp $	*/
+/*	$NetBSD: micphy.c,v 1.6 2019/02/14 04:13:40 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: micphy.c,v 1.5 2019/01/22 17:41:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: micphy.c,v 1.6 2019/02/14 04:13:40 msaitoh Exp $");
 
 #include "opt_mii.h"
 
@@ -79,6 +79,8 @@ __KERNEL_RCSID(0, "$NetBSD: micphy.c,v 1
 
 static int	micphymatch(device_t, cfdata_t, void *);
 static void	micphyattach(device_t, device_t, void *);
+static void	micphy_reset(struct mii_softc *);
+static int	micphy_service(struct mii_softc *, struct mii_data *, int);
 
 CFATTACH_DECL3_NEW(micphy, sizeof(struct mii_softc),
 micphymatch, micphyattach, mii_phy_detach, mii_phy_activate, NULL, NULL,
@@ -88,10 +90,13 @@ static int	micphy_service(struct mii_sof
 static void	micphy_fixup(struct mii_softc *, int, int, device_t);
 
 static const struct mii_phy_funcs micphy_funcs = {
-	micphy_service, ukphy_status, mii_phy_reset,
+	micphy_service, ukphy_status, micphy_reset,
 };
 
 static const struct mii_phydesc micphys[] = {
+	{ MII_OUI_MICREL,		MII_MODEL_MICREL_KSZ8081,
+	  MII_STR_MICREL_KSZ8081 },
+
 	{ MII_OUI_MICREL,		MII_MODEL_MICREL_KSZ9021RNI,
 	  MII_STR_MICREL_KSZ9021RNI },
 
@@ -99,6 +104,8 @@ static const struct mii_phydesc micphys[
 	  NULL },
 };
 
+#define	MII_KSZ8081_PHYCTL2			0x1f
+
 static int
 micphymatch(device_t parent, cfdata_t match, void *aux)
 {
@@ -149,6 +156,24 @@ micphyattach(device_t parent, device_t s
 	aprint_normal("\n");
 }
 
+static void
+micphy_reset(struct mii_softc *sc)
+{
+	uint16_t reg;
+
+	/*
+	 * The 8081 has no "sticky bits" that survive a soft reset; several bits
+	 * in the Phy Control Register 2 must be preserved across the reset.
+	 * These bits are set up by the bootloader; they control how the phy
+	 * interfaces to the board (such as clock frequency and LED behavior).
+	 */
+	if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ8081)
+		PHY_READ(sc, MII_KSZ8081_PHYCTL2, );
+	mii_phy_reset(sc);
+	if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ8081)
+		PHY_WRITE(sc, MII_KSZ8081_PHYCTL2, reg);
+}
+
 static int
 micphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {



CVS commit: src/sys/dev

2019-02-13 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Feb 14 03:33:55 UTC 2019

Modified Files:
src/sys/dev/usb: if_urndis.c
Added Files:
src/sys/dev/ic: rndisreg.h
Removed Files:
src/sys/dev/usb: if_urndisreg.h

Log Message:
separate RNDIS definitions from urndis(4) for use with Hyper-V NetVSC.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/rndisreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.4 -r0 src/sys/dev/usb/if_urndisreg.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/usb/if_urndis.c
diff -u src/sys/dev/usb/if_urndis.c:1.19 src/sys/dev/usb/if_urndis.c:1.20
--- src/sys/dev/usb/if_urndis.c:1.19	Fri Nov  9 21:57:09 2018
+++ src/sys/dev/usb/if_urndis.c	Thu Feb 14 03:33:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.19 2018/11/09 21:57:09 maya Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.20 2019/02/14 03:33:55 nonaka Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.19 2018/11/09 21:57:09 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.20 2019/02/14 03:33:55 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -53,7 +53,56 @@ __KERNEL_RCSID(0, "$NetBSD: if_urndis.c,
 #include 
 #include 
 
-#include 
+#include 
+
+#define RNDIS_RX_LIST_CNT	1
+#define RNDIS_TX_LIST_CNT	1
+#define RNDIS_BUFSZ		1562
+
+struct urndis_softc;
+
+struct urndis_chain {
+	struct urndis_softc	*sc_softc;
+	struct usbd_xfer	*sc_xfer;
+	char			*sc_buf;
+	struct mbuf		*sc_mbuf;
+	int			 sc_idx;
+};
+
+struct urndis_cdata {
+	struct urndis_chain	sc_rx_chain[RNDIS_RX_LIST_CNT];
+	struct urndis_chain	sc_tx_chain[RNDIS_TX_LIST_CNT];
+	int			sc_tx_cnt;
+};
+
+#define GET_IFP(sc) (&(sc)->sc_ec.ec_if)
+struct urndis_softc {
+	device_t			sc_dev;
+
+	charsc_attached;
+	intsc_dying;
+	struct ethercom			sc_ec;
+
+	/* RNDIS device info */
+	uint32_t			sc_filter;
+	uint32_t			sc_maxppt;
+	uint32_t			sc_maxtsz;
+	uint32_t			sc_palign;
+
+	/* USB goo */
+	struct usbd_device *		sc_udev;
+	intsc_ifaceno_ctl;
+	struct usbd_interface *		sc_iface_ctl;
+	struct usbd_interface *		sc_iface_data;
+
+	struct timeval			sc_rx_notice;
+	intsc_bulkin_no;
+	struct usbd_pipe *		sc_bulkin_pipe;
+	intsc_bulkout_no;
+	struct usbd_pipe *		sc_bulkout_pipe;
+
+	struct urndis_cdata		sc_data;
+};
 
 #ifdef URNDIS_DEBUG
 #define DPRINTF(x)  do { printf x; } while (0)
@@ -86,16 +135,16 @@ static void urndis_stop(struct ifnet *);
 static usbd_status urndis_ctrl_msg(struct urndis_softc *, uint8_t, uint8_t,
 uint16_t, uint16_t, void *, size_t);
 static usbd_status urndis_ctrl_send(struct urndis_softc *, void *, size_t);
-static struct urndis_comp_hdr *urndis_ctrl_recv(struct urndis_softc *);
+static struct rndis_comp_hdr *urndis_ctrl_recv(struct urndis_softc *);
 
 static uint32_t urndis_ctrl_handle(struct urndis_softc *,
-struct urndis_comp_hdr *, void **, size_t *);
+struct rndis_comp_hdr *, void **, size_t *);
 static uint32_t urndis_ctrl_handle_init(struct urndis_softc *,
-const struct urndis_comp_hdr *);
+const struct rndis_comp_hdr *);
 static uint32_t urndis_ctrl_handle_query(struct urndis_softc *,
-const struct urndis_comp_hdr *, void **, size_t *);
+const struct rndis_comp_hdr *, void **, size_t *);
 static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *,
-const struct urndis_comp_hdr *);
+const struct rndis_comp_hdr *);
 
 static uint32_t urndis_ctrl_init(struct urndis_softc *);
 #if 0
@@ -164,10 +213,10 @@ urndis_ctrl_send(struct urndis_softc *sc
 	return err;
 }
 
-static struct urndis_comp_hdr *
+static struct rndis_comp_hdr *
 urndis_ctrl_recv(struct urndis_softc *sc)
 {
-	struct urndis_comp_hdr	*hdr;
+	struct rndis_comp_hdr	*hdr;
 	char			*buf;
 	usbd_status		 err;
 
@@ -181,7 +230,7 @@ urndis_ctrl_recv(struct urndis_softc *sc
 		return NULL;
 	}
 
-	hdr = (struct urndis_comp_hdr *)buf;
+	hdr = (struct rndis_comp_hdr *)buf;
 	DPRINTF(("%s: urndis_ctrl_recv: type 0x%x len %u\n",
 	DEVNAME(sc),
 	le32toh(hdr->rm_type),
@@ -200,7 +249,7 @@ urndis_ctrl_recv(struct urndis_softc *sc
 }
 
 static uint32_t
-urndis_ctrl_handle(struct urndis_softc *sc, struct urndis_comp_hdr *hdr,
+urndis_ctrl_handle(struct urndis_softc *sc, struct rndis_comp_hdr *hdr,
 void **buf, size_t *bufsz)
 {
 	uint32_t rval;
@@ -243,11 +292,11 @@ urndis_ctrl_handle(struct urndis_softc *
 
 static uint32_t
 urndis_ctrl_handle_init(struct urndis_softc *sc,
-const struct urndis_comp_hdr *hdr)
+const struct rndis_comp_hdr *hdr)
 {
-	const struct urndis_init_comp	*msg;
+	const struct rndis_init_comp	*msg;
 
-	msg = (const struct urndis_init_comp *) hdr;
+	msg = (const struct rndis_init_comp *) hdr;
 
 	DPRINTF(("%s: urndis_ctrl_handle_init: len %u rid %u status 0x%x "
 	"ver_major %u 

CVS commit: src/sys/dev/pci

2019-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb 14 03:25:47 UTC 2019

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add Tundra (now IDT) TSI381 and PEB383 from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1362 -r1.1363 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1362 src/sys/dev/pci/pcidevs:1.1363
--- src/sys/dev/pci/pcidevs:1.1362	Fri Feb  8 06:29:08 2019
+++ src/sys/dev/pci/pcidevs	Thu Feb 14 03:25:47 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1362 2019/02/08 06:29:08 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1363 2019/02/14 03:25:47 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5814,6 +5814,8 @@ product NETVIN 5000	0x5000	5000 Ethernet
 
 /* Newbridge / Tundra products */
 product NEWBRIDGE CA91CX42		0x	Universe VME Bridge
+product NEWBRIDGE TSI381		0x8111	Tsi381 PCIE-PCI
+product NEWBRIDGE PEB383		0x8113	PEB383 PCIE-PCI
 product NEWBRIDGE CA91L826A		0x0826	QSpan II PCI Bridge
 product NEWBRIDGE CA91L8260		0x8260	PowerSpan PCI Bridge
 product NEWBRIDGE CA91L8261		0x8261	PowerSpan II PCI Bridge



CVS commit: src/bin/sh

2019-02-13 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Feb 13 21:40:50 UTC 2019

Modified Files:
src/bin/sh: parser.h

Log Message:
Delete a no-longer-used #define that referred to a struct field that
no longer exists.   Also correct a couple of typos in comments.NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/sh/parser.h

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

Modified files:

Index: src/bin/sh/parser.h
diff -u src/bin/sh/parser.h:1.27 src/bin/sh/parser.h:1.28
--- src/bin/sh/parser.h:1.27	Tue Dec 11 13:31:20 2018
+++ src/bin/sh/parser.h	Wed Feb 13 21:40:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.h,v 1.27 2018/12/11 13:31:20 kre Exp $	*/
+/*	$NetBSD: parser.h,v 1.28 2019/02/13 21:40:50 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -94,7 +94,7 @@ struct parse_state {
 	int ps_checkkwd;		/* word expansion flags, see below */
 	struct nodelist *ps_backquotelist; /* list of cmdsubs to process */
 	union node *ps_redirnode;	/* node for current redirect */
-	struct HereDoc *ps_heredoc;	/* current heredoc << beign parsed */
+	struct HereDoc *ps_heredoc;	/* current heredoc << being parsed */
 	int ps_quoteflag;		/* set if (part) of token was quoted */
 	int ps_startlinno;		/* line # where last token started */
 	int ps_funclinno;		/* line # of the current function */
@@ -104,7 +104,7 @@ struct parse_state {
 /*
  * The parser references the elements of struct parse_state quite
  * frequently - they used to be simple globals, so one memory ref
- * per access, adding an indirect through global ptr would not be
+ * per access, adding an indirect through a global ptr would not be
  * nice.   The following gross hack allows most of that cost to be
  * avoided, by allowing the compiler to understand that the global
  * pointer is in fact constant in any function, and so its value can
@@ -135,7 +135,6 @@ extern union parse_state_p psp;
 #define	tokpushback	(current_parser->ps_tokpushback)
 #define	checkkwd	(current_parser->ps_checkkwd)
 
-#define	noalias		(current_parser->ps_noalias)
 #define	heredoclist	(current_parser->ps_heredoclist)
 #define	parsebackquote	(current_parser->ps_parsebackquote)
 #define	doprompt	(current_parser->ps_doprompt)



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

2019-02-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb 13 20:48:56 UTC 2019

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

Log Message:
while we're still figuring out the gcc7 vs .eh_frame issue, apply
the don't remove eh_frame hack to mips as well.  hpcmips testbed
is also failing currently:

[   3.1238738] panic: init died (signal 6, exit 12)


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 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.90 src/usr.bin/crunch/crunchgen/crunchgen.c:1.91
--- src/usr.bin/crunch/crunchgen/crunchgen.c:1.90	Tue Feb 12 10:16:58 2019
+++ src/usr.bin/crunch/crunchgen/crunchgen.c	Wed Feb 13 20:48:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: crunchgen.c,v 1.90 2019/02/12 10:16:58 mrg Exp $	*/
+/*	$NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 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.90 2019/02/12 10:16:58 mrg Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 mrg Exp $");
 #endif
 
 #include 
@@ -964,7 +964,9 @@ top_makefile_rules(FILE *outmk)
 
 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, ".if !(${MACHINE} == \"sparc\" || \\\n");
+fprintf(outmk, "  ${MACHINE} == \"sparc64\" || \\\n");
+fprintf(outmk, "  ${MACHINE_ARCH:C/mips(e|64e)[bl]/mips/} == \"mips\")\n");
 fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n");
 fprintf(outmk, ".endif\n");
 fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n");



CVS commit: src/sys/arch/arm/sunxi

2019-02-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 13 18:31:11 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sun50i_h6_ccu.c

Log Message:
sun50i_h6_ccu: add PCIe clocks


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sun50i_h6_ccu.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/arm/sunxi/sun50i_h6_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_h6_ccu.c:1.2 src/sys/arch/arm/sunxi/sun50i_h6_ccu.c:1.3
--- src/sys/arch/arm/sunxi/sun50i_h6_ccu.c:1.2	Wed Feb 13 18:18:38 2019
+++ src/sys/arch/arm/sunxi/sun50i_h6_ccu.c	Wed Feb 13 18:31:11 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_h6_ccu.c,v 1.2 2019/02/13 18:18:38 jakllsch Exp $ */
+/* $NetBSD: sun50i_h6_ccu.c,v 1.3 2019/02/13 18:31:11 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_h6_ccu.c,v 1.2 2019/02/13 18:18:38 jakllsch Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_h6_ccu.c,v 1.3 2019/02/13 18:31:11 jakllsch Exp $");
 
 #include 
 #include 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_h6_cc
 
 #define	PLL_CPUX_CTRL_REG	0x000
 #define	PLL_PERI0_CTRL_REG	0x020
+#define	PSI_AHB1_AHB2_CFG_REG	0x510
 #define	AHB3_CFG_REG		0x51c
 #define	APB2_CFG_REG		0x524
 #define	MBUS_CFG_REG		0x540
@@ -81,6 +82,9 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_h6_cc
 #define	USB1_CLK_REG		0xa74
 #define	USB3_CLK_REG		0xa7c
 #define	USB_BGR_REG		0xa8c
+#define	PCIE_REF_CLK_REG	0xab0
+#define	PCIE_AXI_CLK_REG	0xab4
+#define	PCIE_AUX_CLK_REG	0xab8
 #define	PCIE_BGR_REG		0xabc
 #define	HDMI_BGR_REG		0xb1c
 #define	DISPLAY_IF_TOP_BGR_REG	0xb5c
@@ -210,6 +214,9 @@ static struct sunxi_ccu_reset sun50i_h6_
 static const char *ahb3_parents[] = { "hosc", "losc", "psi", "pll_periph0" };
 static const char *apb2_parents[] = { "hosc", "losc", "psi", "pll_periph0" };
 static const char *mod_parents[] = { "hosc", "pll_periph0_2x", "pll_periph1_2x" };
+static const char *hosc_parent[] = { "hosc" };
+static const char *pll_periph0_parent[] = { "pll_periph0" };
+static const char *psi_ahb1_ahb2_parents[] = { "hosc", "losc", "iosc", "pll_periph0" };
 
 static struct sunxi_ccu_clk sun50i_h6_ccu_clks[] = {
 	SUNXI_CCU_FIXED_FACTOR(H6_CLK_OSC12M, "osc12m", "hosc", 2, 1),
@@ -330,6 +337,37 @@ static struct sunxi_ccu_clk sun50i_h6_cc
 
 	SUNXI_CCU_GATE(H6_CLK_BUS_EMAC, "bus-emac", "ahb3",
 	EMAC_BGR_REG, 0),
+
+	SUNXI_CCU_FIXED_FACTOR(H6_CLK_PCIE_REF_100M, "pcie_ref_100M",
+	"pll_periph0_4x", 24, 1),
+	SUNXI_CCU_GATE(H6_CLK_PCIE_REF, "pcie_ref", "pcie_ref_100M",
+	PCIE_REF_CLK_REG, 31),
+	SUNXI_CCU_GATE(H6_CLK_PCIE_REF_OUT, "pcie_ref_out", "pcie_ref",
+	PCIE_REF_CLK_REG, 30),
+
+	SUNXI_CCU_NM(H6_CLK_PSI_AHB1_AHB2, "psi_ahb1_ahb2",
+	psi_ahb1_ahb2_parents,
+	PSI_AHB1_AHB2_CFG_REG,	/* reg */
+	__BITS(9,8),	/* n */
+	__BITS(1,0),	/* m */
+	__BITS(25,24),	/* sel */
+	0,			/* enable */
+	SUNXI_CCU_NM_POWER_OF_TWO),
+	SUNXI_CCU_DIV_GATE(H6_CLK_PCIE_MAXI, "pcie_maxi", pll_periph0_parent,
+	PCIE_AXI_CLK_REG,	/* reg */
+	__BITS(3,0),	/* div */
+	0,			/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_DIV_ZERO_IS_ONE),
+	SUNXI_CCU_DIV_GATE(H6_CLK_PCIE_AUX, "pcie_aux", hosc_parent,
+	PCIE_AUX_CLK_REG,	/* reg */
+	__BITS(4,0),	/* div */
+	0,			/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_DIV_ZERO_IS_ONE),
+
+	SUNXI_CCU_GATE(H6_CLK_BUS_PCIE, "bus_pcie", "psi_ahb1_ahb2",
+	PCIE_BGR_REG, 0),
 };
 
 static int



CVS commit: src/sys/arch/arm/sunxi

2019-02-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 13 18:18:38 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sun50i_h6_ccu.c

Log Message:
sun50i_h6_ccu: add "pll_cpux"

Currently intended for display of existing clock rate via the sysctl
tree, and not yet for DVFS.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun50i_h6_ccu.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/arm/sunxi/sun50i_h6_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_h6_ccu.c:1.1 src/sys/arch/arm/sunxi/sun50i_h6_ccu.c:1.2
--- src/sys/arch/arm/sunxi/sun50i_h6_ccu.c:1.1	Tue May  1 19:53:14 2018
+++ src/sys/arch/arm/sunxi/sun50i_h6_ccu.c	Wed Feb 13 18:18:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_h6_ccu.c,v 1.1 2018/05/01 19:53:14 jmcneill Exp $ */
+/* $NetBSD: sun50i_h6_ccu.c,v 1.2 2019/02/13 18:18:38 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_h6_ccu.c,v 1.1 2018/05/01 19:53:14 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_h6_ccu.c,v 1.2 2019/02/13 18:18:38 jakllsch Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_h6_cc
 #include 
 #include 
 
+#define	PLL_CPUX_CTRL_REG	0x000
 #define	PLL_PERI0_CTRL_REG	0x020
 #define	AHB3_CFG_REG		0x51c
 #define	APB2_CFG_REG		0x524
@@ -213,6 +214,17 @@ static const char *mod_parents[] = { "ho
 static struct sunxi_ccu_clk sun50i_h6_ccu_clks[] = {
 	SUNXI_CCU_FIXED_FACTOR(H6_CLK_OSC12M, "osc12m", "hosc", 2, 1),
 
+	SUNXI_CCU_NKMP_TABLE(H6_CLK_PLL_CPUX, "pll_cpux", "hosc",
+	PLL_CPUX_CTRL_REG,		/* reg */
+	__BITS(15,8),		/* n */
+	0,/* k */
+	__BITS(1,0),		/* m */
+	__BITS(17,16),		/* p */
+	__BIT(31),			/* enable */
+	__BIT(28),			/* lock */
+	NULL,			/* table */
+	SUNXI_CCU_NKMP_SCALE_CLOCK | SUNXI_CCU_NKMP_FACTOR_P_POW2),
+
 	SUNXI_CCU_NKMP(H6_CLK_PLL_PERIPH0_4X, "pll_periph0_4x", "hosc",
 	PLL_PERI0_CTRL_REG,		/* reg */
 	__BITS(15,8),		/* n */



CVS commit: src/sys/kern

2019-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb 13 18:04:35 UTC 2019

Modified Files:
src/sys/kern: files.kern

Log Message:
Silent UB alignment issues in acpica under kUBSan

Pass -DACPI_MISALIGNMENT_NOT_SUPPORTED under kUBSan enabled. This option
is dedicated for alignment sensitive CPUs in acpica. It was originally
designed for Itanium CPUs, but nowadays it's wanted for aarch64 as well.

Define it in acpica code under kUBSan in order to pacify Undefined Behavior
reports on all ports (in particular x86). The number of reports is now
halved with this patch applied. The remaining alignment alarms in acpica
will be addressed in future.

Patch contributed by 


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/files.kern

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

Modified files:

Index: src/sys/kern/files.kern
diff -u src/sys/kern/files.kern:1.31 src/sys/kern/files.kern:1.32
--- src/sys/kern/files.kern:1.31	Sun Jan 27 02:08:43 2019
+++ src/sys/kern/files.kern	Wed Feb 13 18:04:35 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.kern,v 1.31 2019/01/27 02:08:43 pgoyette Exp $
+#	$NetBSD: files.kern,v 1.32 2019/02/13 18:04:35 kamil Exp $
 
 #
 # kernel sources
@@ -228,3 +228,4 @@ prefix	../common/lib/libc/misc
 file	ubsan.ckubsan
 prefix
 makeoptions	kubsan	CFLAGS+="-fsanitize=undefined"
+makeoptions	kubsan	CPPFLAGS+="-DACPI_MISALIGNMENT_NOT_SUPPORTED"



CVS commit: src/common/lib/libc/misc

2019-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb 13 17:17:02 UTC 2019

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
Fix kUBSan build with GCC7

Add missing __unreachable() and FALLTHROUGH keywords.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/misc/ubsan.c

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

Modified files:

Index: src/common/lib/libc/misc/ubsan.c
diff -u src/common/lib/libc/misc/ubsan.c:1.4 src/common/lib/libc/misc/ubsan.c:1.5
--- src/common/lib/libc/misc/ubsan.c:1.4	Mon Feb  4 22:07:41 2019
+++ src/common/lib/libc/misc/ubsan.c	Wed Feb 13 17:17:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsan.c,v 1.4 2019/02/04 22:07:41 mrg Exp $	*/
+/*	$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,9 +38,9 @@
 
 #include 
 #if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.4 2019/02/04 22:07:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $");
 #else
-__RCSID("$NetBSD: ubsan.c,v 1.4 2019/02/04 22:07:41 mrg Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $");
 #endif
 
 #if defined(_KERNEL)
@@ -110,7 +110,7 @@ __RCSID("$NetBSD: ubsan.c,v 1.4 2019/02/
 
 #define NUMBER_SIGNED_BIT	1U
 
-#if __SIZEOF_INT128__
+#ifdef __SIZEOF_INT128__
 typedef __int128 longest;
 typedef unsigned __int128 ulongest;
 #else
@@ -1192,6 +1192,7 @@ Report(bool isFatal, const char *pFormat
 	}
 	if (isFatal || ISSET(ubsan_flags, UBSAN_ABORT)) {
 		abort();
+		__unreachable();
 		/* NOTREACHED */
 	}
 #endif
@@ -1291,6 +1292,7 @@ DeserializeNumberSigned(char *pBuffer, s
 	switch (zDeserializeTypeWidth(pType)) {
 	default:
 		ASSERT(0 && "Invalid codepath");
+		__unreachable();
 		/* NOTREACHED */
 #ifdef __SIZEOF_INT128__
 	case WIDTH_128:
@@ -1298,8 +1300,11 @@ DeserializeNumberSigned(char *pBuffer, s
 		break;
 #endif
 	case WIDTH_64:
+		/* FALLTHROUGH */
 	case WIDTH_32:
+		/* FALLTHROUGH */
 	case WIDTH_16:
+		/* FALLTHROUGH */
 	case WIDTH_8:
 		snprintf(pBuffer, zBUfferLength, "%" PRId64, STATIC_CAST(int64_t, L));
 		break;
@@ -1318,6 +1323,7 @@ DeserializeNumberUnsigned(char *pBuffer,
 	switch (zDeserializeTypeWidth(pType)) {
 	default:
 		ASSERT(0 && "Invalid codepath");
+		__unreachable();
 		/* NOTREACHED */
 #ifdef __SIZEOF_INT128__
 	case WIDTH_128:
@@ -1325,8 +1331,11 @@ DeserializeNumberUnsigned(char *pBuffer,
 		break;
 #endif
 	case WIDTH_64:
+		/* FALLTHROUGH */
 	case WIDTH_32:
+		/* FALLTHROUGH */
 	case WIDTH_16:
+		/* FALLTHROUGH */
 	case WIDTH_8:
 		snprintf(pBuffer, zBUfferLength, "%" PRIu64, STATIC_CAST(uint64_t, L));
 		break;
@@ -1358,7 +1367,9 @@ DeserializeFloatOverPointer(char *pBuffe
 	switch (zDeserializeTypeWidth(pType)) {
 #ifdef __HAVE_LONG_DOUBLE
 	case WIDTH_128:
+		/* FALLTHROUGH */
 	case WIDTH_96:
+		/* FALLTHROUGH */
 	case WIDTH_80:
 		memcpy(, pNumber, sizeof(long double));
 		snprintf(pBuffer, zBUfferLength, "%Lg", LD);
@@ -1512,7 +1523,9 @@ DeserializeNumberFloat(char *szLocation,
 		/* NOTREACHED */
 #ifdef __HAVE_LONG_DOUBLE
 	case WIDTH_128:
+		/* FALLTHROUGH */
 	case WIDTH_96:
+		/* FALLTHROUGH */
 	case WIDTH_80:
 		DeserializeFloatOverPointer(pBuffer, zBUfferLength, pType, REINTERPRET_CAST(unsigned long *, ulNumber));
 		break;
@@ -1524,6 +1537,7 @@ DeserializeNumberFloat(char *szLocation,
 		}
 		/* FALLTHROUGH */
 	case WIDTH_32:
+		/* FALLTHROUGH */
 	case WIDTH_16:
 		DeserializeFloatInlined(pBuffer, zBUfferLength, pType, ulNumber);
 		break;



CVS commit: src/share/man/man4

2019-02-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Feb 13 16:06:28 UTC 2019

Modified Files:
src/share/man/man4: nvmm.4

Log Message:
Note Intel support.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/nvmm.4

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

Modified files:

Index: src/share/man/man4/nvmm.4
diff -u src/share/man/man4/nvmm.4:1.2 src/share/man/man4/nvmm.4:1.3
--- src/share/man/man4/nvmm.4:1.2	Wed Dec 12 08:28:44 2018
+++ src/share/man/man4/nvmm.4	Wed Feb 13 16:06:28 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: nvmm.4,v 1.2 2018/12/12 08:28:44 wiz Exp $
+.\"	$NetBSD: nvmm.4,v 1.3 2019/02/13 16:06:28 maxv Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 12, 2018
+.Dd February 13, 2019
 .Dt NVMM 4
 .Os
 .Sh NAME
@@ -50,6 +50,8 @@ The following backends are supported:
 .Bl -hyphen -compact -offset indent
 .It
 x86-SVM, for x86 AMD CPUs
+.It
+x86-VMX, for x86 Intel CPUs
 .El
 .Sh SEE ALSO
 .Xr libnvmm 3



CVS commit: src/sys

2019-02-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Feb 13 16:03:16 UTC 2019

Modified Files:
src/sys/dev/nvmm: nvmm.c nvmm_internal.h
src/sys/modules/nvmm: Makefile
Added Files:
src/sys/dev/nvmm/x86: nvmm_x86_vmx.c nvmm_x86_vmxfunc.S

Log Message:
Add Intel-VMX support in NVMM. This allows us to run hardware-accelerated
VMs on Intel CPUs. Overall this implementation is fast and reliable, I am
able to run NetBSD VMs with many VCPUs on a quad-core Intel i5.

NVMM-Intel applies several optimizations already present in NVMM-AMD, and
has a code structure similar to it. No change was needed in the NVMM MI
frontend, or in libnvmm.

Some differences exist against AMD:

 - On Intel the ASID space is big, so we don't fall back to a shared ASID
   when there are more VCPUs executing than available ASIDs in the host,
   contrary to AMD. There are enough ASIDs for the maximum number of VCPUs
   supported by NVMM.

 - On Intel there are two TLBs we need to take care of, one for the host
   (EPT) and one for the guest (VPID). Changes in EPT paging flush the
   host TLB, changes to the guest mode flush the guest TLB.

 - On Intel there is no easy way to set/fetch the VTPR, so we intercept
   reads/writes to CR8 and maintain a software TPR, that we give to the
   virtualizer as if it was the effective TPR in the guest.

 - On Intel, because of SVS, the host CR4 and LSTAR are not static, so
   we're forced to save them on each VMENTRY.

 - There is extra Intel weirdness we need to take care of, for example the
   reserved bits in CR0 and CR4 when accesses trap.

While this implementation is functional and can already run many OSes, we
likely have a problem on 32bit-PAE guests, because they require special
care on Intel CPUs, and currently we don't handle that correctly; such
guests may misbehave for now (without altering the host stability). I
expect to fix that soon.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/nvmm/nvmm.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/nvmm/nvmm_internal.h
cvs rdiff -u -r0 -r1.1 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c \
src/sys/dev/nvmm/x86/nvmm_x86_vmxfunc.S
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/nvmm/Makefile

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/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.6 src/sys/dev/nvmm/nvmm.c:1.7
--- src/sys/dev/nvmm/nvmm.c:1.6	Sat Jan 26 15:25:51 2019
+++ src/sys/dev/nvmm/nvmm.c	Wed Feb 13 16:03:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.c,v 1.6 2019/01/26 15:25:51 maxv Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.7 2019/02/13 16:03:16 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.6 2019/01/26 15:25:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.7 2019/02/13 16:03:16 maxv Exp $");
 
 #include 
 #include 
@@ -54,7 +54,8 @@ __KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.6
 static struct nvmm_machine machines[NVMM_MAX_MACHINES];
 
 static const struct nvmm_impl *nvmm_impl_list[] = {
-	_x86_svm	/* x86 AMD SVM */
+	_x86_svm,	/* x86 AMD SVM */
+	_x86_vmx	/* x86 Intel VMX */
 };
 
 static const struct nvmm_impl *nvmm_impl = NULL;

Index: src/sys/dev/nvmm/nvmm_internal.h
diff -u src/sys/dev/nvmm/nvmm_internal.h:1.4 src/sys/dev/nvmm/nvmm_internal.h:1.5
--- src/sys/dev/nvmm/nvmm_internal.h:1.4	Mon Feb 11 07:07:37 2019
+++ src/sys/dev/nvmm/nvmm_internal.h	Wed Feb 13 16:03:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_internal.h,v 1.4 2019/02/11 07:07:37 maxv Exp $	*/
+/*	$NetBSD: nvmm_internal.h,v 1.5 2019/02/13 16:03:16 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -109,5 +109,6 @@ int nvmm_vcpu_get(struct nvmm_machine *,
 void nvmm_vcpu_put(struct nvmm_cpu *);
 
 extern const struct nvmm_impl nvmm_x86_svm;
+extern const struct nvmm_impl nvmm_x86_vmx;
 
 #endif /* _NVMM_INTERNAL_H_ */

Index: src/sys/modules/nvmm/Makefile
diff -u src/sys/modules/nvmm/Makefile:1.1 src/sys/modules/nvmm/Makefile:1.2
--- src/sys/modules/nvmm/Makefile:1.1	Wed Nov  7 07:43:08 2018
+++ src/sys/modules/nvmm/Makefile	Wed Feb 13 16:03:16 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2018/11/07 07:43:08 maxv Exp $
+#	$NetBSD: Makefile,v 1.2 2019/02/13 16:03:16 maxv Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
@@ -14,6 +14,7 @@ SRCS=	nvmm.c
 
 .if ${MACHINE_ARCH} == "x86_64"
 SRCS+=	nvmm_x86_svm.c nvmm_x86_svmfunc.S
+SRCS+=	nvmm_x86_vmx.c nvmm_x86_vmxfunc.S
 .endif
 
 .include 

Added files:

Index: src/sys/dev/nvmm/x86/nvmm_x86_vmx.c
diff -u /dev/null src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.1
--- /dev/null	Wed Feb 13 16:03:16 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Wed Feb 13 16:03:16 2019
@@ -0,0 +1,2823 @@
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.1 2019/02/13 16:03:16 maxv Exp $	*/
+
+/*
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software 

CVS commit: src/sys/kern

2019-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb 13 14:55:29 UTC 2019

Modified Files:
src/sys/kern: subr_asan.c

Log Message:
Align the kASan message style with kUBSan

Print messages with initial 'ASan', simiarly to kUBSan printing 'UBSan'.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/subr_asan.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/kern/subr_asan.c
diff -u src/sys/kern/subr_asan.c:1.2 src/sys/kern/subr_asan.c:1.3
--- src/sys/kern/subr_asan.c:1.2	Sun Dec 23 12:15:01 2018
+++ src/sys/kern/subr_asan.c	Wed Feb 13 14:55:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_asan.c,v 1.2 2018/12/23 12:15:01 maxv Exp $	*/
+/*	$NetBSD: subr_asan.c,v 1.3 2019/02/13 14:55:29 kamil Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.2 2018/12/23 12:15:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.3 2019/02/13 14:55:29 kamil Exp $");
 
 #include 
 #include 
@@ -166,7 +166,7 @@ kasan_init(void)
 static void
 kasan_report(unsigned long addr, size_t size, bool write, unsigned long pc)
 {
-	printf("kASan: Unauthorized Access In %p: Addr %p [%zu byte%s, %s]\n",
+	printf("ASan: Unauthorized Access In %p: Addr %p [%zu byte%s, %s]\n",
 	(void *)pc, (void *)addr, size, (size > 1 ? "s" : ""),
 	(write ? "write" : "read"));
 	kasan_md_unwind();



CVS commit: src/usr.sbin/gpioctl

2019-02-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Feb 13 11:40:41 UTC 2019

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

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/usr.sbin/gpioctl/gpioctl.8:1.22
--- src/usr.sbin/gpioctl/gpioctl.8:1.21	Tue Feb 12 21:41:38 2019
+++ src/usr.sbin/gpioctl/gpioctl.8	Wed Feb 13 11:40:41 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpioctl.8,v 1.21 2019/02/12 21:41:38 mlelstv Exp $
+.\" $NetBSD: gpioctl.8,v 1.22 2019/02/13 11:40:41 wiz Exp $
 .\"
 .\" Copyright (c) 2009, 2010, 2011, 2013 Marc Balmer 
 .\" Copyright (c) 2004 Alexander Yurchenko 
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd May 19, 2013
+.Dd February 12, 2019
 .Dt GPIOCTL 8
 .Os
 .Sh NAME



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

2019-02-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Feb 13 10:55:13 UTC 2019

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

Log Message:
Drop support for software interrupts. I had initially added that to cover
the three event types available on AMD, but Intel has seven of them, all
with weird and twisted meanings, and they require extra parameters.

Software interrupts should not be used anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.22
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.21	Wed Feb 13 07:04:12 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Wed Feb 13 10:55:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.21 2019/02/13 07:04:12 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.22 2019/02/13 10:55:13 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.21 2019/02/13 07:04:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.22 2019/02/13 10:55:13 maxv Exp $");
 
 #include 
 #include 
@@ -688,13 +688,13 @@ svm_vcpu_inject(struct nvmm_machine *mac
 		err = 0;
 		break;
 	case NVMM_EVENT_INTERRUPT_SW:
-		type = SVM_EVENT_TYPE_SW_INT;
-		err = 0;
-		break;
+		return EINVAL;
 	case NVMM_EVENT_EXCEPTION:
 		type = SVM_EVENT_TYPE_EXC;
 		if (event->vector == 2 || event->vector >= 32)
 			return EINVAL;
+		if (event->vector == 3 || event->vector == 0)
+			return EINVAL;
 		err = svm_event_has_error(event->vector);
 		break;
 	default:



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

2019-02-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Feb 13 09:57:46 UTC 2019

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

Log Message:
Conditionally compile a conditionally used variable.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/xen/x86/xen_mainbus.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/xen_mainbus.c
diff -u src/sys/arch/xen/x86/xen_mainbus.c:1.4 src/sys/arch/xen/x86/xen_mainbus.c:1.5
--- src/sys/arch/xen/x86/xen_mainbus.c:1.4	Sat Dec 22 08:35:04 2018
+++ src/sys/arch/xen/x86/xen_mainbus.c	Wed Feb 13 09:57:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $	*/
+/*	$NetBSD: xen_mainbus.c,v 1.5 2019/02/13 09:57:46 cherry Exp $	*/
 /*	NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp 	*/
 /*	NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp 	*/
 
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.4 2018/12/22 08:35:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.5 2019/02/13 09:57:46 cherry Exp $");
 
 #include 
 #include 
@@ -130,7 +130,9 @@ xen_mainbus_match(device_t parent, cfdat
 void
 xen_mainbus_attach(device_t parent, device_t self, void *aux)
 {
+#if NIPMI > 0 || NHYPERVISOR > 0
 	union xen_mainbus_attach_args mba;
+#endif
 
 #if NIPMI > 0
 	memset(_ipmi, 0, sizeof(mba.mba_ipmi));



CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2019-02-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Feb 13 08:46:40 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c

Log Message:
Fix DIAGNOSTIC build; replace FreeBSD-specific function with ours.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_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/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.11 src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.12
--- src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.11	Mon Jun  4 21:35:29 2018
+++ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c	Wed Feb 13 08:46:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.11 2018/06/04 21:35:29 christos Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.12 2019/02/13 08:46:40 rin Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -424,7 +424,8 @@ dtrace_trap(struct trapframe *frame, u_i
 	 */
 	nofault = (cpu_core[cpuid].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT) != 0;
 	if (nofault) {
-		KASSERTMSG((read_eflags() & PSL_I) == 0, "interrupts enabled");
+		KASSERTMSG((x86_read_flags() & PSL_I) == 0,
+		"interrupts enabled");
 
 		/*
 		 * There are only a couple of trap types that are expected.



CVS commit: src/sys/dev/mii

2019-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 08:42:26 UTC 2019

Modified Files:
src/sys/dev/mii: icsphy.c

Log Message:
 Add ICS1893C support from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/mii/icsphy.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/mii/icsphy.c
diff -u src/sys/dev/mii/icsphy.c:1.51 src/sys/dev/mii/icsphy.c:1.52
--- src/sys/dev/mii/icsphy.c:1.51	Tue Jan 22 03:42:27 2019
+++ src/sys/dev/mii/icsphy.c	Wed Feb 13 08:42:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: icsphy.c,v 1.51 2019/01/22 03:42:27 msaitoh Exp $	*/
+/*	$NetBSD: icsphy.c,v 1.52 2019/02/13 08:42:26 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icsphy.c,v 1.51 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icsphy.c,v 1.52 2019/02/13 08:42:26 msaitoh Exp $");
 
 #include 
 #include 
@@ -104,6 +104,9 @@ static const struct mii_phydesc icsphys[
 	{ MII_OUI_ICS,		MII_MODEL_ICS_1893,
 	  MII_STR_ICS_1893 },
 
+	{ MII_OUI_ICS,		MII_MODEL_ICS_1893C,
+	  MII_STR_ICS_1893C },
+
 	{ 0,			0,
 	  NULL },
 };



CVS commit: src/sys/dev/mii

2019-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 08:41:43 UTC 2019

Modified Files:
src/sys/dev/mii: ciphy.c

Log Message:
Add CS8204, CS8244 VSC8211 and VSC8601 support from {Free,Open}BSD.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/mii/ciphy.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/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.29 src/sys/dev/mii/ciphy.c:1.30
--- src/sys/dev/mii/ciphy.c:1.29	Tue Jan 22 03:42:27 2019
+++ src/sys/dev/mii/ciphy.c	Wed Feb 13 08:41:43 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.29 2019/01/22 03:42:27 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.30 2019/02/13 08:41:43 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.29 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.30 2019/02/13 08:41:43 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -83,6 +83,15 @@ static const struct mii_phydesc ciphys[]
 	{ MII_OUI_CICADA,		MII_MODEL_CICADA_CS8201B,
 	  MII_STR_CICADA_CS8201B },
 
+	{ MII_OUI_CICADA,		MII_MODEL_CICADA_CS8204,
+	  MII_STR_CICADA_CS8204 },
+
+	{ MII_OUI_CICADA,		MII_MODEL_CICADA_VSC8211,
+	  MII_STR_CICADA_VSC8211 },
+
+	{ MII_OUI_CICADA,		MII_MODEL_CICADA_CS8244,
+	  MII_STR_CICADA_CS8244 },
+
 	{ MII_OUI_xxCICADA,		MII_MODEL_CICADA_CS8201,
 	  MII_STR_CICADA_CS8201 },
 
@@ -92,6 +101,9 @@ static const struct mii_phydesc ciphys[]
 	{ MII_OUI_xxCICADA,		MII_MODEL_xxCICADA_CS8201B,
 	  MII_STR_xxCICADA_CS8201B },
 
+	{ MII_OUI_VITESSE,		MII_MODEL_VITESSE_VSC8601,
+	  MII_STR_VITESSE_VSC8601 },
+
 	{ 0,0,
 	  NULL },
 };
@@ -422,6 +434,7 @@ ciphy_fixup(struct mii_softc *sc)
 
 	switch (model) {
 	case MII_MODEL_CICADA_CS8201:
+	case MII_MODEL_CICADA_CS8204:
 
 		/* Turn off "aux mode" (whatever that means) */
 		PHY_SETBIT(sc, CIPHY_MII_AUXCSR, CIPHY_AUXCSR_MDPPS);
@@ -457,6 +470,10 @@ ciphy_fixup(struct mii_softc *sc)
 		}
 
 		break;
+	case MII_MODEL_CICADA_VSC8211:
+	case MII_MODEL_CICADA_CS8244:
+	case MII_MODEL_VITESSE_VSC8601:
+		break;
 	default:
 		aprint_error_dev(sc->mii_dev, "unknown CICADA PHY model %x\n",
 		model);



CVS commit: src/sys/dev/mii

2019-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 08:40:14 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.139 -r1.140 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.127 -r1.128 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.139 src/sys/dev/mii/miidevs.h:1.140
--- src/sys/dev/mii/miidevs.h:1.139	Wed Feb 13 04:35:58 2019
+++ src/sys/dev/mii/miidevs.h	Wed Feb 13 08:40:14 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.139 2019/02/13 04:35:58 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.140 2019/02/13 08:40:14 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.139 2019/02/13 04:35:28 msaitoh Exp
+ *	NetBSD: miidevs,v 1.140 2019/02/13 08:39:55 msaitoh Exp
  */
 
 /*-
@@ -303,12 +303,12 @@
 #define	MII_STR_CICADA_CS8201A	"Cicada CS8201 10/100/1000TX PHY"
 #define	MII_MODEL_CICADA_CS8201B	0x0021
 #define	MII_STR_CICADA_CS8201B	"Cicada CS8201 10/100/1000TX PHY"
+#define	MII_MODEL_CICADA_CS8244	0x002c
+#define	MII_STR_CICADA_CS8244	"Vitesse VSC8244 Quad 10/100/1000BASE-T PHY"
 #define	MII_MODEL_xxCICADA_VSC8221	0x0015
 #define	MII_STR_xxCICADA_VSC8221	"Vitesse VSC8221 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 */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.127 src/sys/dev/mii/miidevs_data.h:1.128
--- src/sys/dev/mii/miidevs_data.h:1.127	Wed Feb 13 04:35:58 2019
+++ src/sys/dev/mii/miidevs_data.h	Wed Feb 13 08:40:14 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.127 2019/02/13 04:35:58 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.128 2019/02/13 08:40:14 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.139 2019/02/13 04:35:28 msaitoh Exp
+ *	NetBSD: miidevs,v 1.140 2019/02/13 08:39:55 msaitoh Exp
  */
 
 /*-
@@ -113,9 +113,9 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_CICADA, MII_MODEL_CICADA_VSC8211, MII_STR_CICADA_VSC8211 },
  { MII_OUI_CICADA, MII_MODEL_CICADA_CS8201A, MII_STR_CICADA_CS8201A },
  { MII_OUI_CICADA, MII_MODEL_CICADA_CS8201B, MII_STR_CICADA_CS8201B },
+ { MII_OUI_CICADA, MII_MODEL_CICADA_CS8244, MII_STR_CICADA_CS8244 },
  { MII_OUI_xxCICADA, MII_MODEL_xxCICADA_VSC8221, MII_STR_xxCICADA_VSC8221 },
  { MII_OUI_xxCICADA, MII_MODEL_xxCICADA_CS8201B, MII_STR_xxCICADA_CS8201B },
- { MII_OUI_xxCICADA, MII_MODEL_xxCICADA_VSC8244, MII_STR_xxCICADA_VSC8244 },
  { MII_OUI_xxDAVICOM, MII_MODEL_xxDAVICOM_DM9101, MII_STR_xxDAVICOM_DM9101 },
  { MII_OUI_xxDAVICOM, MII_MODEL_xxDAVICOM_DM9102, MII_STR_xxDAVICOM_DM9102 },
  { MII_OUI_ICPLUS, MII_MODEL_ICPLUS_IP100, MII_STR_ICPLUS_IP100 },



CVS commit: src/sys/dev/mii

2019-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 13 08:39:55 UTC 2019

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

Log Message:
 Change CS8244's OUI from xxCICADA to CICADA. I don't know whether this
change is correct or not...


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 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.139 src/sys/dev/mii/miidevs:1.140
--- src/sys/dev/mii/miidevs:1.139	Wed Feb 13 04:35:28 2019
+++ src/sys/dev/mii/miidevs	Wed Feb 13 08:39:55 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.139 2019/02/13 04:35:28 msaitoh Exp $
+$NetBSD: miidevs,v 1.140 2019/02/13 08:39:55 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -220,9 +220,9 @@ model CICADA CS8204		0x0004 Cicada CS820
 model CICADA VSC8211		0x000b Cicada VSC8211 10/100/1000TX PHY
 model CICADA CS8201A		0x0020 Cicada CS8201 10/100/1000TX PHY
 model CICADA CS8201B		0x0021 Cicada CS8201 10/100/1000TX PHY
+model CICADA CS8244		0x002c Vitesse VSC8244 Quad 10/100/1000BASE-T PHY
 model xxCICADA VSC8221		0x0015 Vitesse VSC8221 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 */



CVS commit: src/sys/arch/x86

2019-02-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Feb 13 08:38:25 UTC 2019

Modified Files:
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Add the EPT pmap code, used by Intel-VMX.

The idea is that under NVMM, we don't want to implement the hypervisor page
tables manually in NVMM directly, because we want pageable guests; that is,
we want to allow UVM to unmap guest pages when the host comes under
pressure.

Contrary to AMD-SVM, Intel-VMX uses a different set of PTE bits from
native, and this has three important consequences:

 - We can't use the native PTE bits, so each time we want to modify the
   page tables, we need to know whether we're dealing with a native pmap
   or an EPT pmap. This is accomplished with callbacks, that handle
   everything PTE-related.

 - There is no recursive slot possible, so we can't use pmap_map_ptes().
   Rather, we walk down the EPT trees via the direct map, and that's
   actually a lot simpler (and probably faster too...).

 - The kernel is never mapped in an EPT pmap. An EPT pmap cannot be loaded
   on the host. This has two sub-consequences: at creation time we must
   zero out all of the top-level PTEs, and at destruction time we force
   the page out of the pool cache and into the pool, to ensure that a next
   allocation will invoke pmap_pdp_ctor() to create a native pmap and not
   recycle some stale EPT entries.

To create an EPT pmap, the caller must invoke pmap_ept_transform() on a
newly-allocated native pmap. And that's about it, from then on the EPT
callbacks will be invoked, and the pmap can be destroyed via the usual
pmap_destroy(). The TLB shootdown callback is not initialized however,
it is the responsibility of the hypervisor (NVMM) to set it.

There are some twisted cases that we need to handle. For example if
pmap_is_referenced() is called on a physical page that is entered both by
a native pmap and by an EPT pmap, we take the Accessed bits from the
two pmaps using different PTE sets in each case, and combine them into a
generic PP_ATTRS_U flag (that does not depend on the pmap type).

Given that the EPT layout is a 4-Level tree with the same address space as
native x86_64, we allow ourselves to use a few native macros in EPT, such
as pmap_pa2pte(), rather than re-defining them with "ept" in the name.

Even though this EPT code is rather complex, it is not too intrusive: just
a few callbacks in a few pmap functions, predicted-false to give priority
to native. So this comes with no messy #ifdef or performance cost.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.321 -r1.322 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.96 src/sys/arch/x86/include/pmap.h:1.97
--- src/sys/arch/x86/include/pmap.h:1.96	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/x86/include/pmap.h	Wed Feb 13 08:38:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.96 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: pmap.h,v 1.97 2019/02/13 08:38:25 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -370,6 +370,8 @@ u_int		x86_mmap_flags(paddr_t);
 
 bool		pmap_is_curpmap(struct pmap *);
 
+void		pmap_ept_transform(struct pmap *);
+
 #ifndef __HAVE_DIRECT_MAP
 void		pmap_vpage_cpu_init(struct cpu_info *);
 #endif

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.321 src/sys/arch/x86/x86/pmap.c:1.322
--- src/sys/arch/x86/x86/pmap.c:1.321	Mon Feb 11 14:59:33 2019
+++ src/sys/arch/x86/x86/pmap.c	Wed Feb 13 08:38:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.321 2019/02/11 14:59:33 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.322 2019/02/13 08:38:25 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.321 2019/02/11 14:59:33 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.322 2019/02/13 08:38:25 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4797,3 +4797,873 @@ x86_mmap_flags(paddr_t mdpgno)
 
 	return pflag;
 }
+
+#if defined(__HAVE_DIRECT_MAP) && defined(__x86_64__) && !defined(XEN)
+
+/*
+ * -
+ * *
+ * *
+ * *
+ * *
+ *  HERE BEGINS THE EPT CODE, USED BY INTEL-VMX 
+ * *
+ *