CVS commit: src

2018-11-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Nov 11 07:43:35 UTC 2018

Modified Files:
src: Makefile

Log Message:
.WAIT for tools to complete.
There's a lot of waits inside tools, but nothing that promises that we haven't
started doing the next subdir in the top level.

Shows up as warnings in the cleandir stage on releng builds:

cleandir ===> external/mit/xorg/server/drivers/xf86-video-suncg6
cleandir ===> lib/libpam/modules/pam_deny
sh: /home/builds/ab/HEAD-llvm/sparc64/201811091720Z-tools/bin/nbawk: not found
nbmake[9]: "../../Makefile.xf86-driver" line 23: warning: 
"/home/builds/ab/HEAD-llvm/sparc64/201811091720Z-tools/bin/nbawk 
'/^PACKAGE_VERSION=/ {match($1, "[0-9]+\\.[0-9]+\\.[0-9]+");  
version = substr($1, RSTART, RLENGTH);  } END { print version }'

/home/source/ab/HEAD-llvm/xsrc/external/mit/xf86-video-ati/dist/configure" 
returned non-zero status
sh: /home/builds/ab/HEAD-llvm/sparc64/201811091720Z-tools/bin/nbawk: not found


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/Makefile

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.324 src/Makefile:1.325
--- src/Makefile:1.324	Wed May  2 07:34:44 2018
+++ src/Makefile	Sun Nov 11 07:43:35 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.324 2018/05/02 07:34:44 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.325 2018/11/11 07:43:35 maya Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -137,8 +137,8 @@ _SRC_TOP_OBJ_=
 # _SUBDIR is used to set SUBDIR, after removing directories that have
 # BUILD_${dir}=no, or that have no ${dir}/Makefile.
 #
-_SUBDIR=	tools lib include external crypto/external bin games
-_SUBDIR+=	libexec sbin usr.bin
+_SUBDIR=	tools .WAIT lib include external crypto/external bin
+_SUBDIR+=	games libexec sbin usr.bin
 _SUBDIR+=	usr.sbin share sys etc tests compat
 _SUBDIR+=	.WAIT rescue .WAIT distrib regress
 



CVS commit: src/usr.bin/gzip

2018-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 11 01:42:36 UTC 2018

Modified Files:
src/usr.bin/gzip: unlz.c

Log Message:
use the data size in case stdout was a pipe (M. Levinson)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/gzip/unlz.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/gzip/unlz.c
diff -u src/usr.bin/gzip/unlz.c:1.5 src/usr.bin/gzip/unlz.c:1.6
--- src/usr.bin/gzip/unlz.c:1.5	Sun Oct 28 20:14:37 2018
+++ src/usr.bin/gzip/unlz.c	Sat Nov 10 20:42:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: unlz.c,v 1.5 2018/10/29 00:14:37 christos Exp $	*/
+/*	$NetBSD: unlz.c,v 1.6 2018/11/11 01:42:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -575,7 +575,12 @@ lz_decode(int fin, int fdout, unsigned d
 	}
 	if (insize)
 		*insize = rv;
+#if 0
+	/* Does not work with pipes */
 	rv = ftello(lz.fout);
+#else
+	rv = data_size;
+#endif
 out:
 	lz_destroy(&lz);
 	return rv;



CVS commit: src/tests/kernel

2018-11-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 11 01:26:00 UTC 2018

Modified Files:
src/tests/kernel: h_segv.c

Log Message:
Sort #includes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/kernel/h_segv.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/kernel/h_segv.c
diff -u src/tests/kernel/h_segv.c:1.7 src/tests/kernel/h_segv.c:1.8
--- src/tests/kernel/h_segv.c:1.7	Wed May 30 17:48:13 2018
+++ src/tests/kernel/h_segv.c	Sun Nov 11 01:26:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_segv.c,v 1.7 2018/05/30 17:48:13 kamil Exp $	*/
+/*	$NetBSD: h_segv.c,v 1.8 2018/11/11 01:26:00 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,17 +29,18 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: h_segv.c,v 1.7 2018/05/30 17:48:13 kamil Exp $");
+__RCSID("$NetBSD: h_segv.c,v 1.8 2018/11/11 01:26:00 riastradh Exp $");
 
 #include 
 #include 
 #include 
+
+#include 
+#include 
 #include 
-#include 
 #include 
+#include 
 #include 
-#include 
-#include 
 
 static int flags;
 #define F_RECURSE 	1



CVS commit: src/tests/kernel

2018-11-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 11 01:26:08 UTC 2018

Modified Files:
src/tests/kernel: Makefile h_segv.c

Log Message:
Use feenableexcept to trap fp exceptions, and trigger one, for SIGFPE.

Not every CPU traps integer division by zero -- aarch64, powerpc,
&c., just return zero.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/kernel/Makefile
cvs rdiff -u -r1.8 -r1.9 src/tests/kernel/h_segv.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/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.53 src/tests/kernel/Makefile:1.54
--- src/tests/kernel/Makefile:1.53	Wed Mar 14 02:13:47 2018
+++ src/tests/kernel/Makefile	Sun Nov 11 01:26:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.53 2018/03/14 02:13:47 kamil Exp $
+# $NetBSD: Makefile,v 1.54 2018/11/11 01:26:08 riastradh Exp $
 
 NOMAN=		# defined
 
@@ -67,4 +67,6 @@ CPPFLAGS.t_subr_prf.c=	-Wno-pointer-sign
 
 CLEANFILES+=	t_subr_prf.c
 
+LDADD.h_segv+=	-lm
+
 .include 

Index: src/tests/kernel/h_segv.c
diff -u src/tests/kernel/h_segv.c:1.8 src/tests/kernel/h_segv.c:1.9
--- src/tests/kernel/h_segv.c:1.8	Sun Nov 11 01:26:00 2018
+++ src/tests/kernel/h_segv.c	Sun Nov 11 01:26:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_segv.c,v 1.8 2018/11/11 01:26:00 riastradh Exp $	*/
+/*	$NetBSD: h_segv.c,v 1.9 2018/11/11 01:26:08 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,13 +29,14 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: h_segv.c,v 1.8 2018/11/11 01:26:00 riastradh Exp $");
+__RCSID("$NetBSD: h_segv.c,v 1.9 2018/11/11 01:26:08 riastradh Exp $");
 
 #include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -103,10 +104,12 @@ trigger_ill(void)
 static void
 trigger_fpe(void)
 {
-	volatile int a = getpid();
-	volatile int b = strtol("0", NULL, 0);
+	volatile double a = getpid();
+	volatile double b = strtol("0", NULL, 0);
 
-	usleep(a/b);
+	feenableexcept(FE_ALL_EXCEPT);
+
+	usleep((int)(a/b));
 }
 
 static void



CVS commit: src/usr.sbin/acpitools/acpidump

2018-11-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Nov 11 00:24:01 UTC 2018

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c

Log Message:
& promotes to int already, so clang warns about the hh modifier.
(and we use -Werror)

ok xtos


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/acpitools/acpidump/acpi.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/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.40 src/usr.sbin/acpitools/acpidump/acpi.c:1.41
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.40	Mon Nov  5 07:39:57 2018
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Sun Nov 11 00:24:01 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.40 2018/11/05 07:39:57 msaitoh Exp $ */
+/* $NetBSD: acpi.c,v 1.41 2018/11/11 00:24:01 maya Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: acpi.c,v 1.40 2018/11/05 07:39:57 msaitoh Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.41 2018/11/11 00:24:01 maya Exp $");
 
 #include 
 #include 
@@ -1236,7 +1236,7 @@ acpi_handle_bgrt(ACPI_TABLE_HEADER *sdp)
 	degree = ((unsigned int)(bgrt->Status & ACPI_BGRT_ORIENTATION_OFFSET)
 	>> 1) * 90;
 	printf("\tDegree=%u\n", degree);
-	printf("\tDisplayed=%hhu\n", bgrt->Status & ACPI_BGRT_DISPLAYED);
+	printf("\tDisplayed=%u\n", bgrt->Status & ACPI_BGRT_DISPLAYED);
 	printf("\tImage Type=");
 	switch (bgrt->ImageType) {
 	case 0:



CVS commit: src/lib/libnvmm

2018-11-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Nov 11 00:06:48 UTC 2018

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

Log Message:
Add missing include for struct nvmm_x64_state
(Pointed out by the clang build)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.1 src/lib/libnvmm/libnvmm_x86.c:1.2
--- src/lib/libnvmm/libnvmm_x86.c:1.1	Sat Nov 10 09:28:56 2018
+++ src/lib/libnvmm/libnvmm_x86.c	Sun Nov 11 00:06:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.1 2018/11/10 09:28:56 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.2 2018/11/11 00:06:48 maya Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "nvmm.h"
 



CVS commit: src/tests/lib/libm

2018-11-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Nov 10 23:04:16 UTC 2018

Modified Files:
src/tests/lib/libm: t_cos.c

Log Message:
Print the input to cosf on failure too.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libm/t_cos.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/libm/t_cos.c
diff -u src/tests/lib/libm/t_cos.c:1.6 src/tests/lib/libm/t_cos.c:1.7
--- src/tests/lib/libm/t_cos.c:1.6	Wed Nov  7 04:00:13 2018
+++ src/tests/lib/libm/t_cos.c	Sat Nov 10 23:04:16 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cos.c,v 1.6 2018/11/07 04:00:13 riastradh Exp $ */
+/* $NetBSD: t_cos.c,v 1.7 2018/11/10 23:04:16 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -179,8 +179,8 @@ ATF_TC_BODY(cosf_angles, tc)
 
 		assert(cos_theta != 0);
 		if (!(fabsf((cosf(theta) - cos_theta)/cos_theta) <= eps)) {
-			atf_tc_fail_nonfatal("cosf(%d deg) = %.8g != %.8g",
-			deg, cos(theta), cos_theta);
+			atf_tc_fail_nonfatal("cosf(%d deg = %.8g) = %.8g"
+			" != %.8g", deg, theta, cos(theta), cos_theta);
 		}
 	}
 }



CVS commit: src/share/mk

2018-11-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Nov 10 22:19:33 UTC 2018

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Revert part of 1.1079. MKSOFTFLOAT?=yes for mips64*.

That is most likely an accidental commit.

PR port-mips/53719


To generate a diff of this commit:
cvs rdiff -u -r1.1079 -r1.1080 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1079 src/share/mk/bsd.own.mk:1.1080
--- src/share/mk/bsd.own.mk:1.1079	Sat Nov 10 01:40:46 2018
+++ src/share/mk/bsd.own.mk	Sat Nov 10 22:19:33 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1079 2018/11/10 01:40:46 macallan Exp $
+#	$NetBSD: bsd.own.mk,v 1.1080 2018/11/10 22:19:33 maya Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -980,7 +980,7 @@ MKCOMPATMODULES:=	no
 # These platforms use softfloat by default.
 #
 .if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
-MKSOFTFLOAT?=	no
+MKSOFTFLOAT?=	yes
 .endif
 
 #



CVS commit: src/sys/arch/evbarm/conf

2018-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 10 19:35:19 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: std.generic

Log Message:
Revert previous - not needed here, I got lost in the include maze


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/std.generic

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/evbarm/conf/std.generic
diff -u src/sys/arch/evbarm/conf/std.generic:1.4 src/sys/arch/evbarm/conf/std.generic:1.5
--- src/sys/arch/evbarm/conf/std.generic:1.4	Sat Nov 10 16:19:58 2018
+++ src/sys/arch/evbarm/conf/std.generic	Sat Nov 10 19:35:19 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.generic,v 1.4 2018/11/10 16:19:58 martin Exp $
+#	$NetBSD: std.generic,v 1.5 2018/11/10 19:35:19 martin Exp $
 #
 # 	generic NetBSD/evbarm with FDT support
 
@@ -41,6 +41,3 @@ makeoptions	KERNEL_BASE_VIRT="0x8040
 # General options
 options 	CHILD_MAX=1024	# 160 is too few
 options 	OPEN_MAX=1024	# 128 is too few
-
-options 	NTP		# NTP phase/frequency locked loop
-



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

2018-11-10 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Nov 10 18:30:58 UTC 2018

Modified Files:
src/sys/arch/aarch64/include: asan.h

Log Message:
add LX_BLKPAG_SH_IS pte attribute for MP


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/asan.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/aarch64/include/asan.h
diff -u src/sys/arch/aarch64/include/asan.h:1.3 src/sys/arch/aarch64/include/asan.h:1.4
--- src/sys/arch/aarch64/include/asan.h:1.3	Thu Nov  8 08:28:07 2018
+++ src/sys/arch/aarch64/include/asan.h	Sat Nov 10 18:30:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: asan.h,v 1.3 2018/11/08 08:28:07 maxv Exp $	*/
+/*	$NetBSD: asan.h,v 1.4 2018/11/10 18:30:58 ryo Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -137,7 +137,8 @@ kasan_md_shadow_map_page(vaddr_t va)
 	if (!l3pte_valid(pde)) {
 		pa = __md_palloc();
 		atomic_swap_64(&l3[idx], pa | L3_PAGE | LX_BLKPAG_UXN |
-		LX_BLKPAG_PXN | LX_BLKPAG_AF | LX_BLKPAG_AP_RW);
+		LX_BLKPAG_PXN | LX_BLKPAG_AF | LX_BLKPAG_SH_IS |
+		LX_BLKPAG_AP_RW);
 		aarch64_tlbi_by_va(va);
 	}
 }



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

2018-11-10 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Nov 10 18:29:08 UTC 2018

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

Log Message:
need to invalidate TLBs after pmapboot_enter(). pmapboot_protect() requires 
KSEG mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/aarch64/aarch64/aarch64_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/aarch64/aarch64/aarch64_machdep.c
diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.19 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.20
--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.19	Fri Nov  9 04:05:27 2018
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c	Sat Nov 10 18:29:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.19 2018/11/09 04:05:27 mrg Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.20 2018/11/10 18:29:08 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.19 2018/11/09 04:05:27 mrg Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.20 2018/11/10 18:29:08 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -146,6 +146,7 @@ cpu_kernel_vm_init(uint64_t memory_start
 	pmapboot_enter(AARCH64_PA_TO_KVA(memory_start), memory_start,
 	memory_size, L1_SIZE, ksegattr, PMAPBOOT_ENTER_NOOVERWRITE,
 	bootpage_alloc, NULL);
+	aarch64_tlbi_all();
 
 	/*
 	 * at this point, whole kernel image is mapped as "rwx".



CVS commit: src/sys/arch/evbarm/conf

2018-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 10 16:19:58 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC.common std.generic

Log Message:
Add options NTP and enable clockctl.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbarm/conf/GENERIC.common
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/std.generic

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/evbarm/conf/GENERIC.common
diff -u src/sys/arch/evbarm/conf/GENERIC.common:1.30 src/sys/arch/evbarm/conf/GENERIC.common:1.31
--- src/sys/arch/evbarm/conf/GENERIC.common:1.30	Sat Jul 14 15:09:41 2018
+++ src/sys/arch/evbarm/conf/GENERIC.common	Sat Nov 10 16:19:58 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.common,v 1.30 2018/07/14 15:09:41 maxv Exp $
+#	$NetBSD: GENERIC.common,v 1.31 2018/11/10 16:19:58 martin Exp $
 #
 #	GENERIC evbarm kernel config (template)
 #
@@ -147,7 +147,7 @@ pseudo-device	npf			# NPF packet filter
 # miscellaneous pseudo-devices
 pseudo-device	pty			# pseudo-terminals
 #options 	RND_COM
-#pseudo-device	clockctl		# user control of clock subsystem
+pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	ksyms			# /dev/ksyms
 pseudo-device	lockstat		# lock profiling
 

Index: src/sys/arch/evbarm/conf/std.generic
diff -u src/sys/arch/evbarm/conf/std.generic:1.3 src/sys/arch/evbarm/conf/std.generic:1.4
--- src/sys/arch/evbarm/conf/std.generic:1.3	Thu Oct 18 09:01:54 2018
+++ src/sys/arch/evbarm/conf/std.generic	Sat Nov 10 16:19:58 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.generic,v 1.3 2018/10/18 09:01:54 skrll Exp $
+#	$NetBSD: std.generic,v 1.4 2018/11/10 16:19:58 martin Exp $
 #
 # 	generic NetBSD/evbarm with FDT support
 
@@ -41,3 +41,6 @@ makeoptions	KERNEL_BASE_VIRT="0x8040
 # General options
 options 	CHILD_MAX=1024	# 160 is too few
 options 	OPEN_MAX=1024	# 128 is too few
+
+options 	NTP		# NTP phase/frequency locked loop
+



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

2018-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 10 11:46:31 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gicv3.c gicv3.h gicv3_its.c gicv3_its.h

Log Message:
Implement pic_get_affinity/pic_set_affinity for LPIs via ITS


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/cortex/gicv3.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/cortex/gicv3.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/cortex/gicv3_its.c \
src/sys/arch/arm/cortex/gicv3_its.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/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.6 src/sys/arch/arm/cortex/gicv3.c:1.7
--- src/sys/arch/arm/cortex/gicv3.c:1.6	Sat Nov 10 01:56:28 2018
+++ src/sys/arch/arm/cortex/gicv3.c	Sat Nov 10 11:46:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.6 2018/11/10 01:56:28 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.7 2018/11/10 11:46:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.6 2018/11/10 01:56:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.7 2018/11/10 11:46:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -556,7 +556,7 @@ static void
 gicv3_lpi_cpu_init(struct pic_softc *pic, struct cpu_info *ci)
 {
 	struct gicv3_softc * const sc = LPITOSOFTC(pic);
-	struct gicv3_cpu_init *cpu_init;
+	struct gicv3_lpi_callback *cb;
 	uint32_t ctlr;
 
 	/* If physical LPIs are not supported on this redistributor, just return. */
@@ -594,16 +594,46 @@ gicv3_lpi_cpu_init(struct pic_softc *pic
 	arm_dsb();
 
 	/* Setup ITS if present */
-	LIST_FOREACH(cpu_init, &sc->sc_cpu_init, list)
-		cpu_init->func(cpu_init->arg, ci);
+	LIST_FOREACH(cb, &sc->sc_lpi_callbacks, list)
+		cb->cpu_init(cb->priv, ci);
 }
 
+#ifdef MULTIPROCESSOR
+static void
+gicv3_lpi_get_affinity(struct pic_softc *pic, size_t irq, kcpuset_t *affinity)
+{
+	struct gicv3_softc * const sc = LPITOSOFTC(pic);
+	struct gicv3_lpi_callback *cb;
+
+	LIST_FOREACH(cb, &sc->sc_lpi_callbacks, list)
+		cb->get_affinity(cb->priv, irq, affinity);
+}
+
+static int
+gicv3_lpi_set_affinity(struct pic_softc *pic, size_t irq, const kcpuset_t *affinity)
+{
+	struct gicv3_softc * const sc = LPITOSOFTC(pic);
+	struct gicv3_lpi_callback *cb;
+	int error = EINVAL;
+
+	LIST_FOREACH(cb, &sc->sc_lpi_callbacks, list) {
+		error = cb->set_affinity(cb->priv, irq, affinity);
+		if (error)
+			return error;
+	}
+
+	return error;
+}
+#endif
+
 static const struct pic_ops gicv3_lpiops = {
 	.pic_unblock_irqs = gicv3_lpi_unblock_irqs,
 	.pic_block_irqs = gicv3_lpi_block_irqs,
 	.pic_establish_irq = gicv3_lpi_establish_irq,
 #ifdef MULTIPROCESSOR
 	.pic_cpu_init = gicv3_lpi_cpu_init,
+	.pic_get_affinity = gicv3_lpi_get_affinity,
+	.pic_set_affinity = gicv3_lpi_set_affinity,
 #endif
 };
 
