On Fri, 6 May 2022 at 17:10, Paolo Bonzini <[email protected]> wrote: > > On 5/6/22 17:47, Peter Maydell wrote: > >> if (!vga_model && !default_vga) { > >> vga_interface_type = VGA_DEVICE; > >> + vga_interface_created = true; > >> } > >> if (!has_defaults || machine_class->no_serial) { > >> default_serial = 0; > > > > Can you explain why that's right? qemu_disable_default_devices() > > isn't creating any devices at all, so it's not clear to me > > (a) why it's setting vga_interface_type or (b) why setting > > vga_interface_created to true is OK. > > VGA_DEVICE means the device has been specified on the command line, but > the board should otherwise behave as if "-vga something" was there.
Oh, I see now -- qemu_disable_default_devices() does a preliminary scan through of every supplied -device option, looking to see if it has a driver=foo that matches some value in the default_list[] array; if it does then we set default_vga or whatever to false. (So effectively we have a hardcoded list of things we consider to be "VGA devices" for this purpose, which might or might not be the same as the set of actual VGA devices we support...) I guess this is all here for backwards compatibility purposes? I kind of expect that short options like '-vga' might have magic extra behaviour beyond "create a device", but having some devices that have magic "make the board behave differently" behaviour when they're created with '-device' is a bit unexpected to me. thanks -- PMM
