Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Introduce VIRTIO_F_PCI_INTR_MPSAFE for virtio



details:   https://anonhg.NetBSD.org/src/rev/a4939de0aa8f
branches:  trunk
changeset: 797555:a4939de0aa8f
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jul 22 01:55:54 2014 +0000

description:
Introduce VIRTIO_F_PCI_INTR_MPSAFE for virtio

It is set by a child driver, e.g., if_vioif. If set, virtio sets
PCI_INTR_MPSAFE for pci_intr_establish.

diffstat:

 sys/dev/pci/if_vioif.c  |   5 +++--
 sys/dev/pci/ld_virtio.c |   5 +++--
 sys/dev/pci/viomb.c     |   5 +++--
 sys/dev/pci/virtio.c    |  10 ++++++++--
 sys/dev/pci/virtiovar.h |   6 +++++-
 5 files changed, 22 insertions(+), 9 deletions(-)

diffs (138 lines):

diff -r 813b2dfe5016 -r a4939de0aa8f sys/dev/pci/if_vioif.c
--- a/sys/dev/pci/if_vioif.c    Tue Jul 22 01:03:22 2014 +0000
+++ b/sys/dev/pci/if_vioif.c    Tue Jul 22 01:55:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vioif.c,v 1.5 2014/07/18 02:10:55 ozaki-r Exp $     */
+/*     $NetBSD: if_vioif.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $     */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.5 2014/07/18 02:10:55 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -476,6 +476,7 @@
        vsc->sc_vqs = &sc->sc_vq[0];
        vsc->sc_config_change = 0;
        vsc->sc_intrhand = virtio_vq_intr;
+       vsc->sc_flags = 0;
 
        features = virtio_negotiate_features(vsc,
                                             (VIRTIO_NET_F_MAC |
diff -r 813b2dfe5016 -r a4939de0aa8f sys/dev/pci/ld_virtio.c
--- a/sys/dev/pci/ld_virtio.c   Tue Jul 22 01:03:22 2014 +0000
+++ b/sys/dev/pci/ld_virtio.c   Tue Jul 22 01:55:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_virtio.c,v 1.5 2012/02/02 19:43:06 tls Exp $        */
+/*     $NetBSD: ld_virtio.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $    */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.5 2012/02/02 19:43:06 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -250,6 +250,7 @@
        vsc->sc_nvqs = 1;
        vsc->sc_config_change = 0;
        vsc->sc_intrhand = virtio_vq_intr;
+       vsc->sc_flags = 0;
 
        features = virtio_negotiate_features(vsc,
                                             (VIRTIO_BLK_F_SIZE_MAX |
diff -r 813b2dfe5016 -r a4939de0aa8f sys/dev/pci/viomb.c
--- a/sys/dev/pci/viomb.c       Tue Jul 22 01:03:22 2014 +0000
+++ b/sys/dev/pci/viomb.c       Tue Jul 22 01:55:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: viomb.c,v 1.2 2013/10/17 21:06:15 christos Exp $       */
+/*     $NetBSD: viomb.c,v 1.3 2014/07/22 01:55:54 ozaki-r Exp $        */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.2 2013/10/17 21:06:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.3 2014/07/22 01:55:54 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -140,6 +140,7 @@
        vsc->sc_nvqs = 2;
        vsc->sc_config_change = viomb_config_change;
        vsc->sc_intrhand = virtio_vq_intr;
+       vsc->sc_flags = 0;
 
        virtio_negotiate_features(vsc,
                                  VIRTIO_CONFIG_DEVICE_FEATURES);
diff -r 813b2dfe5016 -r a4939de0aa8f sys/dev/pci/virtio.c
--- a/sys/dev/pci/virtio.c      Tue Jul 22 01:03:22 2014 +0000
+++ b/sys/dev/pci/virtio.c      Tue Jul 22 01:55:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtio.c,v 1.5 2014/03/29 19:28:25 christos Exp $      */
+/*     $NetBSD: virtio.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $       */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.5 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -170,8 +170,14 @@
                virtio_set_status(sc, VIRTIO_CONFIG_DEVICE_STATUS_FAILED);
                return;
        }
+
        intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
+
+       if (sc->sc_flags & VIRTIO_F_PCI_INTR_MPSAFE)
+               pci_intr_setattr(pc, &ih, PCI_INTR_MPSAFE, true);
+
        sc->sc_ih = pci_intr_establish(pc, ih, sc->sc_ipl, virtio_intr, sc);
+
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
diff -r 813b2dfe5016 -r a4939de0aa8f sys/dev/pci/virtiovar.h
--- a/sys/dev/pci/virtiovar.h   Tue Jul 22 01:03:22 2014 +0000
+++ b/sys/dev/pci/virtiovar.h   Tue Jul 22 01:55:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtiovar.h,v 1.2 2013/12/06 02:39:58 yamt Exp $       */
+/*     $NetBSD: virtiovar.h,v 1.3 2014/07/22 01:55:54 ozaki-r Exp $    */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -127,6 +127,8 @@
        int                     sc_ipl; /* set by child */
        void                    *sc_ih;
 
+       int                     sc_flags; /* set by child */
+
        bus_space_tag_t         sc_iot;
        bus_space_handle_t      sc_ioh;
        bus_size_t              sc_iosize;
@@ -146,6 +148,8 @@
                                         /* set by child */
 };
 
+#define VIRTIO_F_PCI_INTR_MPSAFE       (1 << 0)
+
 /* public interface */
 uint32_t virtio_negotiate_features(struct virtio_softc*, uint32_t);
 



Home | Main Index | Thread Index | Old Index