@@ -695,7 +725,7 @@ gicv3_init(struct gicv3_softc *sc)
 
 	KASSERT(CPU_IS_PRIMARY(curcpu()));
 
-	LIST_INIT(&sc->sc_cpu_init);
+	LIST_INIT(&sc->sc_lpi_callbacks);
 
 	for (n = 0; n < MAXCPUS; n++)
 		sc->sc_irouter[n] = UINT64_MAX;

Index: src/sys/arch/arm/cortex/gicv3.h
diff -u src/sys/arch/arm/cortex/gicv3.h:1.3 src/sys/arch/arm/cortex/gicv3.h:1.4
--- src/sys/arch/arm/cortex/gicv3.h:1.3	Sat Nov 10 01:56:28 2018
+++ src/sys/arch/arm/cortex/gicv3.h	Sat Nov 10 11:46:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.h,v 1.3 2018/11/10 01:56:28 jmcneill Exp $ */
+/* $NetBSD: gicv3.h,v 1.4 2018/11/10 11:46:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -38,11 +38,14 @@ struct gicv3_dma {
 	bus_size_t		len;
 };
 
-struct gicv3_cpu_init {
-	void			(*func)(void *, struct cpu_info *ci);
-	void			*arg;
+struct gicv3_lpi_callback {
+	void			(*cpu_init)(void *, struct cpu_info *);
+	void			(*get_affinity)(void *, size_t, kcpuset_t *);
+	int			(*set_affinity)(void *, size_t, const kcpuset_t *);
 
-	LIST_ENTRY(gicv3_cpu_init) list;
+	void			*priv;
+
+	LIST_ENTRY(gicv3_lpi_callback) list;
 };
 
 struct gicv3_softc {
@@ -69,8 +72,8 @@ struct gicv3_softc {
 	/* Unique identifier for PEs */
 	u_int			sc_processor_id[MAXCPUS];
 
