[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Functions bus_foreach and device_find from libq
From: |
Marc Marí |
Subject: |
Re: [Qemu-devel] [PATCH] Functions bus_foreach and device_find from libqos virtio API |
Date: |
Thu, 26 Jun 2014 17:27:35 +0200 |
El Thu, 26 Jun 2014 17:09:12 +0200
Paolo Bonzini <address@hidden> escribió:
> Il 26/06/2014 16:34, Marc Marí ha scritto:
> > +static void qvirtio_pci_foreach(uint16_t device_type,
> > + void (*func)(QVirtioDevice *d, void *data), void
> > *data) +{
> > + QVirtioPCIForeachData d = { .func = func,
> > + .device_type = device_type,
> > + .user_data = data };
> > +
> > + if (!bus) {
> > + bus = qpci_init_pc();
>
> Why not pass this as an argument? .bus_foreach and .device_find need
> not be part of QVirtioBus.
If these functions are just Virtio PCI specific, it makes sense to take
them out. If they are common to other transports, in my opinion is
better to leave them there. Of course, a good solution has to be found
to just having a global bus variable.
It is also interesting to see that the current
implementation of qpci_device_foreach does only work in one bus, so
probably is not so terrible to have it as global and unique.
After reading Virtio specs about MMIO and CCW transports, I understand
that in MMIO you somehow choose an address to map the device, and in
CCW there is a device discovery mechanism, so probably in CCW is
interesting to have those functions.
Marc