Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb5e31d9 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Michael S. Tsirkin
Browse files

virtio: allow drivers to request IRQ affinity when creating VQs



Add a struct irq_affinity pointer to the find_vqs methods, which if set
is used to tell the PCI layer to create the MSI-X vectors for our I/O
virtqueues with the proper affinity from the start.  Compared to after
the fact affinity hints this gives us an instantly working setup and
allows to allocate the irq descritors node-local and avoid interconnect
traffic.  Last but not least this will allow blk-mq queues are created
based on the interrupt affinity for storage drivers.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 52a61516
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -411,7 +411,8 @@ static int init_vq(struct virtio_blk *vblk)
	}

	/* Discover virtqueues and write information to configuration.  */
	err = vdev->config->find_vqs(vdev, num_vqs, vqs, callbacks, names);
	err = vdev->config->find_vqs(vdev, num_vqs, vqs, callbacks, names,
			NULL);
	if (err)
		goto out;

+1 −1
Original line number Diff line number Diff line
@@ -1939,7 +1939,7 @@ static int init_vqs(struct ports_device *portdev)
	/* Find the queues. */
	err = portdev->vdev->config->find_vqs(portdev->vdev, nr_queues, vqs,
					      io_callbacks,
					      (const char **)io_names);
					      (const char **)io_names, NULL);
	if (err)
		goto free;

+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
	}

	ret = vi->vdev->config->find_vqs(vi->vdev, total_vqs, vqs, callbacks,
					 names);
					 names, NULL);
	if (ret)
		goto err_find;

+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags)
		 vgdev->has_virgl_3d ? "enabled" : "not available");

	ret = vgdev->vdev->config->find_vqs(vgdev->vdev, 2, vqs,
					    callbacks, names);
					    callbacks, names, NULL);
	if (ret) {
		DRM_ERROR("failed to find virt queues\n");
		goto err_vqs;
+1 −1
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev,
static int vop_find_vqs(struct virtio_device *dev, unsigned nvqs,
			struct virtqueue *vqs[],
			vq_callback_t *callbacks[],
			const char * const names[])
			const char * const names[], struct irq_affinity *desc)
{
	struct _vop_vdev *vdev = to_vopvdev(dev);
	struct vop_device *vpdev = vdev->vpdev;
Loading