CVS commit: src/sys/dev/hyperv

2022-11-02 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Nov  2 18:18:44 UTC 2022

Modified Files:
src/sys/dev/hyperv: hvtimesync.c

Log Message:
rename sneaky snyc in hvtimesnyc_sample_verbose variable to sync.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/hvtimesync.c

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

Modified files:

Index: src/sys/dev/hyperv/hvtimesync.c
diff -u src/sys/dev/hyperv/hvtimesync.c:1.2 src/sys/dev/hyperv/hvtimesync.c:1.3
--- src/sys/dev/hyperv/hvtimesync.c:1.2	Fri Mar  1 08:17:51 2019
+++ src/sys/dev/hyperv/hvtimesync.c	Wed Nov  2 18:18:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvtimesync.c,v 1.2 2019/03/01 08:17:51 nonaka Exp $	*/
+/*	$NetBSD: hvtimesync.c,v 1.3 2022/11/02 18:18:44 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2014,2016-2017 Microsoft Corp.
@@ -28,7 +28,7 @@
 
 #include 
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hvtimesync.c,v 1.2 2019/03/01 08:17:51 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvtimesync.c,v 1.3 2022/11/02 18:18:44 andvar Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/utilities/vmbus_timesync.c 322488 2017-08-14 06:00:50Z sephe $");
@@ -75,7 +75,7 @@ CFATTACH_DECL_NEW(hvtimesync, sizeof(str
 hvtimesync_match, hvtimesync_attach, hvtimesync_detach, NULL);
 
 static int hvtimesync_ignore_sync;
-static int hvtimesnyc_sample_verbose;
+static int hvtimesync_sample_verbose;
 static int hvtimesync_sample_thresh = -1;
 
 static int
@@ -149,7 +149,7 @@ do_timesync(struct hvtimesync_softc *sc,
 
 	if ((tsflags & VMBUS_ICMSG_TS_FLAG_SAMPLE) &&
 	hvtimesync_sample_thresh >= 0) {
-		if (hvtimesnyc_sample_verbose) {
+		if (hvtimesync_sample_verbose) {
 			device_printf(vsc->sc_dev,
 			"sample request, hv: %ju, vm: %ju\n",
 			(uintmax_t)hv_ns, (uintmax_t)vm_ns);
@@ -284,7 +284,7 @@ hvtimesync_sysctl_setup(device_t self)
 	error = sysctl_createv(>sc_log, 0, , NULL,
 	CTLFLAG_READWRITE,
 	CTLTYPE_INT, "sample_verbose", NULL,
-	NULL, 0, _sample_verbose, 0,
+	NULL, 0, _sample_verbose, 0,
 	CTL_CREATE, CTL_EOL);
 	if (error)
 		return error;



CVS commit: src/sys/dev/hyperv

2022-11-02 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Nov  2 18:18:44 UTC 2022

Modified Files:
src/sys/dev/hyperv: hvtimesync.c

Log Message:
rename sneaky snyc in hvtimesnyc_sample_verbose variable to sync.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/hvtimesync.c

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



CVS commit: src/sys/dev/hyperv

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 16:59:36 UTC 2022

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/hyperv/if_hvn.c

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

Modified files:

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.23 src/sys/dev/hyperv/if_hvn.c:1.24
--- src/sys/dev/hyperv/if_hvn.c:1.23	Sun May 29 10:43:45 2022
+++ src/sys/dev/hyperv/if_hvn.c	Sun Sep 18 16:59:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.23 2022/05/29 10:43:45 rin Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.24 2022/09/18 16:59:35 thorpej Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.23 2022/05/29 10:43:45 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.24 2022/09/18 16:59:35 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_hvn.h"
@@ -1063,9 +1063,6 @@ hvn_init_locked(struct ifnet *ifp)
 	if (error)
 		return error;
 
-	/* Clear OACTIVE bit. */
-	ifp->if_flags &= ~IFF_OACTIVE;
-
 	/* Clear TX 'suspended' bit. */
 	hvn_resume_tx(sc, sc->sc_ntxr_inuse);
 
@@ -1099,8 +1096,7 @@ hvn_stop_locked(struct ifnet *ifp)
 	/* Suspend data transfers. */
 	hvn_suspend_data(sc);
 
-	/* Clear OACTIVE bit. */
-	ifp->if_flags &= ~IFF_OACTIVE;
+	/* Clear OACTIVE state. */
 	for (i = 0; i < sc->sc_ntxr_inuse; i++)
 		sc->sc_txr[i].txr_oactive = 0;
 }
@@ -1117,8 +1113,6 @@ hvn_transmit_common(struct ifnet *ifp, s
 
 	if (!(ifp->if_flags & IFF_RUNNING))
 		return;
-	if (!is_transmit && (ifp->if_flags & IFF_OACTIVE))
-		return;
 	if (txr->txr_oactive)
 		return;
 	if (txr->txr_suspended)
@@ -1127,8 +1121,6 @@ hvn_transmit_common(struct ifnet *ifp, s
 	for (;;) {
 		if (!hvn_txd_peek(txr)) {
 			/* transient */
-			if (!is_transmit)
-ifp->if_flags |= IFF_OACTIVE;
 			txr->txr_oactive = 1;
 			txr->txr_evnodesc.ev_count++;
 			break;
@@ -3645,7 +3637,6 @@ hvn_nvs_intr1(struct hvn_rx_ring *rxr, i
 		mutex_enter(>txr_lock);
 		/* ALTQ */
 		if (txr->txr_id == 0) {
-			ifp->if_flags &= ~IFF_OACTIVE;
 			if_schedule_deferred_start(ifp);
 		}
 		softint_schedule(txr->txr_si);



CVS commit: src/sys/dev/hyperv

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 16:59:36 UTC 2022

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys/dev/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Nov 26 01:46:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
hvn(4): Fix incorrect ident when waiting for NVS command response.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/hyperv/if_hvn.c

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

Modified files:

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.10 src/sys/dev/hyperv/if_hvn.c:1.11
--- src/sys/dev/hyperv/if_hvn.c:1.10	Mon Nov 25 08:53:39 2019
+++ src/sys/dev/hyperv/if_hvn.c	Tue Nov 26 01:46:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.11 2019/11/26 01:46:31 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.11 2019/11/26 01:46:31 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1091,7 +1091,8 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			hvn_nvs_intr(sc);
 			splx(s);
 		} else
-			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
+			tsleep(sc->sc_nvsrsp, PRIBIO | PCATCH, "nvscmd",
+			mstohz(1));
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {



CVS commit: src/sys/dev/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Nov 26 01:46:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
hvn(4): Fix incorrect ident when waiting for NVS command response.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys/dev/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 25 08:53:39 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvs.c if_hvn.c

Log Message:
hvs(4), hvn(4): Set correct size for bus_dmamap_sync(9).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/hvs.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys/dev/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 25 08:53:39 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvs.c if_hvn.c

Log Message:
hvs(4), hvn(4): Set correct size for bus_dmamap_sync(9).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/hvs.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/hyperv/if_hvn.c

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

Modified files:

Index: src/sys/dev/hyperv/hvs.c
diff -u src/sys/dev/hyperv/hvs.c:1.2 src/sys/dev/hyperv/hvs.c:1.3
--- src/sys/dev/hyperv/hvs.c:1.2	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/hvs.c	Mon Nov 25 08:53:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvs.c,v 1.2 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: hvs.c,v 1.3 2019/11/25 08:53:39 nonaka Exp $	*/
 /*	$OpenBSD: hvs.c,v 1.17 2017/08/10 17:22:48 mikeb Exp $	*/
 
 /*-
@@ -37,7 +37,7 @@
 /* #define HVS_DEBUG_IO */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.2 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.3 2019/11/25 08:53:39 nonaka Exp $");
 
 #include 
 #include 
@@ -1084,7 +1084,8 @@ hvs_free_ccbs(struct hvs_softc *sc)
 		if (ccb->ccb_dmap == NULL)
 			continue;
 
-		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmap,
+		0, ccb->ccb_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmap);
 		bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmap);

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.9 src/sys/dev/hyperv/if_hvn.c:1.10
--- src/sys/dev/hyperv/if_hvn.c:1.9	Fri Nov 22 12:40:07 2019
+++ src/sys/dev/hyperv/if_hvn.c	Mon Nov 25 08:53:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -632,7 +632,8 @@ hvn_decap(struct hvn_softc *sc, struct h
 {
 	struct ifnet *ifp = SC2IFP(sc);
 
-	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+	0, txd->txd_dmap->dm_mapsize,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 	txd->txd_buf = NULL;
@@ -667,7 +668,8 @@ hvn_txeof(struct hvn_softc *sc, uint64_t
 	}
 	txd->txd_buf = NULL;
 
-	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+	0, txd->txd_dmap->dm_mapsize,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 	m_freem(m);
@@ -844,7 +846,8 @@ hvn_tx_ring_destroy(struct hvn_softc *sc
 		txd = >sc_tx_desc[i];
 		if (txd->txd_dmap == NULL)
 			continue;
-		bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+		0, txd->txd_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 		bus_dmamap_destroy(sc->sc_dmat, txd->txd_dmap);
@@ -855,7 +858,8 @@ hvn_tx_ring_destroy(struct hvn_softc *sc
 		txd->txd_buf = NULL;
 	}
 	if (sc->sc_tx_rmap) {
-		bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap,
+		0, txd->txd_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, sc->sc_tx_rmap);
 		bus_dmamap_destroy(sc->sc_dmat, sc->sc_tx_rmap);



CVS commit: src/sys/dev/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:40:08 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): Only need to poll when cold.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys/dev/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:40:08 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): Only need to poll when cold.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/hyperv/if_hvn.c

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

Modified files:

Index: src/sys/dev/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.5 src/sys/dev/hyperv/hvkbd.c:1.6
--- src/sys/dev/hyperv/hvkbd.c:1.5	Fri Nov 22 12:30:32 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Nov 22 12:40:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $");
 
 #include 
 #include 
@@ -344,13 +344,13 @@ hvkbd_connect(struct hvkbd_softc *sc)
 	}
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
+			s = spltty();
+			hvkbd_intr(sc);
+			splx(s);
+		} else
 			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1));
-		s = spltty();
-		hvkbd_intr(sc);
-		splx(s);
 	} while (--timo > 0 && sc->sc_connected == 0);
 
 	if (timo == 0 && sc->sc_connected == 0) {

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.8 src/sys/dev/hyperv/if_hvn.c:1.9
--- src/sys/dev/hyperv/if_hvn.c:1.8	Fri Nov 22 12:30:32 2019
+++ src/sys/dev/hyperv/if_hvn.c	Fri Nov 22 12:40:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1081,13 +1081,13 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 		return 0;
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
+			s = splnet();
+			hvn_nvs_intr(sc);
+			splx(s);
+		} else
 			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
-		s = splnet();
-		hvn_nvs_intr(sc);
-		splx(s);
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {
@@ -1404,13 +1404,13 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 	BUS_DMASYNC_POSTWRITE);
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
+			s = splnet();
+			hvn_nvs_intr(sc);
+			splx(s);
+		} else
 			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", mstohz(1));
-		s = splnet();
-		hvn_nvs_intr(sc);
-		splx(s);
 	} while (--timo > 0 && rc->rc_done != 1);
 
 	bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,



CVS commit: src/sys/dev/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:30:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c vmbus.c

Log Message:
vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hyperv/hvkbd.c \
src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys/dev/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:30:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c vmbus.c

Log Message:
vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hyperv/hvkbd.c \
src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hyperv/if_hvn.c

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

Modified files:

Index: src/sys/dev/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.4 src/sys/dev/hyperv/hvkbd.c:1.5
--- src/sys/dev/hyperv/hvkbd.c:1.4	Fri Nov 15 08:51:27 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Nov 22 12:30:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $");
 
 #include 
 #include 
@@ -347,7 +347,7 @@ hvkbd_connect(struct hvkbd_softc *sc)
 		if (cold)
 			delay(1000);
 		else
-			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", 1);
+			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1));
 		s = spltty();
 		hvkbd_intr(sc);
 		splx(s);
Index: src/sys/dev/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.4 src/sys/dev/hyperv/vmbus.c:1.5
--- src/sys/dev/hyperv/vmbus.c:1.4	Tue Jul  9 10:07:11 2019
+++ src/sys/dev/hyperv/vmbus.c	Fri Nov 22 12:30:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $");
 
 #include 
 #include 
@@ -604,7 +604,7 @@ vmbus_start(struct vmbus_softc *sc, stru
 			hyperv_intr();
 			splx(s);
 		} else
-			tsleep(wchan, PRIBIO, wchan, 1);
+			tsleep(wchan, PRIBIO, wchan, mstohz(delays[i]));
 	}
 	if (status != HYPERCALL_STATUS_SUCCESS) {
 		device_printf(sc->sc_dev,
@@ -666,7 +666,8 @@ vmbus_wait(struct vmbus_softc *sc,
 			hyperv_intr();
 			splx(s);
 		} else
-			tsleep(wchan, PRIBIO, wmsg ? wmsg : "hvwait", 1);
+			tsleep(wchan, PRIBIO, wmsg ? wmsg : "hvwait",
+			mstohz(1));
 	}
 }
 

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.7 src/sys/dev/hyperv/if_hvn.c:1.8
--- src/sys/dev/hyperv/if_hvn.c:1.7	Mon Nov 18 04:38:48 2019
+++ src/sys/dev/hyperv/if_hvn.c	Fri Nov 22 12:30:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1063,7 +1063,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			if (cold)
 delay(1000);
 			else
