mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
virtio: introduce vector to virtqueues mapping
Currently we will try to traverse all virtqueues to find a subset that using a specific vector. This is sub optimal when we will support hundreds or even thousands of virtqueues. So this patch introduces a method which could be used by transport to get all virtqueues that using a same vector. This is done through QLISTs and the number of QLISTs was queried through a transport specific method. When guest setting vectors, the virtqueue will be linked and helpers for traverse the list was also introduced. The first user will be virtio pci which will use this to speed up MSI-X masking and unmasking handling. Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-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
955cc8c954
commit
e0d686bf4b
4 changed files with 46 additions and 2 deletions
|
@ -908,6 +908,13 @@ static const TypeInfo virtio_9p_pci_info = {
|
|||
* virtio-pci: This is the PCIDevice which has a virtio-pci-bus.
|
||||
*/
|
||||
|
||||
static int virtio_pci_query_nvectors(DeviceState *d)
|
||||
{
|
||||
VirtIOPCIProxy *proxy = VIRTIO_PCI(d);
|
||||
|
||||
return proxy->nvectors;
|
||||
}
|
||||
|
||||
/* This is called by virtio-bus just after the device is plugged. */
|
||||
static void virtio_pci_device_plugged(DeviceState *d)
|
||||
{
|
||||
|
@ -1498,6 +1505,7 @@ static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
|
|||
k->vmstate_change = virtio_pci_vmstate_change;
|
||||
k->device_plugged = virtio_pci_device_plugged;
|
||||
k->device_unplugged = virtio_pci_device_unplugged;
|
||||
k->query_nvectors = virtio_pci_query_nvectors;
|
||||
}
|
||||
|
||||
static const TypeInfo virtio_pci_bus_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue