Module Name:    src
Committed By:   yamaguchi
Date:           Mon May 25 07:29:52 UTC 2020

Modified Files:
        src/sys/dev/pci: virtio.c virtio_pci.c virtiovar.h

Log Message:
Remove VIRTIO_F_PCI_INTR_SOFTINT support for multiqueue

The functionality is no longer used by obsolating VIOIF_SOFTINT_INTR.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/virtio.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/virtio_pci.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/virtiovar.h

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

Modified files:

Index: src/sys/dev/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.38 src/sys/dev/pci/virtio.c:1.39
--- src/sys/dev/pci/virtio.c:1.38	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/pci/virtio.c	Mon May 25 07:29:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.38 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: virtio.c,v 1.39 2020/05/25 07:29:52 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.38 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.39 2020/05/25 07:29:52 yamaguchi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -235,54 +235,6 @@ vq_sync_indirect(struct virtio_softc *sc
 			ops);
 }
 
-static void
-virtio_vq_soft_intr(void *arg)
-{
-	struct virtqueue *vq = arg;
-
-	KASSERT(vq->vq_intrhand != NULL);
-
-	(vq->vq_intrhand)(vq);
-}
-
-static int
-virtio_vq_softint_establish(struct virtio_softc *sc)
-{
-	struct virtqueue *vq;
-	int qid;
-	u_int flags;
-
-	flags = SOFTINT_NET;
-	if (sc->sc_flags & VIRTIO_F_PCI_INTR_MPSAFE)
-		flags |= SOFTINT_MPSAFE;
-
-	for (qid = 0; qid < sc->sc_nvqs; qid++) {
-		vq = &sc->sc_vqs[qid];
-		vq->vq_soft_ih =
-		    softint_establish(flags, virtio_vq_soft_intr, vq);
-		if (vq->vq_soft_ih == NULL)
-			return -1;
-	}
-
-	return 0;
-}
-
-static void
-virtio_vq_softint_disestablish(struct virtio_softc *sc)
-{
-	struct virtqueue *vq;
-	int qid;
-
-	for (qid = 0; qid < sc->sc_nvqs; qid++) {
-		vq = &sc->sc_vqs[qid];
-		if (vq->vq_soft_ih == NULL)
-			continue;
-
-		softint_disestablish(vq->vq_soft_ih);
-		vq->vq_soft_ih = NULL;
-	}
-}
-
 /*
  * Can be used as sc_intrhand.
  */
@@ -910,6 +862,9 @@ void
 virtio_child_attach_set_vqs(struct virtio_softc *sc,
     struct virtqueue *vqs, int nvq_pairs)
 {
+
+	KASSERT(nvq_pairs == 1 ||
+	    (sc->sc_flags & VIRTIO_F_PCI_INTR_SOFTINT) == 0);
 	if (nvq_pairs > 1)
 		sc->sc_child_mq = true;
 
@@ -940,13 +895,6 @@ virtio_child_attach_finish(struct virtio
 			    "failed to establish soft interrupt\n");
 			goto fail;
 		}
-
-		if (sc->sc_child_mq) {
-			r = virtio_vq_softint_establish(sc);
-			aprint_error_dev(sc->sc_dev,
-			    "failed to establish softint interrupt\n");
-			goto fail;
-		}
 	}
 
 	virtio_set_status(sc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
@@ -958,8 +906,6 @@ fail:
 		sc->sc_soft_ih = NULL;
 	}
 
-	virtio_vq_softint_disestablish(sc);
-
 	virtio_set_status(sc, VIRTIO_CONFIG_DEVICE_STATUS_FAILED);
 	return 1;
 }

Index: src/sys/dev/pci/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.7 src/sys/dev/pci/virtio_pci.c:1.8
--- src/sys/dev/pci/virtio_pci.c:1.7	Sun Jan 27 02:08:42 2019
+++ src/sys/dev/pci/virtio_pci.c	Mon May 25 07:29:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.8 2020/05/25 07:29:52 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.8 2020/05/25 07:29:52 yamaguchi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -801,16 +801,9 @@ static int
 virtio_pci_msix_vq_intr(void *arg)
 {
 	struct virtqueue *vq = arg;
-	int r = 0;
 
-	if (vq->vq_intrhand != NULL) {
-		if (vq->vq_soft_ih)
-			softint_schedule(vq->vq_soft_ih);
-		else
-			r |= vq->vq_intrhand(vq);
-	}
-
-	return r;
+	KASSERT(vq->vq_intrhand != NULL);
+	return vq->vq_intrhand(vq);
 }
 
 static int

Index: src/sys/dev/pci/virtiovar.h
diff -u src/sys/dev/pci/virtiovar.h:1.13 src/sys/dev/pci/virtiovar.h:1.14
--- src/sys/dev/pci/virtiovar.h:1.13	Mon Jan 14 14:55:37 2019
+++ src/sys/dev/pci/virtiovar.h	Mon May 25 07:29:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtiovar.h,v 1.13 2019/01/14 14:55:37 yamaguchi Exp $	*/
+/*	$NetBSD: virtiovar.h,v 1.14 2020/05/25 07:29:52 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -117,7 +117,6 @@ struct virtqueue {
 	/* interrupt handler */
 	int			(*vq_done)(struct virtqueue*);
 	void			*vq_done_ctx;
-	void			*vq_soft_ih;
 	int			(*vq_intrhand)(struct virtqueue*);
 };
 

Reply via email to