mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
To support configure interrupt for vhost-vdpa Introduce VIRTIO_CONFIG_IRQ_IDX -1 as configure interrupt's queue index, Then we can reuse the functions guest_notifier_mask and guest_notifier_pending. Add the check of queue index in these drivers, if the driver does not support configure interrupt, the function will just return Signed-off-by: Cindy Lu <lulu@redhat.com> Message-Id: <20221222070451.936503-2-lulu@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
c9bdc449f9
commit
544f0278af
7 changed files with 105 additions and 2 deletions
|
@ -3325,6 +3325,15 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
|
|||
} else {
|
||||
nc = qemu_get_subqueue(n->nic, vq2q(idx));
|
||||
}
|
||||
/*
|
||||
* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
|
||||
* as the Marco of configure interrupt's IDX, If this driver does not
|
||||
* support, the function will return false
|
||||
*/
|
||||
|
||||
if (idx == VIRTIO_CONFIG_IRQ_IDX) {
|
||||
return false;
|
||||
}
|
||||
return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
|
||||
}
|
||||
|
||||
|
@ -3348,8 +3357,17 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
|
|||
} else {
|
||||
nc = qemu_get_subqueue(n->nic, vq2q(idx));
|
||||
}
|
||||
vhost_net_virtqueue_mask(get_vhost_net(nc->peer),
|
||||
vdev, idx, mask);
|
||||
/*
|
||||
*Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
|
||||
* as the Marco of configure interrupt's IDX, If this driver does not
|
||||
* support, the function will return
|
||||
*/
|
||||
|
||||
if (idx == VIRTIO_CONFIG_IRQ_IDX) {
|
||||
return;
|
||||
}
|
||||
|
||||
vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
|
||||
}
|
||||
|
||||
static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue