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

2017-11-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Nov 27 07:44:27 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: armv7_generic_space.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm32/armv7_generic_space.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/arm32/armv7_generic_space.c
diff -u src/sys/arch/arm/arm32/armv7_generic_space.c:1.3 src/sys/arch/arm/arm32/armv7_generic_space.c:1.4
--- src/sys/arch/arm/arm32/armv7_generic_space.c:1.3	Mon Aug  1 19:05:24 2016
+++ src/sys/arch/arm/arm32/armv7_generic_space.c	Mon Nov 27 07:44:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv7_generic_space.c,v 1.3 2016/08/01 19:05:24 jakllsch Exp $	*/
+/*	$NetBSD: armv7_generic_space.c,v 1.4 2017/11/27 07:44:27 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: armv7_generic_space.c,v 1.3 2016/08/01 19:05:24 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: armv7_generic_space.c,v 1.4 2017/11/27 07:44:27 skrll Exp $");
 
 #include 
 #include 
@@ -348,7 +348,7 @@ armv7_generic_bs_subregion(void *t, bus_
 {
 
 	*nbshp = bsh + offset;
-	return (0);
+	return 0;
 }
 
 int
@@ -357,7 +357,7 @@ armv7_generic_a4x_bs_subregion(void *t, 
 {
 
 	*nbshp = bsh + 4 * offset;
-	return (0);
+	return 0;
 }
 
 void
@@ -385,7 +385,7 @@ armv7_generic_bs_mmap(void *t, bus_addr_
 	if (flags & BUS_SPACE_MAP_PREFETCHABLE)
 		bus_flags |= ARM32_MMAP_WRITECOMBINE;
 
-	return (arm_btop(bpa + offset) | bus_flags);
+	return arm_btop(bpa + offset) | bus_flags;
 }
 
 paddr_t
@@ -396,7 +396,7 @@ armv7_generic_a4x_bs_mmap(void *t, bus_a
 	if (flags & BUS_SPACE_MAP_PREFETCHABLE)
 		bus_flags |= ARM32_MMAP_WRITECOMBINE;
 
-	return (arm_btop(bpa + 4 * offset) | bus_flags);
+	return arm_btop(bpa + 4 * offset) | bus_flags;
 }
 
 int



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

2017-11-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Nov 27 07:44:27 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: armv7_generic_space.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm32/armv7_generic_space.c

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



CVS commit: src/sys

2017-11-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Nov 27 05:05:51 UTC 2017

Modified Files:
src/sys/net: if_gif.c
src/sys/netinet: in_gif.c
src/sys/netinet6: in6_gif.c

Log Message:
IFF_RUNNING checking in Rx and Tx processing is unnecessary now.

Because the configs of gif (members of gif_var) are protected by psref(9).


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/net/if_gif.c
cvs rdiff -u -r1.90 -r1.91 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.88 -r1.89 src/sys/netinet6/in6_gif.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/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.133 src/sys/net/if_gif.c:1.134
--- src/sys/net/if_gif.c:1.133	Mon Nov 27 05:02:22 2017
+++ src/sys/net/if_gif.c	Mon Nov 27 05:05:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.133 2017/11/27 05:02:22 knakahara Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.134 2017/11/27 05:05:50 knakahara Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.133 2017/11/27 05:02:22 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.134 2017/11/27 05:05:50 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -378,8 +378,7 @@ gif_encapcheck(struct mbuf *m, int off, 
 	if (sc == NULL)
 		return 0;
 
-	if ((sc->gif_if.if_flags & (IFF_UP|IFF_RUNNING))
-	!= (IFF_UP|IFF_RUNNING))
+	if ((sc->gif_if.if_flags & IFF_UP) == 0)
 		return 0;
 
 	var = gif_getref_variant(sc, );
@@ -492,7 +491,7 @@ gif_output(struct ifnet *ifp, struct mbu
 		goto end;
 	}
 
-	if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
+	if ((ifp->if_flags & IFF_UP) == 0) {
 		m_freem(m);
 		error = ENETDOWN;
 		goto end;

Index: src/sys/netinet/in_gif.c
diff -u src/sys/netinet/in_gif.c:1.90 src/sys/netinet/in_gif.c:1.91
--- src/sys/netinet/in_gif.c:1.90	Mon Nov 27 05:02:22 2017
+++ src/sys/netinet/in_gif.c	Mon Nov 27 05:05:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_gif.c,v 1.90 2017/11/27 05:02:22 knakahara Exp $	*/
+/*	$NetBSD: in_gif.c,v 1.91 2017/11/27 05:05:51 knakahara Exp $	*/
 /*	$KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.90 2017/11/27 05:02:22 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.91 2017/11/27 05:05:51 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -216,7 +216,7 @@ in_gif_input(struct mbuf *m, int off, in
 	ip = mtod(m, const struct ip *);
 
 	gifp = >gif_if;
-	if ((gifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
+	if ((gifp->if_flags & IFF_UP) == 0) {
 		m_freem(m);
 		ip_statinc(IP_STAT_NOGIF);
 		return;

Index: src/sys/netinet6/in6_gif.c
diff -u src/sys/netinet6/in6_gif.c:1.88 src/sys/netinet6/in6_gif.c:1.89
--- src/sys/netinet6/in6_gif.c:1.88	Mon Nov 27 05:02:22 2017
+++ src/sys/netinet6/in6_gif.c	Mon Nov 27 05:05:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_gif.c,v 1.88 2017/11/27 05:02:22 knakahara Exp $	*/
+/*	$NetBSD: in6_gif.c,v 1.89 2017/11/27 05:05:51 knakahara Exp $	*/
 /*	$KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.88 2017/11/27 05:02:22 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.89 2017/11/27 05:05:51 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -233,7 +233,7 @@ in6_gif_input(struct mbuf **mp, int *off
 	ip6 = mtod(m, struct ip6_hdr *);
 
 	gifp = >gif_if;
-	if ((gifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
+	if ((gifp->if_flags & IFF_UP) == 0) {
 		m_freem(m);
 		IP6_STATINC(IP6_STAT_NOGIF);
 		return IPPROTO_DONE;



CVS commit: src/sys

2017-11-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Nov 27 05:05:51 UTC 2017

Modified Files:
src/sys/net: if_gif.c
src/sys/netinet: in_gif.c
src/sys/netinet6: in6_gif.c

Log Message:
IFF_RUNNING checking in Rx and Tx processing is unnecessary now.

Because the configs of gif (members of gif_var) are protected by psref(9).


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/net/if_gif.c
cvs rdiff -u -r1.90 -r1.91 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.88 -r1.89 src/sys/netinet6/in6_gif.c

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



CVS commit: src/sys/net

2017-11-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Nov 27 05:03:11 UTC 2017

Modified Files:
src/sys/net: if_gif.h

Log Message:
update gif(4) locking notes.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/net/if_gif.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/net/if_gif.h
diff -u src/sys/net/if_gif.h:1.28 src/sys/net/if_gif.h:1.29
--- src/sys/net/if_gif.h:1.28	Mon Nov 27 05:02:22 2017
+++ src/sys/net/if_gif.h	Mon Nov 27 05:03:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.h,v 1.28 2017/11/27 05:02:22 knakahara Exp $	*/
+/*	$NetBSD: if_gif.h,v 1.29 2017/11/27 05:03:11 knakahara Exp $	*/
 /*	$KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $	*/
 
 /*
@@ -140,14 +140,15 @@ int	gif_encapcheck(struct mbuf *, int, i
  * + gif_softc_list is protected by gif_softcs.lock (an adaptive mutex)
  *   gif_softc_list is list of all gif_softcs. It is used by ioctl
  *   context only.
- * + Members of struct gif_softc except for gif_ro_percpu are protected by
- *   - encap_lock for writer
- *   - stopping processing when writer begin to run
- * for reader(Tx and Rx processing)
+ * + gif_softc->gif_var is protected by
+ *   - gif_softc->gif_lock (an adaptive mutex) for writer
+ *   - gif_var->gv_psref for reader
+ *   gif_softc->gif_var is used for variant values while the gif tunnel
+ *   exists.
  * + Each CPU's gif_ro.gr_ro of gif_ro_percpu are protected by
  *   percpu'ed gif_ro.gr_lock.
  *
  * Locking order:
- * - encap_lock => gif_softcs.lock
+ * - encap_lock => gif_softc->gif_lock => gif_softcs.lock
  */
 #endif /* !_NET_IF_GIF_H_ */



