Skip to content

Commit

Permalink
virtio: hookup irq_get_affinity callback
Browse files Browse the repository at this point in the history
struct bus_type has a new callback for retrieving the IRQ affinity for a
device. Hook this callback up for virtio based devices.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Daniel Wagner <wagi@kernel.org>
Link: https://lore.kernel.org/r/20241202-refactor-blk-affinity-helpers-v6-3-27211e9c2cd5@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Daniel Wagner authored and Jens Axboe committed Dec 23, 2024
1 parent 22d813b commit c7f63c5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/virtio/virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,32 @@ static void virtio_dev_remove(struct device *_d)
of_node_put(dev->dev.of_node);
}

/*
* virtio_irq_get_affinity - get IRQ affinity mask for device
* @_d: ptr to dev structure
* @irq_vec: interrupt vector number
*
* Return the CPU affinity mask for @_d and @irq_vec.
*/
static const struct cpumask *virtio_irq_get_affinity(struct device *_d,
unsigned int irq_vec)
{
struct virtio_device *dev = dev_to_virtio(_d);

if (!dev->config->get_vq_affinity)
return NULL;

return dev->config->get_vq_affinity(dev, irq_vec);
}

static const struct bus_type virtio_bus = {
.name = "virtio",
.match = virtio_dev_match,
.dev_groups = virtio_dev_groups,
.uevent = virtio_uevent,
.probe = virtio_dev_probe,
.remove = virtio_dev_remove,
.irq_get_affinity = virtio_irq_get_affinity,
};

int __register_virtio_driver(struct virtio_driver *driver, struct module *owner)
Expand Down

0 comments on commit c7f63c5

Please sign in to comment.