Source-Changes-HG archive

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

[src/trunk]: src/sys/dev <sys/pmc.h> is gone; dont



details:   https://anonhg.NetBSD.org/src/rev/e770779e083d
branches:  trunk
changeset: 833785:e770779e083d
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Thu Jul 12 12:48:50 2018 +0000

description:
<sys/pmc.h> is gone; dont

diffstat:

 sys/dev/pci/ld_virtio.c     |  33 +++++++++++++++++++++++++++++----
 sys/dev/virtio/files.virtio |   7 ++++++-
 2 files changed, 35 insertions(+), 5 deletions(-)

diffs (98 lines):

diff -r 9c49dd11ea23 -r e770779e083d sys/dev/pci/ld_virtio.c
--- a/sys/dev/pci/ld_virtio.c   Thu Jul 12 12:48:49 2018 +0000
+++ b/sys/dev/pci/ld_virtio.c   Thu Jul 12 12:48:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_virtio.c,v 1.23 2018/06/21 16:47:06 jakllsch Exp $  */
+/*     $NetBSD: ld_virtio.c,v 1.24 2018/07/12 12:48:50 jakllsch Exp $  */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.23 2018/06/21 16:47:06 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.24 2018/07/12 12:48:50 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -38,6 +38,7 @@
 #include <sys/disk.h>
 #include <sys/mutex.h>
 #include <sys/module.h>
+#include <sys/sysctl.h>
 
 #include <dev/ldvar.h>
 #include <dev/pci/virtioreg.h>
@@ -144,6 +145,25 @@
        uint8_t                 sc_sync_status;
 };
 
+int ld_virtio_notify_threshold = 0;
+
+static void
+setup_sysctl(void)
+{
+       static bool done;
+
+       if (done)
+               return;
+
+       done = true;
+
+       sysctl_createv(NULL, 0, NULL, NULL,
+           CTLFLAG_READWRITE, CTLTYPE_INT, "ld_virtio_notify_threshold",
+           SYSCTL_DESCR(""),
+           NULL, 0, &ld_virtio_notify_threshold, 0,
+           CTL_HW, CTL_CREATE, CTL_EOL);
+}
+
 static int     ld_virtio_match(device_t, cfdata_t, void *);
 static void    ld_virtio_attach(device_t, device_t, void *);
 static int     ld_virtio_detach(device_t, int);
@@ -276,7 +296,7 @@
        sc->sc_virtio = vsc;
 
        virtio_child_attach_start(vsc, self, IPL_BIO, &sc->sc_vq,
-           NULL, virtio_vq_intr, 0,
+           NULL, virtio_vq_intr, VIRTIO_F_PCI_INTR_MPSAFE|VIRTIO_F_PCI_INTR_MSIX,
            (VIRTIO_BLK_F_SIZE_MAX | VIRTIO_BLK_F_SEG_MAX |
             VIRTIO_BLK_F_GEOMETRY | VIRTIO_BLK_F_RO | VIRTIO_BLK_F_BLK_SIZE |
             VIRTIO_BLK_F_FLUSH | VIRTIO_BLK_F_CONFIG_WCE),
@@ -369,6 +389,8 @@
        ld->sc_flags = LDF_ENABLED | LDF_MPSAFE;
        ldattach(ld, BUFQ_DISK_DEFAULT_STRAT);
 
+       setup_sysctl();
+
        return;
 
 err:
@@ -441,7 +463,10 @@
                         offsetof(struct virtio_blk_req, vr_status),
                         sizeof(uint8_t),
                         false);
-       virtio_enqueue_commit(vsc, vq, slot, true);
+       const bool notify = !dk_strategy_pending(&sc->sc_ld.sc_dksc) ||
+           sc->sc_ld.sc_queuecnt + 1 >= sc->sc_ld.sc_maxqueuecnt ||
+           sc->sc_ld.sc_queuecnt + 1 >= (sc->sc_ld.sc_maxqueuecnt * ld_virtio_notify_threshold / 1000);
+       virtio_enqueue_commit(vsc, vq, slot, notify);
 
        return 0;
 }
diff -r 9c49dd11ea23 -r e770779e083d sys/dev/virtio/files.virtio
--- a/sys/dev/virtio/files.virtio       Thu Jul 12 12:48:49 2018 +0000
+++ b/sys/dev/virtio/files.virtio       Thu Jul 12 12:48:50 2018 +0000
@@ -1,6 +1,11 @@
-#      $NetBSD: files.virtio,v 1.2 2018/06/06 20:35:36 jakllsch Exp $
+#      $NetBSD: files.virtio,v 1.3 2018/07/12 12:48:50 jakllsch Exp $
 
 # XXX the contents of the following included file should be moved here
 include "dev/pci/files.virtio"
 
 file   dev/virtio/virtio_mmio.c        virtio_mmio
+
+device viocon
+attach viocon at virtio
+file   dev/virtio/viocon.c             viocon  needs-flag
+



Home | Main Index | Thread Index | Old Index