On 11/12/2012 06:57 AM, Will Deacon wrote: > PCI devices are currently registered into the pci_devices array via the > pci__register function, which can then be indexed later by architecture > code to construct device tree nodes. For MMIO devices, there is no such > utility. > > Rather than invent a similar mechanism for MMIO, this patch creates a > global device registration mechanism, which allows the device type to be > specified when registered or indexing a device. Current users of the pci > registration code are migrated to the new infrastructure and virtio MMIO > devices are registered at init time. > > Signed-off-by: Will Deacon <will.deacon@xxxxxxx> > --- > tools/kvm/Makefile | 1 + > tools/kvm/devices.c | 24 +++++++++++++++++++++ > tools/kvm/hw/pci-shmem.c | 8 ++++++- > tools/kvm/hw/vesa.c | 8 ++++++- > tools/kvm/include/kvm/devices.h | 21 ++++++++++++++++++ > tools/kvm/include/kvm/pci.h | 2 - > tools/kvm/include/kvm/virtio-mmio.h | 1 + > tools/kvm/include/kvm/virtio-pci.h | 2 + > tools/kvm/pci.c | 40 ++++++++++++---------------------- > tools/kvm/powerpc/irq.c | 3 +- > tools/kvm/powerpc/spapr_pci.c | 2 +- > tools/kvm/virtio/mmio.c | 7 ++++++ > tools/kvm/virtio/pci.c | 7 +++++- > 13 files changed, 93 insertions(+), 33 deletions(-) > create mode 100644 tools/kvm/devices.c > create mode 100644 tools/kvm/include/kvm/devices.h > > diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile > index c105de1..5da416f 100644 > --- a/tools/kvm/Makefile > +++ b/tools/kvm/Makefile > @@ -50,6 +50,7 @@ OBJS += builtin-run.o > OBJS += builtin-setup.o > OBJS += builtin-stop.o > OBJS += builtin-version.o > +OBJS += devices.o > OBJS += disk/core.o > OBJS += framebuffer.o > OBJS += guest_compat.o > diff --git a/tools/kvm/devices.c b/tools/kvm/devices.c > new file mode 100644 > index 0000000..f9666b9 > --- /dev/null > +++ b/tools/kvm/devices.c > @@ -0,0 +1,24 @@ > +#include "kvm/devices.h" > +#include "kvm/kvm.h" > + > +#include <linux/err.h> > + > +static struct device_header *devices[KVM_MAX_DEVICES]; Does it really have a hard limit at KVM_MAX_DEVICES? Or can we turn it into something more dynamic (list/tree/whatever)? Thanks, Sasha -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html