Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
virtio-pci: Correctly expose vector count for virtio-rng-pci
Browse files Browse the repository at this point in the history
The vector count should be  1 + the number of virtqueues which is one
for virtio-rng. The other PCI devices correctly define this property and
default value. This will then enable the use of MSI-X which prevents the
kernel from falling back to legacy interrupts which we do not support.

Signed-off-by: Rob Bradford <[email protected]>
  • Loading branch information
rbradford committed Mar 11, 2019
1 parent 4728f53 commit cf191a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/virtio/virtio-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,11 @@ static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
NULL);
}

static Property virtio_rng_pci_properties[] = {
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
DEFINE_PROP_END_OF_LIST(),
};

static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
Expand All @@ -2498,6 +2503,7 @@ static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)
k->realize = virtio_rng_pci_realize;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);

dc->props = virtio_rng_pci_properties;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_RNG;
pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
Expand Down

0 comments on commit cf191a1

Please sign in to comment.