On Wed, Feb 2, 2011 at 7:55 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 02/01/2011 07:10 PM, Blue Swirl wrote: >> >> One way to solve this which would preserve the device model would be >> to add stub devices. For example, hw/vmmouse-stub.c would be: >> void *vmmouse_init(void *m) >> { >> return NULL; >> } > > This is the wrong direction, unless you can somehow automatically generate > the stub file. > > The only other solution I can think of is weak symbols. There are subtle > differences between Windows and Linux weak symbols, but luckily we do not > care about it. See http://cygwin.com/ml/cygwin/2010-04/msg00281.html
Boards should create optional devices so that failure in the device creation is handled more intelligently. For example, pci_vmsvga_init() is just a wrapper (a bit useless one also) to pci_create_simple(bus, -1, "vmware-svga"). pci_create_simple() in turn uses qdev_init_nofail() which aborts if the device can't be created. Instead, non-aborting version should be used so that if 'vmware-svga' device can't be initialized, a fallback device (VGA) could be used or error message printed. In this case, vmmouse and vmport are not converted to qdev but that should be done anyway.