-	/* CPU init callbacks */
-	LIST_HEAD(, gicv3_cpu_init) sc_cpu_init;
+	/* Callbacks */
+	LIST_HEAD(, gicv3_lpi_callback) sc_lpi_callbacks;
 };
 
 int	gicv3_init(struct gicv3_softc *);

Index: src/sys/arch/arm/cortex/gicv3_its.c
diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.1 src/sys/arch/arm/cortex/gicv3_its.c:1.2
--- src/sys/arch/arm/cortex/gicv3_its.c:1.1	Fri Nov  9 23:36:24 2018
+++ src/sys/arch/arm/cortex/gicv3_its.c	Sat Nov 10 11:46:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.1 2018/11/09 23:36:24 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.2 2018/11/10 11:46:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.1 2018/11/09 23:36:24 jmcneill Exp $");
+__KERNEL

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

2018-11-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Nov 10 11:08:54 UTC 2018

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
Merge the VIA detection code into cpu_probe_c3.


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

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

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.81 src/sys/arch/x86/x86/identcpu.c:1.82
--- src/sys/arch/x86/x86/identcpu.c:1.81	Sat Nov 10 10:52:52 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sat Nov 10 11:08:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.81 2018/11/10 10:52:52 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.82 2018/11/10 11:08:54 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.81 2018/11/10 10:52:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.82 2018/11/10 11:08:54 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -482,32 +482,13 @@ static void
 cpu_probe_winchip(struct cpu_info *ci)
 {
 
-	if (cpu_vendor != CPUVENDOR_IDT)
+	if (cpu_vendor != CPUVENDOR_IDT ||
+	CPUID_TO_FAMILY(ci->ci_signature) != 5)
 		return;
 
-	switch (CPUID_TO_FAMILY(ci->ci_signature)) {
-	case 5:
-		/* WinChip C6 */
-		if (CPUID_TO_MODEL(ci->ci_signature) == 4)
-			ci->ci_feat_val[0] &= ~CPUID_TSC;
-		break;
-	case 6:
-		/*
-		 * VIA Eden ESP 
-		 *
-		 * Quoting from page 3-4 of: "VIA Eden ESP Processor Datasheet"
-		 * http://www.via.com.tw/download/mainboards/6/14/Eden20v115.pdf
-		 * 
-		 * 1. The CMPXCHG8B instruction is provided and always enabled,
-		 *however, it appears disabled in the corresponding CPUID
-		 *function bit 0 to avoid a bug in an early version of
-		 *Windows NT. However, this default can be changed via a
-		 *bit in the FCR MSR.
-		 */
-		ci->ci_feat_val[0] |= CPUID_CX8;
-		wrmsr(MSR_VIA_FCR, rdmsr(MSR_VIA_FCR) | VIA_ACE_ECX8);
-		break;
-	}
+	/* WinChip C6 */
+	if (CPUID_TO_MODEL(ci->ci_signature) == 4)
+		ci->ci_feat_val[0] &= ~CPUID_TSC;
 }
 
 static void
@@ -528,8 +509,25 @@ cpu_probe_c3(struct cpu_info *ci)
 	x86_cpuid(0x8000, descs);
 	lfunc = descs[0];
 
+	if (family == 6) {
+		/*
+		 * VIA Eden ESP.
+		 *
+		 * Quoting from page 3-4 of: "VIA Eden ESP Processor Datasheet"
+		 * http://www.via.com.tw/download/mainboards/6/14/Eden20v115.pdf
+		 * 
+		 * 1. The CMPXCHG8B instruction is provided and always enabled,
+		 *however, it appears disabled in the corresponding CPUID
+		 *function bit 0 to avoid a bug in an early version of
+		 *Windows NT. However, this default can be changed via a
+		 *bit in the FCR MSR.
+		 */
+		ci->ci_feat_val[0] |= CPUID_CX8;
+		wrmsr(MSR_VIA_FCR, rdmsr(MSR_VIA_FCR) | VIA_ACE_ECX8);
+	}
+
 	if (family > 6 || model > 0x9 || (model == 0x9 && stepping >= 3)) {
-		/* Nehemiah or Esther */
+		/* VIA Nehemiah or Esther. */
 		x86_cpuid(0xc000, descs);
 		lfunc = descs[0];
 		if (lfunc >= 0xc001) {	/* has ACE, RNG */



CVS commit: src/lib/libnvmm

2018-11-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Nov 10 10:57:06 UTC 2018

Modified Files:
src/lib/libnvmm: libnvmm.3

Log Message:
Add copyright and RCSID, from wiz@.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libnvmm/libnvmm.3

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.3
diff -u src/lib/libnvmm/libnvmm.3:1.1 src/lib/libnvmm/libnvmm.3:1.2
--- src/lib/libnvmm/libnvmm.3:1.1	Sat Nov 10 09:28:56 2018
+++ src/lib/libnvmm/libnvmm.3	Sat Nov 10 10:57:06 2018
@@ -1,4 +1,33 @@
-.Dd September 12, 2018
+.\"	$NetBSD: libnvmm.3,v 1.2 2018/11/10 10:57:06 maxv Exp $
+.\"
+.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Maxime Villard.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd November 10, 2018
 .Dt LIBNVMM 3
 .Os
 .Sh NAME



CVS commit: src/sys/arch/x86

2018-11-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Nov 10 10:52:52 UTC 2018

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

Log Message:
Declare the MSR_VIA_ACE values as macros, and use a consistent naming,
similar to the rest of the file.

I'm wondering if I'm not fixing a huge bug here. The ECX8 value we were
using was wrong: ECX8 is bit 1, not bit 0. Bit 0 is ALTINST, an alternate
ISA, which is now known to be backdoored.

So it looks like we were explicitly enabling the backdoor.

Not tested, because I don't have a VIA cpu.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.130 src/sys/arch/x86/include/specialreg.h:1.131
--- src/sys/arch/x86/include/specialreg.h:1.130	Mon Aug 20 08:53:48 2018
+++ src/sys/arch/x86/include/specialreg.h	Sat Nov 10 10:52:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.130 2018/08/20 08:53:48 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.131 2018/11/10 10:52:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -796,7 +796,9 @@
 #define MSR_VIA_RNG_NOISE_B	0x0100
 #define MSR_VIA_RNG_2NOISE	0x0300
 #define MSR_VIA_ACE		0x1107
-#define MSR_VIA_ACE_ENABLE	0x1000
+#define 	VIA_ACE_ALTINST	0x0001
+#define 	VIA_ACE_ECX8	0x0002
+#define 	VIA_ACE_ENABLE	0x1000
 
 /*
  * VIA "Eden" MSRs

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.80 src/sys/arch/x86/x86/identcpu.c:1.81
--- src/sys/arch/x86/x86/identcpu.c:1.80	Sat Nov 10 09:42:42 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sat Nov 10 10:52:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.80 2018/11/10 09:42:42 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.81 2018/11/10 10:52:52 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.80 2018/11/10 09:42:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.81 2018/11/10 10:52:52 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -505,7 +505,7 @@ cpu_probe_winchip(struct cpu_info *ci)
 		 *bit in the FCR MSR.
 		 */
 		ci->ci_feat_val[0] |= CPUID_CX8;
-		wrmsr(MSR_VIA_FCR, rdmsr(MSR_VIA_FCR) | 0x0001);
+		wrmsr(MSR_VIA_FCR, rdmsr(MSR_VIA_FCR) | VIA_ACE_ECX8);
 		break;
 	}
 }
