summaryrefslogtreecommitdiff
path: root/usr/src/cmd/bhyve/virtio.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/bhyve/virtio.h')
-rw-r--r--usr/src/cmd/bhyve/virtio.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/usr/src/cmd/bhyve/virtio.h b/usr/src/cmd/bhyve/virtio.h
index a2c3362ec2..521bfac681 100644
--- a/usr/src/cmd/bhyve/virtio.h
+++ b/usr/src/cmd/bhyve/virtio.h
@@ -32,6 +32,7 @@
#define _VIRTIO_H_
#include <pthread_np.h>
+#include <machine/atomic.h>
/*
* These are derived from several virtio specifications.
@@ -463,6 +464,26 @@ vq_interrupt(struct virtio_softc *vs, struct vqueue_info *vq)
}
}
+static inline void
+vq_kick_enable(struct vqueue_info *vq)
+{
+
+ vq->vq_used->vu_flags &= ~VRING_USED_F_NO_NOTIFY;
+ /*
+ * Full memory barrier to make sure the store to vu_flags
+ * happens before the load from va_idx, which results from
+ * a subsequent call to vq_has_descs().
+ */
+ atomic_thread_fence_seq_cst();
+}
+
+static inline void
+vq_kick_disable(struct vqueue_info *vq)
+{
+
+ vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+}
+
struct iovec;
void vi_softc_linkup(struct virtio_softc *vs, struct virtio_consts *vc,
void *dev_softc, struct pci_devinst *pi,