-tsleep(cmd, PRIBIO, "nvsout", 1);
+tsleep(cmd, PRIBIO, "nvsout", mstohz(1));
 		} else if (rv) {
 			DPRINTF("%s: NVSP operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->nvs_type, rv);
@@ -1084,7 +1084,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 		if (cold)
 			delay(1000);
 		else
-			tsleep(sc, PRIBIO | PCATCH, "nvscmd", 1);
+			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
 		s = splnet();
 		hvn_nvs_intr(sc);
 		splx(s);
@@ -1385,7 +1385,7 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			if (cold)
 delay(1000);
 			else
-tsleep(rc, PRIBIO, "rndisout", 1);
+tsleep(rc, PRIBIO, "rndisout", mstohz(1));
 		} else if (rv) {
 			DPRINTF("%s: RNDIS operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->rm_type, rv);
@@ -1407,7 +1407,7 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 		if (cold)
 			delay(1000);
 		else
-			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", 1);
+			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", mstohz(1));
 		s = splnet();
 		hvn_nvs_intr(sc);
 		splx(s);



CVS commit: src/sys/dev/hyperv

2019-11-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 18 04:38:48 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hyperv/if_hvn.c

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

Modified files:

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.6 src/sys/dev/hyperv/if_hvn.c:1.7
--- src/sys/dev/hyperv/if_hvn.c:1.6	Fri Nov 15 08:51:27 2019
+++ src/sys/dev/hyperv/if_hvn.c	Mon Nov 18 04:38:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -565,7 +565,7 @@ hvn_encap(struct hvn_softc *sc, struct m
 	case 0:
 		break;
 	case EFBIG:
-		if (m_defrag(m, M_NOWAIT) == 0 &&
+		if (m_defrag(m, M_NOWAIT) != NULL &&
 		bus_dmamap_load_mbuf(sc->sc_dmat, txd->txd_dmap, m,
 		  BUS_DMA_READ | BUS_DMA_NOWAIT) == 0)
 			break;



CVS commit: src/sys/dev/hyperv

2019-11-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 18 04:38:48 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys/dev/hyperv

2019-11-15 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 15 08:51:27 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/if_hvn.c

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

Modified files:

Index: src/sys/dev/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.3 src/sys/dev/hyperv/hvkbd.c:1.4
--- src/sys/dev/hyperv/hvkbd.c:1.3	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Nov 15 08:51:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.3 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.3 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $");
 
 #include 
 #include 
@@ -210,11 +210,6 @@ hvkbd_attach(device_t parent, device_t s
 	hvkbd_alloc_keybuf(sc);
 
 	sc->sc_buf = kmem_zalloc(HVKBD_BUFSIZE, KM_SLEEP);
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(self))) {
-		aprint_error_dev(self,
-		"failed to create the interrupt thread\n");
-		goto free_buf;
-	}
 
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 	if (vmbus_channel_open(sc->sc_chan,

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.5 src/sys/dev/hyperv/if_hvn.c:1.6
--- src/sys/dev/hyperv/if_hvn.c:1.5	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/if_hvn.c	Fri Nov 15 08:51:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.5 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.5 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -922,12 +922,6 @@ hvn_nvs_attach(struct hvn_softc *sc)
 
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(sc->sc_dev))) {
-		aprint_error_dev(sc->sc_dev,
-		"failed to create the interrupt thread\n");
-		return -1;
-	}
-
 	/* Associate our interrupt handler with the channel */
 	if (vmbus_channel_open(sc->sc_chan, ringsize, NULL, 0,
 	hvn_nvs_intr, sc)) {



CVS commit: src/sys/dev/hyperv

2019-11-15 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 15 08:51:27 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys/dev/hyperv

2019-07-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 21 16:08:13 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c

Log Message:
Fix build for !WSDISPLAY_COMPAT_RAWKBD.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/hvkbd.c

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



CVS commit: src/sys/dev/hyperv

2019-07-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 21 16:08:13 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c

Log Message:
Fix build for !WSDISPLAY_COMPAT_RAWKBD.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/hvkbd.c

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

Modified files:

Index: src/sys/dev/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.1 src/sys/dev/hyperv/hvkbd.c:1.2
--- src/sys/dev/hyperv/hvkbd.c:1.1	Fri May 24 14:28:48 2019
+++ src/sys/dev/hyperv/hvkbd.c	Sun Jul 21 16:08:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.1 2019/05/24 14:28:48 nonaka Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.2 2019/07/21 16:08:13 rin Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.1 2019/05/24 14:28:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.2 2019/07/21 16:08:13 rin Exp $");
 
 #include 
 #include 
@@ -317,7 +317,9 @@ hvkbd_set_leds(void *v, int leds)
 static int
 hvkbd_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
 {
+#if defined(WSDISPLAY_COMPAT_RAWKBD)
 	struct hvkbd_softc *sc = v;
+#endif
 
 	switch (cmd) {
 	case WSKBDIO_GTYPE:
@@ -434,6 +436,7 @@ hvkbd_decode(struct hvkbd_softc *sc, u_i
 	return 1;
 }
 
+#if defined(WSDISPLAY_COMPAT_RAWKBD)
 static int
 hvkbd_encode(struct hvkbd_softc *sc, u_char *buf, int *len)
 {
@@ -478,6 +481,7 @@ hvkbd_encode(struct hvkbd_softc *sc, u_c
 
 	return 1;
 }
+#endif
 
 static void
 hvkbd_intr(void *xsc)



CVS commit: src/sys/dev/hyperv

2019-07-09 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Tue Jul  9 10:07:11 UTC 2019

Modified Files:
src/sys/dev/hyperv: vmbus.c

Log Message:
Zero clear the allocated ring buffer for vmbus_channel.
This change makes Hyper-V's vmbus devices work properly even after reboot.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/vmbus.c

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

Modified files:

Index: src/sys/dev/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.3 src/sys/dev/hyperv/vmbus.c:1.4
--- src/sys/dev/hyperv/vmbus.c:1.3	Fri May 24 14:28:48 2019
+++ src/sys/dev/hyperv/vmbus.c	Tue Jul  9 10:07:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.3 2019/05/24 14:28:48 nonaka Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.3 2019/05/24 14:28:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $");
 
 #include 
 #include 
@@ -1263,6 +1263,7 @@ vmbus_channel_ring_create(struct vmbus_c
 		"failed to allocate channel ring\n");
 		return ENOMEM;
 	}
+	memset(ch->ch_ring, 0, ch->ch_ring_size);
 
 	memset(>ch_wrd, 0, sizeof(ch->ch_wrd));
 	ch->ch_wrd.rd_ring = (struct vmbus_bufring *)ch->ch_ring;



CVS commit: src/sys/dev/hyperv

2019-07-09 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Tue Jul  9 10:07:11 UTC 2019

Modified Files:
src/sys/dev/hyperv: vmbus.c

Log Message:
Zero clear the allocated ring buffer for vmbus_channel.
This change makes Hyper-V's vmbus devices work properly even after reboot.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/vmbus.c

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



CVS commit: src/sys/dev/hyperv

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 31 04:23:19 UTC 2019

Modified Files:
src/sys/dev/hyperv: hyperv_common.c

Log Message:
Avoid undefined reference to `hyperv_is_gen1' without hyperv(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/hyperv_common.c

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

Modified files:

Index: src/sys/dev/hyperv/hyperv_common.c
diff -u src/sys/dev/hyperv/hyperv_common.c:1.1 src/sys/dev/hyperv/hyperv_common.c:1.2
--- src/sys/dev/hyperv/hyperv_common.c:1.1	Fri Feb 15 08:54:01 2019
+++ src/sys/dev/hyperv/hyperv_common.c	Fri May 31 04:23:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv_common.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $	*/
+/*	$NetBSD: hyperv_common.c,v 1.2 2019/05/31 04:23:19 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.2 2019/05/31 04:23:19 nonaka Exp $");
 
 #include "hyperv.h"
 
@@ -51,6 +51,7 @@ uint64_t	hyperv_hypercall_error(uint64_t
 __weak_alias(hyperv_hypercall, hyperv_hypercall_error);
 __weak_alias(hyperv_hypercall_enabled, hyperv_nullop);
 __weak_alias(hyperv_synic_supported, hyperv_nullop);
+__weak_alias(hyperv_is_gen1, hyperv_nullop);
 __weak_alias(hyperv_set_event_proc, hyperv_voidop);
 __weak_alias(hyperv_set_message_proc, hyperv_voidop);
 __weak_alias(hyperv_send_eom, hyperv_voidop);



CVS commit: src/sys/dev/hyperv

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 31 04:23:19 UTC 2019

Modified Files:
src/sys/dev/hyperv: hyperv_common.c

Log Message:
Avoid undefined reference to `hyperv_is_gen1' without hyperv(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/hyperv_common.c

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