summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2024-08-13 08:47:29 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2024-08-13 08:47:29 +0000
commit0eeb5c3116e91673232d5ee38ae5b920ed253209 (patch)
tree48fc57274657203118f27b12fa162adcfcb35fb5
parenta9bf5562ceffe40a93f2a504f62e3701382d5a6d (diff)
Sync full virtqueue on device reset
We initialize the whole virtqueue and must make sure that the device sees this even for the areas that are normally only written by the device. Otherwise there may be an assertion fail during ifconfig up, as found by bluhm@ with hshoexer@'s bounce buffer diff. OK bluhm@
-rw-r--r--sys/dev/pv/virtio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/pv/virtio.c b/sys/dev/pv/virtio.c
index 4c834b67d82..51725029fa8 100644
--- a/sys/dev/pv/virtio.c
+++ b/sys/dev/pv/virtio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtio.c,v 1.29 2024/08/01 11:13:19 sf Exp $ */
+/* $OpenBSD: virtio.c,v 1.30 2024/08/13 08:47:28 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
@@ -311,10 +311,11 @@ virtio_init_vq(struct virtio_softc *sc, struct virtqueue *vq)
vq->vq_entries[i].qe_index = i;
}
+ bus_dmamap_sync(sc->sc_dmat, vq->vq_dmamap, 0, vq->vq_bytesize,
+ BUS_DMASYNC_PREWRITE);
/* enqueue/dequeue status */
vq->vq_avail_idx = 0;
vq->vq_used_idx = 0;
- vq_sync_aring(sc, vq, BUS_DMASYNC_PREWRITE);
vq_sync_uring(sc, vq, BUS_DMASYNC_PREREAD);
vq->vq_queued = 1;
}