Re: [PATCH] Make virtio devices multi-function

Luca Tettamanti
2008-04-22T15:12:12Z

On Tue, Apr 22, 2008 at 4:15 PM, Anthony Liguori <aliguori@us.ibm.com> wrote:
> This patch changes virtio devices to be multi-function devices whenever
> possible. This increases the number of virtio devices we can support now by
> a factor of 8.
[...]
> diff --git a/qemu/hw/virtio.c b/qemu/hw/virtio.c
> index 9100bb1..9ea14d3 100644
> --- a/qemu/hw/virtio.c
> +++ b/qemu/hw/virtio.c
> @@ -405,9 +405,18 @@ VirtIODevice *virtio_init_pci(PCIBus *bus, const char *name,
> PCIDevice *pci_dev;
> uint8_t *config;
> uint32_t size;
> + static int devfn = 7;
> +
> + if ((devfn % 8) == 7)
> + devfn = -1;
> + else
> + devfn++;

This code look strange... devfn should be passed to virtio_init_pci by
virtio-{net,blk} init functions, no?

Luca