sync code with last fixes and improvements from OpenBSD

This commit is contained in:
purplerain 2023-06-07 21:20:56 +00:00
parent 4b78db449c
commit bf0676207f
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
2406 changed files with 6353 additions and 434004 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_vio.c,v 1.22 2022/03/07 18:52:16 dv Exp $ */
/* $OpenBSD: if_vio.c,v 1.23 2023/05/29 08:13:35 sf Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
@ -600,6 +600,7 @@ vio_attach(struct device *parent, struct device *self, void *aux)
timeout_set(&sc->sc_txtick, vio_txtick, &sc->sc_vq[VQTX]);
timeout_set(&sc->sc_rxtick, vio_rxtick, &sc->sc_vq[VQRX]);
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
if_attach(ifp);
ether_ifattach(ifp);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vioblk.c,v 1.35 2022/04/16 19:19:59 naddy Exp $ */
/* $OpenBSD: vioblk.c,v 1.36 2023/05/29 08:13:35 sf Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch.
@ -251,6 +251,7 @@ vioblk_attach(struct device *parent, struct device *self, void *aux)
saa.saa_quirks = 0;
saa.saa_wwpn = saa.saa_wwnn = 0;
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
config_found(self, &saa, scsiprint);
return;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: viocon.c,v 1.8 2021/11/05 11:38:29 mpi Exp $ */
/* $OpenBSD: viocon.c,v 1.9 2023/05/29 08:13:35 sf Exp $ */
/*
* Copyright (c) 2013-2015 Stefan Fritsch <sf@sfritsch.de>
@ -203,6 +203,7 @@ viocon_attach(struct device *parent, struct device *self, void *aux)
goto err;
}
viocon_rx_fill(sc->sc_ports[0]);
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
return;
err:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: viogpu.c,v 1.2 2023/04/23 10:29:35 patrick Exp $ */
/* $OpenBSD: viogpu.c,v 1.3 2023/05/29 08:13:35 sf Exp $ */
/*
* Copyright (c) 2021-2023 joshua stein <jcs@openbsd.org>
@ -235,6 +235,8 @@ viogpu_attach(struct device *parent, struct device *self, void *aux)
sc->sc_fb_dma_kva, sc->sc_fb_dma_size, NULL, BUS_DMA_NOWAIT) != 0)
goto fb_unmap;
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
if (viogpu_create_2d(sc, 1, sc->sc_fb_width, sc->sc_fb_height) != 0)
goto fb_unmap;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: viomb.c,v 1.8 2021/11/05 11:38:29 mpi Exp $ */
/* $OpenBSD: viomb.c,v 1.9 2023/05/29 08:13:35 sf Exp $ */
/* $NetBSD: viomb.c,v 1.1 2011/10/30 12:12:21 hannken Exp $ */
/*
@ -220,6 +220,7 @@ viomb_attach(struct device *parent, struct device *self, void *aux)
sensordev_install(&sc->sc_sensdev);
printf("\n");
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
return;
err_dmamap:
bus_dmamap_destroy(vsc->sc_dmat, sc->sc_req.bl_dmamap);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: viornd.c,v 1.5 2021/11/05 11:38:29 mpi Exp $ */
/* $OpenBSD: viornd.c,v 1.6 2023/05/29 08:13:35 sf Exp $ */
/*
* Copyright (c) 2014 Stefan Fritsch <sf@sfritsch.de>
@ -138,6 +138,7 @@ viornd_attach(struct device *parent, struct device *self, void *aux)
timeout_add(&sc->sc_tick, 1);
printf("\n");
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
return;
err2:
bus_dmamap_destroy(vsc->sc_dmat, sc->sc_dmamap);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vioscsi.c,v 1.31 2023/04/27 13:52:58 krw Exp $ */
/* $OpenBSD: vioscsi.c,v 1.32 2023/05/29 08:13:35 sf Exp $ */
/*
* Copyright (c) 2013 Google Inc.
*
@ -166,6 +166,7 @@ vioscsi_attach(struct device *parent, struct device *self, void *aux)
saa.saa_quirks = saa.saa_flags = 0;
saa.saa_wwpn = saa.saa_wwnn = 0;
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
config_found(self, &saa, scsiprint);
return;
@ -296,6 +297,7 @@ vioscsi_req_done(struct vioscsi_softc *sc, struct virtio_softc *vsc,
struct scsi_xfer *xs = vr->vr_xs;
DPRINTF("vioscsi_req_done: enter vr: %p xs: %p\n", vr, xs);
int isread = !!(xs->flags & SCSI_DATA_IN);
bus_dmamap_sync(vsc->sc_dmat, vr->vr_control,
offsetof(struct vioscsi_req, vr_req),
sizeof(struct virtio_scsi_req_hdr),
@ -304,18 +306,6 @@ vioscsi_req_done(struct vioscsi_softc *sc, struct virtio_softc *vsc,
offsetof(struct vioscsi_req, vr_res),
sizeof(struct virtio_scsi_res_hdr),
BUS_DMASYNC_POSTREAD);
/*
* XXX Should be impossible but somehow happens on Oracle Cloud and
* particular QEMU configurations.
*
* Stop the crashing while investigation into
* the apparent queuing/dequeuing issue proceeds.
*/
if (xs == NULL)
return;
int isread = !!(xs->flags & SCSI_DATA_IN);
if (xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
bus_dmamap_sync(vsc->sc_dmat, vr->vr_data, 0, xs->datalen,
isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmmci.c,v 1.9 2021/11/05 11:38:29 mpi Exp $ */
/* $OpenBSD: vmmci.c,v 1.10 2023/05/29 08:13:35 sf Exp $ */
/*
* Copyright (c) 2017 Reyk Floeter <reyk@openbsd.org>
@ -120,6 +120,7 @@ vmmci_attach(struct device *parent, struct device *self, void *aux)
}
printf("\n");
virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
}
int