A global boolean variable "vga_interface_created"(declared in softmmu/globals.c)
has been used to track the creation of vga interface. If the vga flag is passed
in the command line "default_vga"(declared in softmmu/vl.c) variable is set to 0.
To warn user, the condition checks if vga_interface_created is false
and default_vga is equal to 0. If "-vga none" is passed, this patch will not warn the
user regarding the creation of VGA device.
The warning "A -vga option was passed but this
machine type does not use that option; no VGA device has been created"
is logged if vga flag is passed but no vga device is created.
This patch has been tested for x86_64, i386, sparc, sparc64 and arm boards.
Signed-off-by: Gautam Agrawal <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/581
Message-Id: <
20220501122505[email protected]>
[thuth: Fix wrong warning with "-device" in some cases as reported by Paolo]
Signed-off-by: Thomas Huth <[email protected]>
/* Graphics setup. */
if (machine->enable_graphics && vga_interface_type != VGA_NONE) {
+ vga_interface_created = true;
dev = qdev_new("artist");
s = SYS_BUS_DEVICE(dev);
sysbus_realize_and_unref(s, &error_fatal);
ISADevice *isa_vga_init(ISABus *bus)
{
+ vga_interface_created = true;
switch (vga_interface_type) {
case VGA_CIRRUS:
return isa_create_simple(bus, "isa-cirrus-vga");
/* GPU */
if (vga_interface_type != VGA_NONE) {
+ vga_interface_created = true;
pci_dev = pci_new(-1, "ati-vga");
dev = DEVICE(pci_dev);
qdev_prop_set_uint32(dev, "vgamem_mb", 16);
PCIDevice *pci_vga_init(PCIBus *bus)
{
+ vga_interface_created = true;
switch (vga_interface_type) {
case VGA_CIRRUS:
return pci_create_simple(bus, -1, "cirrus-vga");
/* Returns whether we want to use VGA or not */
static bool spapr_vga_init(PCIBus *pci_bus, Error **errp)
{
+ vga_interface_created = true;
switch (vga_interface_type) {
case VGA_NONE:
return false;
/* sbus irq 5 */
cg3_init(hwdef->tcx_base, slavio_irq[11], 0x00100000,
graphic_width, graphic_height, graphic_depth);
+ vga_interface_created = true;
} else {
/* If no display specified, default to TCX */
if (graphic_depth != 8 && graphic_depth != 24) {
tcx_init(hwdef->tcx_base, slavio_irq[11], 0x00100000,
graphic_width, graphic_height, graphic_depth);
+ vga_interface_created = true;
}
}
switch (vga_interface_type) {
case VGA_STD:
pci_create_simple(pci_busA, PCI_DEVFN(2, 0), "VGA");
+ vga_interface_created = true;
break;
case VGA_NONE:
break;
if (vga_interface_type == VGA_XENFB) {
xen_config_dev_vfb(0, "vnc");
xen_config_dev_vkbd(0);
+ vga_interface_created = true;
}
/* configure disks */
} VGAInterfaceType;
extern int vga_interface_type;
+extern bool vga_interface_created;
extern int graphic_width;
extern int graphic_height;
NICInfo nd_table[MAX_NICS];
int autostart = 1;
int vga_interface_type = VGA_NONE;
+bool vga_interface_created;
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
int win2k_install_hack;
int singlestep;
if (!vga_model && !default_vga) {
vga_interface_type = VGA_DEVICE;
+ vga_interface_created = true;
}
if (!has_defaults || machine_class->no_serial) {
default_serial = 0;
if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
exit(1);
}
+ if (!vga_interface_created && !default_vga &&
+ vga_interface_type != VGA_NONE) {
+ warn_report("A -vga option was passed but this machine "
+ "type does not use that option; "
+ "No VGA device has been created");
+ }
}
void qmp_x_exit_preconfig(Error **errp)