CVS commit: src/sys/net

2017-11-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Nov 27 05:03:11 UTC 2017

Modified Files:
src/sys/net: if_gif.h

Log Message:
update gif(4) locking notes.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/net/if_gif.h

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



CVS commit: src/sys

2017-11-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Nov 27 05:02:22 UTC 2017

Modified Files:
src/sys/net: if_gif.c if_gif.h
src/sys/netinet: in_gif.c in_gif.h
src/sys/netinet6: in6_gif.c in6_gif.h

Log Message:
preserve gif(4) configs by psref(9) like vlan(4) and l2tp(4).

After Tx side does not use softint, gif(4) can use psref(9) for config
preservation like vlan(4) and l2tp(4).

update locking notes later.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/net/if_gif.c
cvs rdiff -u -r1.27 -r1.28 src/sys/net/if_gif.h
cvs rdiff -u -r1.89 -r1.90 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/in_gif.h
cvs rdiff -u -r1.87 -r1.88 src/sys/netinet6/in6_gif.c
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet6/in6_gif.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/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.132 src/sys/net/if_gif.c:1.133
--- src/sys/net/if_gif.c:1.132	Thu Nov 16 03:07:18 2017
+++ src/sys/net/if_gif.c	Mon Nov 27 05:02:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.132 2017/11/16 03:07:18 ozaki-r Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.133 2017/11/27 05:02:22 knakahara Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.132 2017/11/16 03:07:18 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.133 2017/11/27 05:02:22 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -57,6 +57,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -102,6 +105,9 @@ static struct {
 	kmutex_t lock;
 } gif_softcs __cacheline_aligned;
 
+pserialize_t gif_psz __read_mostly;
+struct psref_class *gv_psref_class __read_mostly;
+
 static void	gif_ro_init_pc(void *, void *, struct cpu_info *);
 static void	gif_ro_fini_pc(void *, void *, struct cpu_info *);
 
@@ -110,6 +116,7 @@ static int	gif_output(struct ifnet *, st
 			   const struct sockaddr *, const struct rtentry *);
 static void	gif_start(struct ifnet *);
 static int	gif_transmit(struct ifnet *, struct mbuf *);
+static int	gif_transmit_direct(struct gif_variant *, struct mbuf *);
 static int	gif_ioctl(struct ifnet *, u_long, void *);
 static int	gif_set_tunnel(struct ifnet *, struct sockaddr *,
 			   struct sockaddr *);
@@ -119,9 +126,10 @@ static int	gif_clone_create(struct if_cl
 static int	gif_clone_destroy(struct ifnet *);
 static int	gif_check_nesting(struct ifnet *, struct mbuf *);
 
-static int	gif_encap_attach(struct gif_softc *);
-static int	gif_encap_detach(struct gif_softc *);
-static void	gif_encap_pause(struct gif_softc *);
+static int	gif_encap_attach(struct gif_variant *);
+static int	gif_encap_detach(struct gif_variant *);
+
+static void	gif_update_variant(struct gif_softc *, struct gif_variant *);
 
 static struct if_clone gif_cloner =
 IF_CLONE_INITIALIZER("gif", gif_clone_create, gif_clone_destroy);
@@ -216,6 +224,9 @@ gifinit(void)
 	LIST_INIT(_softcs.list);
 	if_clone_attach(_cloner);
 
+	gif_psz = pserialize_create();
+	gv_psref_class = psref_class_create("gifvar", IPL_SOFTNET);
+
 	gif_sysctl_setup();
 }
 
@@ -231,6 +242,9 @@ gifdetach(void)
 	}
 
 	if (error == 0) {
+		psref_class_destroy(gv_psref_class);
+		pserialize_destroy(gif_psz);
+
 		if_clone_detach(_cloner);
 		sysctl_teardown(_sysctl);
 	}
@@ -242,6 +256,7 @@ static int
 gif_clone_create(struct if_clone *ifc, int unit)
 {
 	struct gif_softc *sc;
+	struct gif_variant *var;
 	int rv;
 
 	sc = kmem_zalloc(sizeof(struct gif_softc), KM_SLEEP);
@@ -254,6 +269,12 @@ gif_clone_create(struct if_clone *ifc, i
 		return rv;
 	}
 
+	var = kmem_zalloc(sizeof(*var), KM_SLEEP);
+	var->gv_softc = sc;
+	psref_target_init(>gv_psref, gv_psref_class);
+
+	sc->gif_var = var;
+	mutex_init(>gif_lock, MUTEX_DEFAULT, IPL_NONE);
 	sc->gif_ro_percpu = percpu_alloc(sizeof(struct gif_ro));
 	percpu_foreach(sc->gif_ro_percpu, gif_ro_init_pc, NULL);
 
@@ -268,8 +289,6 @@ gifattach0(struct gif_softc *sc)
 {
 	int rv;
 
-	sc->encap_cookie4 = sc->encap_cookie6 = NULL;
-
 	sc->gif_if.if_addrlen = 0;
 	sc->gif_if.if_mtu= GIF_MTU;
 	sc->gif_if.if_flags  = IFF_POINTOPOINT | IFF_MULTICAST;
@@ -325,6 +344,7 @@ static int
 gif_clone_destroy(struct ifnet *ifp)
 {
 	struct gif_softc *sc = (void *) ifp;
+	struct gif_variant *var;
 
 	LIST_REMOVE(sc, gif_list);
 
@@ -335,6 +355,10 @@ gif_clone_destroy(struct ifnet *ifp)
 	percpu_foreach(sc->gif_ro_percpu, gif_ro_fini_pc, NULL);
 	percpu_free(sc->gif_ro_percpu, sizeof(struct gif_ro));
 
+	mutex_destroy(>gif_lock);
+
+	var = sc->gif_var;
+	kmem_free(var, sizeof(*var));
 	kmem_free(sc, sizeof(struct gif_softc));
 
 	return 0;
@@ -346,6 +370,9 @@ gif_encapcheck(struct mbuf *m, int off, 
 {
 	struct ip ip;
 	struct gif_softc *sc;
+	struct gif_variant *var;
+	struct psref psref;
+	int ret = 0;
 

CVS commit: src/sys

2017-11-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Nov 27 05:02:22 UTC 2017

Modified Files:
src/sys/net: if_gif.c if_gif.h
src/sys/netinet: in_gif.c in_gif.h
src/sys/netinet6: in6_gif.c in6_gif.h

Log Message:
preserve gif(4) configs by psref(9) like vlan(4) and l2tp(4).

After Tx side does not use softint, gif(4) can use psref(9) for config
preservation like vlan(4) and l2tp(4).

update locking notes later.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/net/if_gif.c
cvs rdiff -u -r1.27 -r1.28 src/sys/net/if_gif.h
cvs rdiff -u -r1.89 -r1.90 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/in_gif.h
cvs rdiff -u -r1.87 -r1.88 src/sys/netinet6/in6_gif.c
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet6/in6_gif.h

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



CVS commit: src/sys/net

2017-11-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov 27 01:34:06 UTC 2017

Modified Files:
src/sys/net: if_vlan.c

Log Message:
kern/52765: npf cannot do port forwarding on vlan interfaces

Add pfil hooks support to vlan(4), from christos@


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/net/if_vlan.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/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.112 src/sys/net/if_vlan.c:1.113
--- src/sys/net/if_vlan.c:1.112	Wed Nov 22 05:17:32 2017
+++ src/sys/net/if_vlan.c	Mon Nov 27 01:34:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.112 2017/11/22 05:17:32 msaitoh Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.113 2017/11/27 01:34:06 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.112 2017/11/22 05:17:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.113 2017/11/27 01:34:06 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1384,6 +1384,14 @@ vlan_transmit(struct ifnet *ifp, struct 
 	ec = (void *)mib->ifvm_p;
 
 	bpf_mtap(ifp, m);
+
+	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT) != 0) {
+		if (m != NULL)
+			m_freem(m);
+		error = 0;
+		goto out;
+	}
+
 	/*
 	 * If the parent can insert the tag itself, just mark
 	 * the tag in the mbuf header.
@@ -1568,6 +1576,12 @@ vlan_input(struct ifnet *ifp, struct mbu
 	m_set_rcvif(m, >ifv_if);
 	ifv->ifv_if.if_ipackets++;
 
+	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0) {
+		if (m != NULL)
+			m_freem(m);
+		goto out;
+	}
+
 	m->m_flags &= ~M_PROMISC;
 	if_input(>ifv_if, m);
 out:



CVS commit: src/sys/net

2017-11-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov 27 01:34:06 UTC 2017

Modified Files:
src/sys/net: if_vlan.c

Log Message:
kern/52765: npf cannot do port forwarding on vlan interfaces

Add pfil hooks support to vlan(4), from christos@


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/net/if_vlan.c

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



CVS commit: src/usr.bin/config

2017-11-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 27 00:25:46 UTC 2017

Modified Files:
src/usr.bin/config: defs.h main.c sem.c

Log Message:
use a reference count to avoid deleting psrefs still in use.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/config/defs.h
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/config/main.c
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/config/sem.c

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



CVS commit: src/usr.bin/config

2017-11-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 27 00:25:46 UTC 2017

Modified Files:
src/usr.bin/config: defs.h main.c sem.c

Log Message:
use a reference count to avoid deleting psrefs still in use.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/config/defs.h
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/config/main.c
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/config/sem.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/config/defs.h
diff -u src/usr.bin/config/defs.h:1.101 src/usr.bin/config/defs.h:1.102
--- src/usr.bin/config/defs.h:1.101	Sat Nov 18 13:44:20 2017
+++ src/usr.bin/config/defs.h	Sun Nov 26 19:25:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.101 2017/11/18 18:44:20 christos Exp $	*/
+/*	$NetBSD: defs.h,v 1.102 2017/11/27 00:25:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -234,9 +234,9 @@ struct pspec {
 	struct	devbase *p_atdev;	/* optional parent device base */
 	int	p_atunit;		/* optional parent device unit */
 	struct	nvlist *p_devs;		/* children using it */
-	struct	deva *p_deva;		/* attribute */
 	int	p_inst;			/* parent spec instance */
 	int	p_active;		/* parent spec is actively used */
+	int	p_ref;			/* refcount */
 };
 
 /*

Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.95 src/usr.bin/config/main.c:1.96
--- src/usr.bin/config/main.c:1.95	Fri Nov 24 18:42:36 2017
+++ src/usr.bin/config/main.c	Sun Nov 26 19:25:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.95 2017/11/24 23:42:36 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.96 2017/11/27 00:25:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: main.c,v 1.95 2017/11/24 23:42:36 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.96 2017/11/27 00:25:46 christos Exp $");
 
 #ifndef MAKE_BOOTSTRAP
 #include 
@@ -1959,8 +1959,11 @@ do_kill_orphans(struct devbase *d, struc
 		continue;
 	}
 	j->i_active = active = state;
-	if (p != NULL)
-		p->p_active = state;
+	if (p != NULL) {
+		if (state == DEVI_ACTIVE ||
+		--p->p_ref == 0)
+			p->p_active = state;
+	}
 	if (state == DEVI_IGNORED) {
 		CFGDBG(5,
 		"`%s' at '%s' ignored",

Index: src/usr.bin/config/sem.c
diff -u src/usr.bin/config/sem.c:1.81 src/usr.bin/config/sem.c:1.82
--- src/usr.bin/config/sem.c:1.81	Fri Nov 24 13:45:59 2017
+++ src/usr.bin/config/sem.c	Sun Nov 26 19:25:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sem.c,v 1.81 2017/11/24 18:45:59 christos Exp $	*/
+/*	$NetBSD: sem.c,v 1.82 2017/11/27 00:25:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: sem.c,v 1.81 2017/11/24 18:45:59 christos Exp $");
+__RCSID("$NetBSD: sem.c,v 1.82 2017/11/27 00:25:46 christos Exp $");
 
 #include 
 #include 
@@ -79,8 +79,7 @@ static int has_errobj(struct attrlist *,
 static struct nvlist *addtoattr(struct nvlist *, struct devbase *);
 static int resolve(struct nvlist **, const char *, const char *,
 		   struct nvlist *, int);
-static struct pspec *getpspec(struct attr *, struct devbase *, int,
-struct deva *);
+static struct pspec *getpspec(struct attr *, struct devbase *, int, int);
 static struct devi *newdevi(const char *, int, struct devbase *d);
 static struct devi *getdevi(const char *);
 static void remove_devi(struct devi *);
@@ -1296,7 +1295,7 @@ adddev(const char *name, const char *at,
 			 * XXX: This creates multiple pspecs that look the
 			 * same in the config file and could be merged.
 			 */
-			p = getpspec(attr, ab, atunit, iba);
+			p = getpspec(attr, ab, atunit, first);
 			p->p_devs = newnv(NULL, NULL, i, 0, p->p_devs);
 		} else
 			p = NULL;
@@ -1907,17 +1906,23 @@ fixdevis(void)
  * Look up a parent spec, creating a new one if it does not exist.
  */
 static struct pspec *
-getpspec(struct attr *attr, struct devbase *ab, int atunit, struct deva *da)
+getpspec(struct attr *attr, struct devbase *ab, int atunit, int first)
 {
 	struct pspec *p;
 	int inst = npspecs;
+	int ref = 1;
 
 	TAILQ_FOREACH(p, , p_list) {
 		if (p->p_iattr == attr && p->p_atdev == ab &&
 		p->p_atunit == atunit) {
-			if (p->p_deva == da)
-return (p);
-		   	inst = p->p_inst; 
+			p->p_ref++;
+			if (first)
+return p;
+			else {
+inst = p->p_inst;
+ref = p->p_ref;
+			}
+
 		}
 	}
 
@@ -1929,8 +1934,8 @@ getpspec(struct attr *attr, struct devba
 	p->p_inst = inst;
 	if (inst == npspecs)
 		npspecs++;
-	p->p_deva = da;
 	p->p_active = 0;
+	p->p_ref = ref;
 
 	TAILQ_INSERT_TAIL(, p, p_list);
 



CVS commit: src/share/man/man4

2017-11-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Nov 26 21:02:37 UTC 2017

Added Files:
src/share/man/man4: qemufwcfg.4

Log Message:
Add basic qemufwcfg man page. Not hooked into the build before review.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man4/qemufwcfg.4

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

Added files:

Index: src/share/man/man4/qemufwcfg.4
diff -u /dev/null src/share/man/man4/qemufwcfg.4:1.1
--- /dev/null	Sun Nov 26 21:02:37 2017
+++ src/share/man/man4/qemufwcfg.4	Sun Nov 26 21:02:37 2017
@@ -0,0 +1,50 @@
+.\"	$NetBSD: qemufwcfg.4,v 1.1 2017/11/26 21:02:37 wiz Exp $
+.\"
+.\" Copyright (c) 2017 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" 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 26, 2017
+.Dt QEMUFWCFG 4
+.Os
+.Sh NAME
+.Nm qemufwcfg
+.Nd QEMU Firmware Configuration device driver
+.Sh SYNOPSIS
+.\" TODO: is the next line correct?
+.Cd "qemufwcfg* at acpi"
+.Sh DESCRIPTION
+The
+.Nm
+interface allows QEMU guests to query and modify various data items on
+the host, usually related to firmware configuration.
+.Sh SEE ALSO
+.Rs
+.%T QEMU Firmware Configuration (fw_cfg) Device
+.%U https://raw.githubusercontent.com/qemu/qemu/master/docs/specs/fw_cfg.txt
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 9.0 .



CVS commit: src/share/man/man4

2017-11-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Nov 26 21:02:37 UTC 2017

Added Files:
src/share/man/man4: qemufwcfg.4

Log Message:
Add basic qemufwcfg man page. Not hooked into the build before review.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man4/qemufwcfg.4

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



CVS commit: src/sys/arch/mips/cavium/dev

2017-11-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 26 18:41:14 UTC 2017

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Set ETHERCAP_VLAN_MTU capability flag.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/if_cnmac.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/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.6 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.7
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.6	Tue Aug 22 07:09:00 2017
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Sun Nov 26 18:41:14 2017
@@ -1,8 +1,8 @@
-/*	$NetBSD: if_cnmac.c,v 1.6 2017/08/22 07:09:00 maya Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $	*/
 
 #include 
 #if 0
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.6 2017/08/22 07:09:00 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $");
 #endif
 
 #include "opt_octeon.h"
@@ -366,6 +366,9 @@ octeon_eth_attach(device_t parent, devic
 		IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx |
 		IFCAP_CSUM_TCPv6_Rx | IFCAP_CSUM_UDPv6_Rx;
 
+	/* 802.1Q VLAN-sized frames are supported */
+	sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
 	octeon_gmx_set_mac_addr(sc->sc_gmx_port, enaddr);
 	octeon_gmx_set_filter(sc->sc_gmx_port);
 



CVS commit: src/sys/arch/mips/cavium/dev

2017-11-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 26 18:41:14 UTC 2017

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Set ETHERCAP_VLAN_MTU capability flag.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/if_cnmac.c

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



CVS commit: src/sys/compat/netbsd32

2017-11-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 26 17:46:13 UTC 2017

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Add support for SIOCGIFGENERIC and SIOCSIFGENERIC ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.56 -r1.57 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.89 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.90
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.89	Sat Jan 14 16:34:44 2017
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Sun Nov 26 17:46:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.90 2017/11/26 17:46:13 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.90 2017/11/26 17:46:13 jmcneill Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -116,8 +116,14 @@ netbsd32_to_ifreq(struct netbsd32_ifreq 
 	 * union member needs to be converted to 64 bits... this
 	 * is very driver specific and so we ignore it for now..
 	 */
-	if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA)
+	switch (cmd) {
+	case SIOCGIFDATA:
+	case SIOCZIFDATA:
+	case SIOCGIFGENERIC:
+	case SIOCSIFGENERIC:
 		p->ifr_data = (void *)NETBSD32PTR64(s32p->ifr_data);
+		break;
+	}
 }
 
 static inline void
@@ -534,8 +540,14 @@ netbsd32_from_ifreq(struct ifreq *p, str
 	 * is very driver specific and so we ignore it for now..
 	 */
 	memcpy(s32p, p, sizeof *s32p);
-	if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA)
+	switch (cmd) {
+	case SIOCGIFDATA:
+	case SIOCZIFDATA:
+	case SIOCGIFGENERIC:
+	case SIOCSIFGENERIC:
 		NETBSD32PTR32(s32p->ifr_data, p->ifr_data);
+		break;
+	}
 }
 
 static inline void
@@ -1233,6 +1245,11 @@ netbsd32_ioctl(struct lwp *l, const stru
 	case SIOCGIFMEDIA32:
 		IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq);
 
+	case SIOCGIFGENERIC32:
+		IOCTL_STRUCT_CONV_TO(SIOCGIFGENERIC, ifreq);
+	case SIOCSIFGENERIC32:
+		IOCTL_STRUCT_CONV_TO(SIOCSIFGENERIC, ifreq);
+
 	case PPPOESETPARMS32:
 		IOCTL_STRUCT_CONV_TO(PPPOESETPARMS, pppoediscparms);
 	case PPPOEGETPARMS32:

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.56 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.57
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.56	Mon Dec 26 23:05:06 2016
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Sun Nov 26 17:46:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.56 2016/12/26 23:05:06 christos Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.57 2017/11/26 17:46:13 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -374,6 +374,9 @@ struct netbsd32_if_clonereq {
 #define	SIOCSIFMEDIA32	_IOWR('i', 53, struct netbsd32_ifreq)	/* set net media */
 #define	OSIOCSIFMEDIA32	_IOWR('i', 53, struct netbsd32_oifreq)	/* set net media */
 
+#define	SIOCSIFGENERIC32 _IOW('i', 57, struct netbsd32_ifreq)	/* generic IF set op */
+#define	SIOCGIFGENERIC32 _IOWR('i', 58, struct netbsd32_ifreq)	/* generic IF get op */
+
 #define	SIOCIFGCLONERS32 _IOWR('i', 120, struct netbsd32_if_clonereq) /* get cloners */
 
 #define	SIOCSIFMTU32	 _IOW('i', 127, struct netbsd32_ifreq)	/* set ifnet mtu */



CVS commit: src/sys/compat/netbsd32

2017-11-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 26 17:46:13 UTC 2017

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Add support for SIOCGIFGENERIC and SIOCSIFGENERIC ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.56 -r1.57 src/sys/compat/netbsd32/netbsd32_ioctl.h

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



CVS commit: src/share/dict

2017-11-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Nov 26 16:32:10 UTC 2017

Modified Files:
src/share/dict: web2

Log Message:
Add missing words beginning with 'g' from FreeBSD's copy of src/share/dict/web2.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/share/dict/web2

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

Modified files:

Index: src/share/dict/web2
diff -u src/share/dict/web2:1.44 src/share/dict/web2:1.45
--- src/share/dict/web2:1.44	Sat Nov 25 17:05:52 2017
+++ src/share/dict/web2	Sun Nov 26 16:32:10 2017
@@ -74843,6 +74843,7 @@ Galbulinae
 galbulus
 Galcha
 Galchic
+Gale
 gale
 galea
 galeage
@@ -75550,6 +75551,7 @@ garum
 garvanzo
 garvey
 garvock
+Gary
 gas
 Gasan
 gasbag
@@ -76576,6 +76578,7 @@ geodynamic
 geodynamical
 geodynamics
 geoethnic
+Geoff
 Geoffrey
 geoffroyin
 geoffroyine
@@ -77232,6 +77235,7 @@ giggling
 gigglingly
 gigglish
 giggly
+Gigi
 giglet
 gigliato
 giglot
@@ -77275,12 +77279,14 @@ Gilia
 gilia
 Giliak
 gilim
+Gill
 gill
 gillaroo
 gillbird
 gilled
 Gillenia
 giller
+Gilles
 gillflirt
 gillhooter
 Gillian
@@ -77385,6 +77391,7 @@ ginnery
 ginney
 ginning
 ginnle
+Ginny
 ginny
 ginseng
 ginward
@@ -77754,8 +77761,10 @@ gleewoman
 gleg
 glegly
 glegness
+Glen
 glen
 Glengarry
+Glenn
 glenohumeral
 glenoid
 glenoidal
@@ -78270,6 +78279,7 @@ glycyl
 glycyphyllin
 Glycyrrhiza
 glycyrrhizin
+Glynn
 glyoxal
 glyoxalase
 glyoxalic
@@ -78976,6 +78986,7 @@ Gordiidae
 Gordioidea
 Gordius
 gordolobo
+Gordon
 Gordonia
 gordunite
 Gordyaean
@@ -79214,6 +79225,7 @@ grabbots
 graben
 grabhook
 grabouche
+Grace
 grace
 graceful
 gracefully
@@ -79287,6 +79299,7 @@ graduator
 gradus
 Graeae
 Graeculus
+Graeme
 graff
 graffage
 graffer
@@ -79301,6 +79314,7 @@ grafter
 grafting
 graftonite
 graftproof
+Graham
 graham
 grahamite
 Graian
@@ -79499,6 +79513,7 @@ granophyre
 granophyric
 granose
 granospherite
+Grant
 grant
 grantable
 grantedly
@@ -79538,6 +79553,7 @@ granulometric
 granulosa
 granulose
 granulous
+Granville
 granza
 granzita
 grape
@@ -79933,6 +79949,7 @@ greetingless
 greetingly
 greffier
 greffotome
+Greg
 gregal
 gregale
 gregaloid
@@ -79954,8 +79971,11 @@ gregariously
 gregariousness
 gregaritic
 grege
+Gregg
+Gregge
 greggle
 grego
+Gregor
 Gregorian
 Gregorianist
 Gregorianize
@@ -80020,6 +80040,7 @@ grievingly
 grievous
 grievously
 grievousness
+Griff
 griff
 griffade
 griffado
@@ -80747,6 +80768,7 @@ guidership
 guideship
 guideway
 guidman
+Guido
 guidon
 Guidonian
 guidwilly
@@ -80772,6 +80794,7 @@ guilelessness
 guilery
 guillemet
 guillemot
+Guillermo
 guillevat
 guilloche
 guillochee
@@ -80934,6 +80957,7 @@ gunmaking
 gunman
 gunmanship
 gunnage
+Gunnar
 gunne
 gunnel
 gunner
@@ -80971,6 +80995,7 @@ gunstock
 gunstocker
 gunstocking
 gunstone
+Gunter
 gunter
 Gunther
 gunwale



CVS commit: src/share/dict

2017-11-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Nov 26 16:32:10 UTC 2017

Modified Files:
src/share/dict: web2

Log Message:
Add missing words beginning with 'g' from FreeBSD's copy of src/share/dict/web2.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/share/dict/web2

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



CVS commit: src/sbin/mount_qemufwcfg

2017-11-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 26 15:03:15 UTC 2017

Modified Files:
src/sbin/mount_qemufwcfg: fwcfg.c

Log Message:
don't error on unknown options.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/mount_qemufwcfg/fwcfg.c

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

Modified files:

Index: src/sbin/mount_qemufwcfg/fwcfg.c
diff -u src/sbin/mount_qemufwcfg/fwcfg.c:1.2 src/sbin/mount_qemufwcfg/fwcfg.c:1.3
--- src/sbin/mount_qemufwcfg/fwcfg.c:1.2	Sat Nov 25 22:06:24 2017
+++ src/sbin/mount_qemufwcfg/fwcfg.c	Sun Nov 26 10:03:15 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fwcfg.c,v 1.2 2017/11/26 03:06:24 christos Exp $ */
+/* $NetBSD: fwcfg.c,v 1.3 2017/11/26 15:03:15 christos Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fwcfg.c,v 1.2 2017/11/26 03:06:24 christos Exp $");
+__RCSID("$NetBSD: fwcfg.c,v 1.3 2017/11/26 15:03:15 christos Exp $");
 
 #include 
 
@@ -252,8 +252,10 @@ main(int argc, char *argv[])
 		case 'u':
 			fwcfg_uid = (uid_t)atoi(optarg);
 			break;
+#ifdef notyet
 		default:
 			usage();
+#endif
 		}
 	}
 



CVS commit: src/sbin/mount_qemufwcfg

2017-11-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 26 15:03:15 UTC 2017

Modified Files:
src/sbin/mount_qemufwcfg: fwcfg.c

Log Message:
don't error on unknown options.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/mount_qemufwcfg/fwcfg.c

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



CVS commit: src/sys/arch/amd64/amd64

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 15:00:16 UTC 2017

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

Log Message:
Update a comment, and use testw instead.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/amd64/amd64/locore.S

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



CVS commit: src/sys/arch/amd64/amd64

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 15:00:16 UTC 2017

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

Log Message:
Update a comment, and use testw instead.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/amd64/amd64/locore.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.142 src/sys/arch/amd64/amd64/locore.S:1.143
--- src/sys/arch/amd64/amd64/locore.S:1.142	Sun Nov 26 14:54:43 2017
+++ src/sys/arch/amd64/amd64/locore.S	Sun Nov 26 15:00:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.142 2017/11/26 14:54:43 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.143 2017/11/26 15:00:16 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1197,7 +1197,7 @@ ENTRY(cpu_switchto)
 	movq	PCB_GS(%r14),%rax
 	movq	%rax,(GUGS_SEL*8)(%rcx)
 
-	/* Set default 32bit values in %ds, %es and %fs. %gs is special. */
+	/* Set default 32bit values in %ds, %es, %fs and %gs. */
 	movq	L_MD_REGS(%r12),%rbx
 	movq	$GSEL(GUDATA32_SEL, SEL_UPL),%rax
 	movw	%ax,%ds
@@ -1474,7 +1474,7 @@ END(pagezero)
 
 ENTRY(intrfastexit)
 	INTR_RESTORE_GPRS
-	testq	$SEL_UPL,TF_CS(%rsp)	/* interrupted %cs */
+	testw	$SEL_UPL,TF_CS(%rsp)	/* interrupted %cs */
 	jz	.Lkexit
 	cmpw	$LSEL(LUCODE_SEL, SEL_UPL),TF_CS(%rsp)
 	je	.Luexit64



CVS commit: src/sys/arch/amd64/amd64

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 14:54:43 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S locore.S mptramp.S

Log Message:
Hide a bunch of raw symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amd64/amd64/mptramp.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.12 src/sys/arch/amd64/amd64/amd64_trap.S:1.13
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.12	Tue Oct 17 07:33:44 2017
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Sun Nov 26 14:54:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.12 2017/10/17 07:33:44 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.13 2017/11/26 14:54:43 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.12 2017/10/17 07:33:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.13 2017/11/26 14:54:43 maxv Exp $");
 #endif
 
 /*
@@ -132,21 +132,21 @@ IDTVEC(trap02)
 	movl	$MSR_GSBASE,%ecx
 	rdmsr
 	cmpl	$VM_MIN_KERNEL_ADDRESS_HIGH32,%edx
-	jae	noswapgs
+	jae	.Lnoswapgs
 
 	swapgs
 	movq	%rsp,%rdi
 	incq	CPUVAR(NTRAP)
 	call	_C_LABEL(nmitrap)
 	swapgs
-	jmp	nmileave
+	jmp	.Lnmileave
 
-noswapgs:
+.Lnoswapgs:
 	movq	%rsp,%rdi
 	incq	CPUVAR(NTRAP)
 	call	_C_LABEL(trap)
 
-nmileave:
+.Lnmileave:
 	movw	TF_ES(%rsp),%es
 	movw	TF_DS(%rsp),%ds
 	INTR_RESTORE_GPRS

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.141 src/sys/arch/amd64/amd64/locore.S:1.142
--- src/sys/arch/amd64/amd64/locore.S:1.141	Tue Nov 21 09:58:09 2017
+++ src/sys/arch/amd64/amd64/locore.S	Sun Nov 26 14:54:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.141 2017/11/21 09:58:09 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.142 2017/11/26 14:54:43 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -450,7 +450,7 @@ ENTRY(start)
 	/* Load 'bootinfo' */
 	movl	12(%esp),%eax
 	testl	%eax,%eax		/* bootinfo = NULL? */
-	jz	bootinfo_finished
+	jz	.Lbootinfo_finished
 
 	movl	(%eax),%ebx		/* bootinfo::bi_nentries */
 	movl	$RELOC(bootinfo),%ebp
@@ -459,9 +459,9 @@ ENTRY(start)
 	movl	%ebx,(%edx)
 	addl	$4,%edx
 
-bootinfo_entryloop:
+.Lbootinfo_entryloop:
 	testl	%ebx,%ebx		/* no remaining entries? */
-	jz	bootinfo_finished
+	jz	.Lbootinfo_finished
 
 	addl	$4,%eax
 	movl	(%eax),%ecx		/* address of entry */
@@ -473,7 +473,7 @@ bootinfo_entryloop:
 	movl	%edx,%edi
 	addl	%eax,%edx		/* update dest pointer */
 	cmpl	%ebp,%edx		/* beyond bootinfo+BOOTINFO_MAXSIZE? */
-	jg	bootinfo_overflow
+	jg	.Lbootinfo_overflow
 
 	movl	%ecx,%esi
 	movl	%eax,%ecx
@@ -483,34 +483,34 @@ bootinfo_entryloop:
 	 * later to compute the initial bootstrap tables.
 	 */
 	cmpl	$BTINFO_MODULELIST,4(%esi) /* btinfo_common::type */
-	jne	bootinfo_copy
+	jne	.Lbootinfo_copy
 
 	/* Skip the modules if we won't have enough VA to map them */
 	movl	12(%esi),%eax		/* btinfo_modulelist::endpa */
 	addl	$PGOFSET,%eax		/* roundup to a page */
 	andl	$~PGOFSET,%eax
 	cmpl	$BOOTMAP_VA_SIZE,%eax
-	jg	bootinfo_skip
+	jg	.Lbootinfo_skip
 	movl	%eax,RELOC(eblob)
 	addl	$KERNBASE_LO,RELOC(eblob)
 	adcl	$KERNBASE_HI,RELOC(eblob)+4
 
-bootinfo_copy:
+.Lbootinfo_copy:
 	rep
 	movsb/* copy esi -> edi */
-	jmp	bootinfo_next
+	jmp	.Lbootinfo_next
 
-bootinfo_skip:
+.Lbootinfo_skip:
 	subl	%ecx,%edx		/* revert dest pointer */
 
-bootinfo_next:
+.Lbootinfo_next:
 	popl	%eax
 	popl	%esi
 	popl	%edi
 	subl	$1,%ebx			/* decrement the # of entries */
-	jmp	bootinfo_entryloop
+	jmp	.Lbootinfo_entryloop
 
-bootinfo_overflow:
+.Lbootinfo_overflow:
 	/*
 	 * Cleanup for overflow case. Pop the registers, and correct the number
 	 * of entries.
@@ -521,7 +521,7 @@ bootinfo_overflow:
 	movl	$RELOC(bootinfo),%ebp
 	movl	%ebp,%edx
 	subl	%ebx,(%edx)		/* correct the number of entries */
-bootinfo_finished:
+.Lbootinfo_finished:
 
 	/* Load 'esym' */
 	movl	16(%esp),%eax
@@ -539,22 +539,22 @@ bootinfo_finished:
 	movl	$RELOC(biosextmem),%ebp
 	movl	(%ebp),%eax
 	testl	%eax,%eax		/* already set? */
-	jnz	biosextmem_finished
+	jnz	.Lbiosextmem_finished
 
 	movl	20(%esp),%eax
 	movl	%eax,(%ebp)
 
-biosextmem_finished:
+.Lbiosextmem_finished:
 	/* Load 'biosbasemem' */
 	movl	$RELOC(biosbasemem),%ebp
 	movl	(%ebp),%eax
 	testl	%eax,%eax		/* already set? */
-	jnz	biosbasemem_finished
+	jnz	.Lbiosbasemem_finished
 
 	movl	24(%esp),%eax
 	movl	%eax,(%ebp)
 
-biosbasemem_finished:
+.Lbiosbasemem_finished:
 	/*
 	 * Done with the parameters!
 	 */
@@ -588,9 +588,9 @@ biosbasemem_finished:
 	movl	$0x8001,%eax
 	cpuid
 	andl	$CPUID_NOX,%edx
-	jz	no_NOX
+	jz	.Lno_NOX
 	movl	$PG_NX32,RELOC(nox_flag)
-no_NOX:
+.Lno_NOX:
 
 /*
  * There are four levels of 

CVS commit: src/sys/arch/amd64/amd64

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 14:54:43 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S locore.S mptramp.S

Log Message:
Hide a bunch of raw symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amd64/amd64/mptramp.S

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



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 14:29:48 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: mm.c

Log Message:
Oh, damn. Obviously I forgot one case here: an already-mapped region could
be contained entirely in the region we're trying to create. So go through
another round. While here add mm_reenter_pa, and make sure the va given to
mm_enter_pa does not already point to something.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/stand/prekern/mm.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/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.19 src/sys/arch/amd64/stand/prekern/mm.c:1.20
--- src/sys/arch/amd64/stand/prekern/mm.c:1.19	Sun Nov 26 11:01:09 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Sun Nov 26 14:29:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.19 2017/11/26 11:01:09 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.20 2017/11/26 14:29:48 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -71,6 +71,15 @@ mm_init(paddr_t first_pa)
 static void
 mm_enter_pa(paddr_t pa, vaddr_t va, pte_prot_t prot)
 {
+	if (PTE_BASE[pl1_i(va)] & PG_V) {
+		fatal("mm_enter_pa: mapping already present");
+	}
+	PTE_BASE[pl1_i(va)] = pa | PG_V | protection_codes[prot];
+}
+
+static void
+mm_reenter_pa(paddr_t pa, vaddr_t va, pte_prot_t prot)
+{
 	PTE_BASE[pl1_i(va)] = pa | PG_V | protection_codes[prot];
 }
 
@@ -92,7 +101,7 @@ mm_palloc(size_t npages)
 
 	/* Zero them out */
 	for (i = 0; i < npages; i++) {
-		mm_enter_pa(pa + i * PAGE_SIZE, tmpva,
+		mm_reenter_pa(pa + i * PAGE_SIZE, tmpva,
 		MM_PROT_READ|MM_PROT_WRITE);
 		mm_flush_va(tmpva);
 		memset((void *)tmpva, 0, PAGE_SIZE);
@@ -120,7 +129,7 @@ mm_mprotect(vaddr_t startva, size_t size
 	for (i = 0; i < npages; i++) {
 		va = startva + i * PAGE_SIZE;
 		pa = (PTE_BASE[pl1_i(va)] & PG_FRAME);
-		mm_enter_pa(pa, va, prot);
+		mm_reenter_pa(pa, va, prot);
 		mm_flush_va(va);
 	}
 }
@@ -227,6 +236,10 @@ mm_randva_kregion(size_t size, size_t pa
 ok = false;
 break;
 			}
+			if (randva < sva && eva < (randva + size)) {
+ok = false;
+break;
+			}
 		}
 		if (ok) {
 			break;



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 14:29:48 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: mm.c

Log Message:
Oh, damn. Obviously I forgot one case here: an already-mapped region could
be contained entirely in the region we're trying to create. So go through
another round. While here add mm_reenter_pa, and make sure the va given to
mm_enter_pa does not already point to something.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/stand/prekern/mm.c

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



CVS commit: src/doc

2017-11-26 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Sun Nov 26 12:48:44 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
mDNSResponder: Update current version, and the home page link which
has been dead for ~nine years.


To generate a diff of this commit:
cvs rdiff -u -r1.1485 -r1.1486 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1485 src/doc/3RDPARTY:1.1486
--- src/doc/3RDPARTY:1.1485	Fri Nov 17 16:21:44 2017
+++ src/doc/3RDPARTY	Sun Nov 26 12:48:44 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1485 2017/11/17 16:21:44 rin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1486 2017/11/26 12:48:44 hauke Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -848,10 +848,10 @@ Uses libc's ohash
 
 Package:	mDNSResponder
 Version:	320.16
-Current Vers:	541
+Current Vers:	878
 Maintainer:	Apple
-Archive Site:	http://www.opensource.apple.com/tarballs/mDNSResponder/
-Home Page:	http://developer.apple.com/opensource/internet/bonjour.html
+Archive Site:	https://www.opensource.apple.com/tarballs/mDNSResponder/
+Home Page:	https://developer.apple.com/bonjour/
 Mailing List:	bonjour-...@lists.apple.com
 License:	Apache2 (mdnsd), BSD 3-clause (libdns_sd),
 		BSD 3-clause like (dns-sd)



CVS commit: src/doc

2017-11-26 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Sun Nov 26 12:48:44 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
mDNSResponder: Update current version, and the home page link which
has been dead for ~nine years.


To generate a diff of this commit:
cvs rdiff -u -r1.1485 -r1.1486 src/doc/3RDPARTY

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



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

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 11:37:10 UTC 2017

Modified Files:
src/sys/arch/x86/x86: ioapic.c lapic.c

Log Message:
Remove unused variables.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/x86/ioapic.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/lapic.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/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.54 src/sys/arch/x86/x86/ioapic.c:1.55
--- src/sys/arch/x86/x86/ioapic.c:1.54	Mon Nov 13 11:45:54 2017
+++ src/sys/arch/x86/x86/ioapic.c	Sun Nov 26 11:37:10 2017
@@ -1,4 +1,4 @@
-/* 	$NetBSD: ioapic.c,v 1.54 2017/11/13 11:45:54 nakayama Exp $	*/
+/* 	$NetBSD: ioapic.c,v 1.55 2017/11/26 11:37:10 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.54 2017/11/13 11:45:54 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.55 2017/11/26 11:37:10 maxv Exp $");
 
 #include "opt_ddb.h"
 
@@ -112,8 +112,6 @@ bool ioapic_trymask(struct pic *, int);
 static void ioapic_addroute(struct pic *, struct cpu_info *, int, int, int);
 static void ioapic_delroute(struct pic *, struct cpu_info *, int, int, int);
 
-int apic_verbose = 0;
-
 struct ioapic_softc *ioapics;	 /* head of linked list */
 int nioapics = 0;	   	 /* number attached */
 static int ioapic_vecbase;

Index: src/sys/arch/x86/x86/lapic.c
diff -u src/sys/arch/x86/x86/lapic.c:1.64 src/sys/arch/x86/x86/lapic.c:1.65
--- src/sys/arch/x86/x86/lapic.c:1.64	Thu Nov 23 19:53:20 2017
+++ src/sys/arch/x86/x86/lapic.c	Sun Nov 26 11:37:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapic.c,v 1.64 2017/11/23 19:53:20 jmcneill Exp $	*/
+/*	$NetBSD: lapic.c,v 1.65 2017/11/26 11:37:10 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.64 2017/11/23 19:53:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.65 2017/11/26 11:37:10 maxv Exp $");
 
 #include "acpica.h"
 #include "ioapic.h"
@@ -494,7 +494,6 @@ lapic_gettick(void)
 
 #include 		/* for hz */
 
-int lapic_timer = 0;
 uint32_t lapic_tval;
 
 /*



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

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 11:37:10 UTC 2017

Modified Files:
src/sys/arch/x86/x86: ioapic.c lapic.c

Log Message:
Remove unused variables.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/x86/ioapic.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/lapic.c

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



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 11:08:35 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: prng.c

Log Message:
I forgot to say in my previous commit that the PRNG is inspired from a
conversation with Taylor and Thor on tech-kern@.

(just add a comment)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/stand/prekern/prng.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/stand/prekern/prng.c
diff -u src/sys/arch/amd64/stand/prekern/prng.c:1.1 src/sys/arch/amd64/stand/prekern/prng.c:1.2
--- src/sys/arch/amd64/stand/prekern/prng.c:1.1	Sun Nov 26 11:01:09 2017
+++ src/sys/arch/amd64/stand/prekern/prng.c	Sun Nov 26 11:08:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prng.c,v 1.1 2017/11/26 11:01:09 maxv Exp $	*/
+/*	$NetBSD: prng.c,v 1.2 2017/11/26 11:08:34 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -154,6 +154,7 @@ prng_init(void)
 
 	memset(, 0, sizeof(rng));
 
+	/* detect cpu features */
 	cpuid(0x07, 0x00, descs);
 	has_rdseed = (descs[1] & CPUID_SEF_RDSEED) != 0;
 	cpuid(0x01, 0x00, descs);



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 11:08:35 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: prng.c

Log Message:
I forgot to say in my previous commit that the PRNG is inspired from a
conversation with Taylor and Thor on tech-kern@.

(just add a comment)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/stand/prekern/prng.c

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



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 11:01:09 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: Makefile mm.c prekern.c prekern.h
Added Files:
src/sys/arch/amd64/stand/prekern: prng.c

Log Message:
Add a PRNG for the prekern, based on SHA512. The formula is basically:

Y0   = SHA512(entropy-file, 256bit rdseed, 64bit rdtsc)
Yn+1 = SHA512(256bit lowerhalf(Yn), 256bit rdseed, 64bit rdtsc)

On each round, random values are taken from the higher half of Yn. If
rdseed is not available, rdrand is used.

The SHA1 checksum of entropy-file is verified. However, the rndsave_t::data
field is not updated by the prekern, because the area is accessed via the
read-only view we created in locore. I like this design, so it will have
to be updated differently.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/Makefile
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/stand/prekern/prekern.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/amd64/stand/prekern/prekern.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/stand/prekern/prng.c

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



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 11:01:09 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: Makefile mm.c prekern.c prekern.h
Added Files:
src/sys/arch/amd64/stand/prekern: prng.c

Log Message:
Add a PRNG for the prekern, based on SHA512. The formula is basically:

Y0   = SHA512(entropy-file, 256bit rdseed, 64bit rdtsc)
Yn+1 = SHA512(256bit lowerhalf(Yn), 256bit rdseed, 64bit rdtsc)

On each round, random values are taken from the higher half of Yn. If
rdseed is not available, rdrand is used.

The SHA1 checksum of entropy-file is verified. However, the rndsave_t::data
field is not updated by the prekern, because the area is accessed via the
read-only view we created in locore. I like this design, so it will have
to be updated differently.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/Makefile
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/stand/prekern/prekern.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/amd64/stand/prekern/prekern.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/stand/prekern/prng.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/stand/prekern/Makefile
diff -u src/sys/arch/amd64/stand/prekern/Makefile:1.4 src/sys/arch/amd64/stand/prekern/Makefile:1.5
--- src/sys/arch/amd64/stand/prekern/Makefile:1.4	Fri Nov 17 07:07:52 2017
+++ src/sys/arch/amd64/stand/prekern/Makefile	Sun Nov 26 11:01:09 2017
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.4 2017/11/17 07:07:52 maxv Exp $
+#	$NetBSD: Makefile,v 1.5 2017/11/26 11:01:09 maxv Exp $
 
 PROG=		prekern
-SRCS=		locore.S trap.S prekern.c mm.c console.c elf.c
+SRCS=		locore.S trap.S prekern.c mm.c console.c elf.c prng.c
 
 NOSSP=		# defined
 NOPIE=		# defined

Index: src/sys/arch/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.18 src/sys/arch/amd64/stand/prekern/mm.c:1.19
--- src/sys/arch/amd64/stand/prekern/mm.c:1.18	Tue Nov 21 07:56:05 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Sun Nov 26 11:01:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.18 2017/11/21 07:56:05 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.19 2017/11/26 11:01:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -196,13 +196,6 @@ mm_map_tree(vaddr_t startva, vaddr_t end
 	}
 }
 
-static uint64_t
-mm_rand_num64(void)
-{
-	/* XXX: yes, this is ridiculous, will be fixed soon */
-	return rdtsc();
-}
-
 static vaddr_t
 mm_randva_kregion(size_t size, size_t pagesz)
 {
@@ -213,7 +206,7 @@ mm_randva_kregion(size_t size, size_t pa
 	bool ok;
 
 	while (1) {
-		rnd = mm_rand_num64();
+		prng_get_rand(, sizeof(rnd));
 		randva = rounddown(KASLR_WINDOW_BASE +
 		rnd % (KASLR_WINDOW_SIZE - size), pagesz);
 
@@ -298,7 +291,7 @@ mm_shift_segment(vaddr_t va, size_t page
 		return 0;
 	}
 
-	rnd = mm_rand_num64();
+	prng_get_rand(, sizeof(rnd));
 	offset = roundup(rnd % shiftsize, elfalign);
 	ASSERT((va + offset) % elfalign == 0);
 
@@ -322,7 +315,7 @@ mm_map_head(void)
 	size = elf_get_head_size((vaddr_t)kernpa_start);
 	npages = size / PAGE_SIZE;
 
-	rnd = mm_rand_num64();
+	prng_get_rand(, sizeof(rnd));
 	randva = rounddown(HEAD_WINDOW_BASE + rnd % (HEAD_WINDOW_SIZE - size),
 	PAGE_SIZE);
 	mm_map_tree(randva, randva + size);

Index: src/sys/arch/amd64/stand/prekern/prekern.c
diff -u src/sys/arch/amd64/stand/prekern/prekern.c:1.6 src/sys/arch/amd64/stand/prekern/prekern.c:1.7
--- src/sys/arch/amd64/stand/prekern/prekern.c:1.6	Fri Nov 17 07:07:52 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.c	Sun Nov 26 11:01:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.c,v 1.6 2017/11/17 07:07:52 maxv Exp $	*/
+/*	$NetBSD: prekern.c,v 1.7 2017/11/26 11:01:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -336,6 +336,11 @@ init_prekern(paddr_t pa_start)
 	print_state(true, "Prekern loaded");
 
 	/*
+	 * Init the PRNG.
+	 */
+	prng_init();
+
+	/*
 	 * Relocate the kernel.
 	 */
 	mm_map_kernel();

Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.17 src/sys/arch/amd64/stand/prekern/prekern.h:1.18
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.17	Sun Nov 26 10:21:20 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Sun Nov 26 11:01:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.h,v 1.17 2017/11/26 10:21:20 maxv Exp $	*/
+/*	$NetBSD: prekern.h,v 1.18 2017/11/26 11:01:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -111,3 +111,7 @@ void mm_map_kernel(void);
 
 /* prekern.c */
 void fatal(char *);
+
+/* prng.c */
+void prng_init(void);
+void prng_get_rand(void *, size_t);

Added files:

Index: src/sys/arch/amd64/stand/prekern/prng.c
diff -u /dev/null src/sys/arch/amd64/stand/prekern/prng.c:1.1
--- /dev/null	Sun 

CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 10:21:20 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: locore.S prekern.h

Log Message:
Add rdrand.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/stand/prekern/locore.S
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/stand/prekern/prekern.h

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



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 26 10:21:20 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: locore.S prekern.h

Log Message:
Add rdrand.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/stand/prekern/locore.S
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/stand/prekern/prekern.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/amd64/stand/prekern/locore.S
diff -u src/sys/arch/amd64/stand/prekern/locore.S:1.5 src/sys/arch/amd64/stand/prekern/locore.S:1.6
--- src/sys/arch/amd64/stand/prekern/locore.S:1.5	Tue Nov 14 13:58:07 2017
+++ src/sys/arch/amd64/stand/prekern/locore.S	Sun Nov 26 10:21:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.5 2017/11/14 13:58:07 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.6 2017/11/26 10:21:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2007, 2008, 2016, 2017 The NetBSD Foundation, Inc.
@@ -612,15 +612,26 @@ END(rdtsc)
 
 ENTRY(rdseed)
 	rdseed	%rax
-	jc	.Lsuccess
+	jc	.Lrdseed_success
 	movq	$(-1),%rax
 	ret
-.Lsuccess:
+.Lrdseed_success:
 	movq	%rax,(%rdi)
 	xorq	%rax,%rax
 	ret
 END(rdseed)
 
+ENTRY(rdrand)
+	rdrand	%rax
+	jc	.Lrdrand_success
+	movq	$(-1),%rax
+	ret
+.Lrdrand_success:
+	movq	%rax,(%rdi)
+	xorq	%rax,%rax
+	ret
+END(rdrand)
+
 ENTRY(jump_kernel)
 	movq	_C_LABEL(stkva),%rsp
 	xorq	%rbp,%rbp

Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.16 src/sys/arch/amd64/stand/prekern/prekern.h:1.17
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.16	Tue Nov 21 07:56:05 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Sun Nov 26 10:21:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.h,v 1.16 2017/11/21 07:56:05 maxv Exp $	*/
+/*	$NetBSD: prekern.h,v 1.17 2017/11/26 10:21:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -100,6 +100,7 @@ void cpuid(uint32_t, uint32_t, uint32_t 
 void lidt(void *);
 uint64_t rdtsc(void);
 int rdseed(uint64_t *);
+int rdrand(uint64_t *);
 void jump_kernel(vaddr_t);
 
 /* mm.c */



Re: CVS commit: src/sbin/mount_qemufwcfg

2017-11-26 Thread Jared McNeill
The addition of a default case to the getopt loop means refuse will not 
have a chance to process built-in options.



On Sat, 25 Nov 2017, Christos Zoulas wrote:


Module Name:src
Committed By:   christos
Date:   Sun Nov 26 03:06:24 UTC 2017

Modified Files:
src/sbin/mount_qemufwcfg: Makefile fwcfg.c virtdir.c virtdir.h
Removed Files:
src/sbin/mount_qemufwcfg: defs.h

Log Message:
cleanup, knf, remove debugging printf, homebrew alloc macros, types.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/mount_qemufwcfg/Makefile \
   src/sbin/mount_qemufwcfg/fwcfg.c src/sbin/mount_qemufwcfg/virtdir.c \
   src/sbin/mount_qemufwcfg/virtdir.h
cvs rdiff -u -r1.1 -r0 src/sbin/mount_qemufwcfg/defs.h

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