From faaf4baa23be358c1e101da9d93cb8f50dfdfdbe Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Mon, 2 Sep 2024 08:26:27 +0000 Subject: virtio: Move interrupt setup into separate function Put the MSIX vector into struct virtqueue and create a transport specific function that feeds the vectors to the device. This will allow child devices to influence which vectors are used for which virtqueues. This will be used by multi-queue vio(4) to route corresponding rx/tx queue interrupts to the same cpu. The setup_intrs() function also sets the config interrupt MSIX vector which fixes a bug that virtio_pci_set_msix_config_vector() would not be called after a device reset. OK bluhm@ --- sys/dev/fdt/virtio_mmio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/dev/fdt') diff --git a/sys/dev/fdt/virtio_mmio.c b/sys/dev/fdt/virtio_mmio.c index 212614f98ff..604ffcab570 100644 --- a/sys/dev/fdt/virtio_mmio.c +++ b/sys/dev/fdt/virtio_mmio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio_mmio.c,v 1.16 2024/08/27 19:01:11 sf Exp $ */ +/* $OpenBSD: virtio_mmio.c,v 1.17 2024/09/02 08:26:26 sf Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -97,6 +97,7 @@ void virtio_mmio_write_device_config_4(struct virtio_softc *, int, uint32_t); void virtio_mmio_write_device_config_8(struct virtio_softc *, int, uint64_t); uint16_t virtio_mmio_read_queue_size(struct virtio_softc *, uint16_t); void virtio_mmio_setup_queue(struct virtio_softc *, struct virtqueue *, uint64_t); +void virtio_mmio_setup_intrs(struct virtio_softc *); int virtio_mmio_get_status(struct virtio_softc *); void virtio_mmio_set_status(struct virtio_softc *, int); int virtio_mmio_negotiate_features(struct virtio_softc *, @@ -145,6 +146,7 @@ const struct virtio_ops virtio_mmio_ops = { virtio_mmio_write_device_config_8, virtio_mmio_read_queue_size, virtio_mmio_setup_queue, + virtio_mmio_setup_intrs, virtio_mmio_get_status, virtio_mmio_set_status, virtio_mmio_negotiate_features, @@ -196,6 +198,11 @@ virtio_mmio_setup_queue(struct virtio_softc *vsc, struct virtqueue *vq, } } +void +virtio_mmio_setup_intrs(struct virtio_softc *vsc) +{ +} + int virtio_mmio_get_status(struct virtio_softc *vsc) { -- cgit v1.2.3