From 657921cb7a3fc7a744a44e9ca1ecc60c76c24669 Mon Sep 17 00:00:00 2001 From: sf Date: Tue, 13 Aug 2024 08:47:28 +0000 Subject: [PATCH] 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@ --- sys/dev/pv/virtio.c | 5 +++-- 1 file 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; } -- 2.20.1