On Wed, 26 May 2010, Gerd Hoffmann wrote: > On 05/26/10 12:59, Stefano Stabellini wrote: > > On Wed, 26 May 2010, Gerd Hoffmann wrote: > >> Try to pci hotplug a vga card, watch qemu die with hw_error(). > >> This patch fixes it. > >> > > > > Do you know the reason why we get hw_error()? > > Because the card tries to register the legacy vga ports which are > already taken by the primary card. I also don't know whenever you can > pci hot-plug hardware which uses non-pci ressources at all. > > > Theoretically vga hotplug should be possible at least for secondary > > graphic cards (even though I suspect most operating systems wouldn't > > cope). > > Yes. Assuming the virtual hardware in question can actually act as > secondary, i.e. is fully programmable without the legacy vga ports. The > standard vga can't. The cirrus looks doable, at least you can access > the vga ports using the mmio bar. I see, good point.
I guess the right fix here would be to return -1 in the stdvga case but continue in the cirrus case and avoid registering the vga ioports when used as secondary adapter.