@@ -598,9 +598,8 @@ cpu_probe_c3(struct cpu_info *ci)
 
 		if (ace_enable) {
 			msr = rdmsr(MSR_VIA_ACE);
-			wrmsr(MSR_VIA_ACE, msr | MSR_VIA_ACE_ENABLE);
+			wrmsr(MSR_VIA_ACE, msr | VIA_ACE_ENABLE);
 		}
-
 		}
 	}
 



CVS commit: src/sys

2018-11-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Nov 10 09:42:42 UTC 2018

Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c
src/sys/arch/x86/x86: identcpu.c
src/sys/dev/nvmm/x86: nvmm_x86_svm.c

Log Message:
Remove unused cpu_msr.h includes.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/x86/acpi/acpi_cpu_md.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.1 -r1.2 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/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.78 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.79
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.78	Thu Dec  8 11:31:12 2016
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Sat Nov 10 09:42:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.78 2016/12/08 11:31:12 nat Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.79 2018/11/10 09:42:42 maxv Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.78 2016/12/08 11:31:12 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.79 2018/11/10 09:42:42 maxv Exp $");
 
 #include 
 #include 
@@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.79 src/sys/arch/x86/x86/identcpu.c:1.80
--- src/sys/arch/x86/x86/identcpu.c:1.79	Wed Jul  4 07:55:57 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sat Nov 10 09:42:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.79 2018/07/04 07:55:57 maya Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.80 2018/11/10 09:42:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.79 2018/07/04 07:55:57 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.80 2018/11/10 09:42:42 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -48,7 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: identcpu.c,v
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 	/* for vmt_hvcall() */

Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.1 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.2
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.1	Wed Nov  7 07:43:08 2018
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Sat Nov 10 09:42:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.1 2018/11/07 07:43:08 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.2 2018/11/10 09:42:42 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.1 2018/11/07 07:43:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.2 2018/11/10 09:42:42 maxv Exp $");
 
 #include 
 #include 
@@ -43,7 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src

2018-11-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Nov 10 09:28:56 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: md.amd64
src/lib: Makefile
Added Files:
src/lib/libnvmm: Makefile libnvmm.3 libnvmm.c libnvmm_x86.c nvmm.h
shlib_version

Log Message:
Add libnvmm, NetBSD's new virtualization API. It provides a way for VMM
software to effortlessly create and manage virtual machines via NVMM.

It is mostly complete, only nvmm_assist_mem needs to be filled -- I have
a draft for that, but it needs some more care. This Mem Assist should
not be needed when emulating a system in x2apic mode, so theoretically
the current form of libnvmm is sufficient to emulate a whole class of
systems.

Generally speaking, there are so many modes in x86 that it is difficult
to handle each corner case without introducing a ton of checks that just
slow down the common-case execution. Currently we check a limited number
of things; we may add more checks in the future if they turn out to be
needed, but that's rather low priority.

Libnvmm is compiled and installed only on amd64. A man page (reviewed by
wiz@) is provided.


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.261 -r1.262 src/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/libnvmm/Makefile src/lib/libnvmm/libnvmm.3 \
src/lib/libnvmm/libnvmm.c src/lib/libnvmm/libnvmm_x86.c \
src/lib/libnvmm/nvmm.h src/lib/libnvmm/shlib_version

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

Modified files:

Index: src/distrib/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.260 src/distrib/sets/lists/comp/md.amd64:1.261
--- src/distrib/sets/lists/comp/md.amd64:1.260	Wed Nov  7 07:43:07 2018
+++ src/distrib/sets/lists/comp/md.amd64	Sat Nov 10 09:28:56 2018
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.260 2018/11/07 07:43:07 maxv Exp $
+# $NetBSD: md.amd64,v 1.261 2018/11/10 09:28:56 maxv Exp $
 
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
@@ -682,6 +682,7 @@
 ./usr/include/dev/nvmm/nvmm_ioctl.h		comp-c-include
 ./usr/include/dev/nvmm/x86			comp-c-include
 ./usr/include/dev/nvmm/x86/nvmm_x86.h		comp-c-include
+./usr/include/nvmm.hcomp-c-include
 ./usr/include/pmmintrin.h			comp-obsolete		obsolete
 ./usr/include/x64_64comp-obsolete		obsolete
 ./usr/include/x64_64/ansi.h			comp-obsolete		obsolete
@@ -783,6 +784,12 @@
 ./usr/lib/i386/libi386.so			comp-sys-shlib		compat,pic
 ./usr/lib/i386/libi386_p.a			comp-c-proflib		compat,profile
 ./usr/lib/i386/libi386_pic.a			comp-c-piclib		compat,pic,picinstall
+./usr/lib/libnvmm.acomp-c-lib		compatfile
+./usr/lib/libnvmm.socomp-sys-shlib		compat,pic
+./usr/lib/libnvmm.so.0comp-sys-shlib		compat,pic
+./usr/lib/libnvmm.so.0.1			comp-sys-shlib		compat,pic
+./usr/lib/libnvmm_p.acomp-c-proflib		compatfile,profile
+./usr/lib/libnvmm_pic.acomp-c-piclib		compat,pic,picinstall
 ./usr/lib/libx86_64.acomp-c-lib
 ./usr/lib/libx86_64_p.acomp-c-proflib		profile
 ./usr/lib/libx86_64_pic.a			comp-c-piclib		pic,picinstall
@@ -888,3 +895,6 @@
 ./usr/share/ldscripts/i386nbsd.xn		comp-obsolete		obsolete
 ./usr/share/ldscripts/i386nbsd.xr		comp-obsolete		obsolete
 ./usr/share/ldscripts/i386nbsd.xu		comp-obsolete		obsolete
+./usr/share/man/cat3/libnvmm.0			comp-c-catman		.cat
+./usr/share/man/html3/libnvmm.html		comp-c-htmlman		html
+./usr/share/man/man3/libnvmm.3			comp-c-man		.man

Index: src/lib/Makefile
diff -u src/lib/Makefile:1.261 src/lib/Makefile:1.262
--- src/lib/Makefile:1.261	Sat Sep  8 14:11:41 2018
+++ src/lib/Makefile	Sat Nov 10 09:28:56 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.261 2018/09/08 14:11:41 christos Exp $
+#	$NetBSD: Makefile,v 1.262 2018/11/10 09:28:56 maxv Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -50,6 +50,10 @@ SUBDIR+=	librumpclient
 SUBDIR+=	libskey
 .endif
 
+.if ${MACHINE_ARCH} == "x86_64"
+SUBDIR+=	libnvmm
+.endif
+
 .if (${MKMDNS} != "no")
 SUBDIR+=	../external/apache2/mDNSResponder/lib
 .endif

Added files:

Index: src/lib/libnvmm/Makefile
diff -u /dev/null src/lib/libnvmm/Makefile:1.1
--- /dev/null	Sat Nov 10 09:28:56 2018
+++ src/lib/libnvmm/Makefile	Sat Nov 10 09:28:56 2018
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.1 2018/11/10 09:28:56 maxv Exp $
+
+USE_SHLIBDIR=   yes
+
+.include 
+
+LIB=		nvmm
+MAN=		libnvmm.3
+
+SRCS=		libnvmm.c libnvmm_x86.c
+
+INCS=		nvmm.h
+INCSDIR=	/usr/include
+
+WARNS=		5
+
+.include 
Index: src/lib/libnvmm/libnvmm.3
diff -u /dev/null src/lib/libnvmm/libnvmm.3:1.1
--- /dev/null	Sat Nov 10 09:28:56 2018
+++ src/lib/libnvmm/libnvmm.3	Sat Nov 10 09:28:56 2018
@@ -0,0 +1,484 @@
+.Dd September 12, 2018
+.Dt LIBNVMM 3
+.Os
+.Sh NAME
+.Nm libnvmm
+.Nd NetBSD Virtualization API
+.Sh LIBRARY
+.Lb libnvmm
+.Sh SYNOPSIS
+.In nvmm.h
+.Ft int
+.Fn nvmm_capability "struct nvmm_capability *cap"
+.Ft int
+.Fn nvmm_m