spapr: Fix return value of vga initialization
Before spapr_vga_init will returned false if the vga is specified by the command '-device VGA' because vga_interface_type was evaluated to VGA_NONE. With the change in previous patch of this series, spapr_vga_init should return true if it's told that the vga will be initialized in flow of the generic devices initialization. To keep '-nodefaults' have the semantics of bare minimum, it adds a check of 'has_defaults' in usb_enabled() to avoid that a USB controller is added by '-nodefautls, -device VGA' implicitly. This patch also makes two cleanups: 1. skip initialization for VGA_NONE 2. remove the useless 'break' Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
d44229c54f
commit
7effdaa321
|
@ -781,13 +781,15 @@ static int spapr_vga_init(PCIBus *pci_bus)
|
||||||
{
|
{
|
||||||
switch (vga_interface_type) {
|
switch (vga_interface_type) {
|
||||||
case VGA_NONE:
|
case VGA_NONE:
|
||||||
|
return false;
|
||||||
|
case VGA_DEVICE:
|
||||||
|
return true;
|
||||||
case VGA_STD:
|
case VGA_STD:
|
||||||
return pci_vga_init(pci_bus) != NULL;
|
return pci_vga_init(pci_bus) != NULL;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "This vga model is not supported,"
|
fprintf(stderr, "This vga model is not supported,"
|
||||||
"currently it only supports -vga std\n");
|
"currently it only supports -vga std\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
vl.c
3
vl.c
|
@ -974,7 +974,8 @@ static void parse_name(QemuOpts *opts)
|
||||||
|
|
||||||
bool usb_enabled(bool default_usb)
|
bool usb_enabled(bool default_usb)
|
||||||
{
|
{
|
||||||
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb);
|
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
|
||||||
|
has_defaults && default_usb);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
Loading…
Reference in a new issue