Module Name: src Committed By: martin Date: Sat May 13 10:56:10 UTC 2023
Modified Files: src/sys/dev/pci [netbsd-10]: if_vioif.c ld_virtio.c vio9p.c viomb.c viornd.c vioscsi.c virtio.c virtio_pci.c virtioreg.h virtiovar.h src/sys/dev/virtio [netbsd-10]: viocon.c virtio_mmio.c Log Message: Pull up following revision(s) (requested by yamaguchi in ticket #139): sys/dev/pci/vioscsi.c: revision 1.31 sys/dev/pci/vio9p.c: revision 1.10 sys/dev/pci/vioscsi.c: revision 1.32 sys/dev/pci/vio9p.c: revision 1.11 sys/dev/pci/vioscsi.c: revision 1.33 sys/dev/pci/ld_virtio.c: revision 1.31 sys/dev/virtio/viocon.c: revision 1.6 sys/dev/pci/vioscsi.c: revision 1.34 sys/dev/pci/ld_virtio.c: revision 1.32 sys/dev/virtio/viocon.c: revision 1.7 sys/dev/virtio/viocon.c: revision 1.8 sys/dev/pci/vioscsi.c: revision 1.36 sys/dev/pci/virtioreg.h: revision 1.12 sys/dev/pci/viornd.c: revision 1.19 sys/dev/pci/virtio.c: revision 1.66 sys/dev/pci/virtio.c: revision 1.67 sys/dev/pci/virtio.c: revision 1.68 sys/dev/pci/if_vioif.c: revision 1.103 sys/dev/pci/virtio.c: revision 1.69 sys/dev/pci/if_vioif.c: revision 1.104 sys/dev/pci/virtio_pci.c: revision 1.40 sys/dev/virtio/virtio_mmio.c: revision 1.8 sys/dev/virtio/virtio_mmio.c: revision 1.9 sys/dev/pci/viomb.c: revision 1.14 sys/dev/pci/viomb.c: revision 1.15 sys/dev/pci/viomb.c: revision 1.17 sys/dev/pci/viornd.c: revision 1.20 sys/dev/pci/viornd.c: revision 1.21 sys/dev/pci/virtiovar.h: revision 1.25 sys/dev/pci/virtiovar.h: revision 1.26 sys/dev/pci/virtiovar.h: revision 1.27 sys/dev/pci/virtiovar.h: revision 1.28 sys/dev/pci/virtio.c: revision 1.70 sys/dev/pci/virtio.c: revision 1.71 sys/dev/pci/virtio.c: revision 1.72 sys/dev/pci/virtio.c: revision 1.73 sys/dev/pci/virtio.c: revision 1.74 sys/dev/pci/virtio_pci.c: revision 1.39 Set virtqueues in virtio_child_attach_finish The number of virtqueue maybe change in a part of VirtIO devices (e.g. vioif(4)). And it is fixed after negotiation of features. So the configuration is moved into the function. viocon(4): fix not to allocate unused virtqueue viocon(4) allocates 4 virtqueues but it only uses 2 (0 and 1) queues. Added functions to set interrupt handler and index into virtqueue Added check of pointer for allocated memory before release of resource Setup virtqueues after registering them to virtio_softc restore fetch of qsize. Mark as MPSAFE. virtio(4): Avoid name collision with global intrhand on sparc64. Pacifies -Werror=shadow. No functional change intended. Use PRIuBUSSIZE to print bus_size_t variables. virtio(4): Fix sizing of virtqueue allocation. vq->vq_avail[0].ring is a zero-length array, and thus sizeof is zero; likewise vq->vq_used[0].ring. Use vq->vq_avail[0].ring[0] and vq->vq_used[0].ring[0] to fix this and restore the previous allocation sizing logic. XXX We shouldn't use zero-length arrays here -- they are asking for trouble like this, and C99 has a standard way to express what we're actually trying to get at it, flexible array members. PR kern/57304 virtio(4): Use flexible array members, not zero-length arrays. This enables the compiler to detect sizeof mistakes like PR kern/57304. Use descriptor chain for free slots instead of vq_entry list Descriptors can be chained by themself. And descriptors added to avail ring or used ring are already chained. But it was not used for unused descriptors and another linked list structure named vq_entry was used. The chain is also used for unused descriptors to make virtio(4) simpler. Added flags to store status of attaching a virtio device This prevents a panic on reboot after a virtio device had called virtio_child_attach_failed(). Fix wrong variable names This fixes build errors in virtio_mmio.c To generate a diff of this commit: cvs rdiff -u -r1.82.4.2 -r1.82.4.3 src/sys/dev/pci/if_vioif.c cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/dev/pci/ld_virtio.c cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/dev/pci/vio9p.c cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/dev/pci/viomb.c cvs rdiff -u -r1.18 -r1.18.4.1 src/sys/dev/pci/viornd.c cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/dev/pci/vioscsi.c cvs rdiff -u -r1.63.2.3 -r1.63.2.4 src/sys/dev/pci/virtio.c cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/dev/pci/virtio_pci.c cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/dev/pci/virtioreg.h cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/dev/pci/virtiovar.h cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/dev/virtio/viocon.c cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/dev/virtio/virtio_mmio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.