On Tue, Feb 02, 2010 at 10:15:24AM +0100, Matthias Bolte wrote: > 2010/2/1 Daniel P. Berrange <berrange@xxxxxxxxxx>: > > The current QEMU code allocates PCI addresses incrementally starting > > at 4. This is not satisfactory because the user may have given some > > addresses in their XML config, which need to be skipped over when > > allocating addresses to remaining devices. > > > > It is thus neccessary to maintain a list of already allocated PCI > > addresses and then only allocate ones that remain unused. This is > > also required for domain device hotplug to work properly later. > > > > * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add APIs for creating > > list of existing PCI addresses, and allocating new addresses. > > Refactor address assignment to use this code > > * src/qemu/qemu_driver.c: Pull PCI address assignment up into the > > qemuStartVMDaemon() method, as a prelude to moving it into the > > 'define' method. Update list of allocated addresses when connecting > > to a running VM at daemon startup. > > * tests/qemuxml2argvtest.c, tests/qemuargv2xmltest.c, > > tests/qemuxml2xmltest.c: Remove USB product test since all > > passthrough is done based on address > > * tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args, > > tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml: Kil > > unused data files > > --- > > > diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c > > index bbf49fd..9bfd181 100644 > > --- a/src/qemu/qemu_conf.c > > +++ b/src/qemu/qemu_conf.c > > > + > > +void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs) > > +{ > > + if (!addrs) > > + return; > > + > > + virHashFree(addrs->used, qemuDomainPCIAddressSetFreeEntry); > > Maybe add addrs->used = NULL after virHashFree to prevent potential > double frees or segfaults due to the dangling pointer. Yep, added that too Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list