mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
virtio-balloon-pci: Allow setting nvectors, so we can use MSI-X
Most virtio-pci devices allow MSI-X. Add it to virtio-balloon-pci, but only enable it in new machine types, so we don't break migration of existing machine types between different qemu versions. This copies what was done for virtio-rng-pci in:9ea02e8f13
("virtio-rng-pci: Allow setting nvectors, so we can use MSI-X")bad9c5a516
("virtio-rng-pci: fix migration compat for vectors")62bdb88715
("virtio-rng-pci: fix transitional migration compat for vectors") Acked-by: David Hildenbrand <david@redhat.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Tested-by: Mario Casquero <mcasquer@redhat.com> Message-ID: <20250115161425.246348-1-arbab@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
a4cda3f5df
commit
fe638ae67b
2 changed files with 15 additions and 0 deletions
|
@ -35,11 +35,22 @@ struct VirtIOBalloonPCI {
|
|||
VirtIOBalloon vdev;
|
||||
};
|
||||
|
||||
static const Property virtio_balloon_properties[] = {
|
||||
DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
|
||||
VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
|
||||
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
|
||||
DEV_NVECTORS_UNSPECIFIED),
|
||||
};
|
||||
|
||||
static void virtio_balloon_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
|
||||
{
|
||||
VirtIOBalloonPCI *dev = VIRTIO_BALLOON_PCI(vpci_dev);
|
||||
DeviceState *vdev = DEVICE(&dev->vdev);
|
||||
|
||||
if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) {
|
||||
vpci_dev->nvectors = 2;
|
||||
}
|
||||
|
||||
vpci_dev->class_code = PCI_CLASS_OTHERS;
|
||||
qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
|
||||
}
|
||||
|
@ -55,6 +66,7 @@ static void virtio_balloon_pci_class_init(ObjectClass *klass, void *data)
|
|||
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_BALLOON;
|
||||
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
|
||||
pcidev_k->class_id = PCI_CLASS_OTHERS;
|
||||
device_class_set_props(dc, virtio_balloon_properties);
|
||||
}
|
||||
|
||||
static void virtio_balloon_pci_instance_init(Object *obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue