Received: from eggs.gnu.org ([2001:4830:134:3::10]:40161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOBmb-00089f-Dj for qemu-devel@nongnu.org; Thu, 13 Mar 2014 15:59:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOBmT-00020E-VR for qemu-devel@nongnu.org; Thu, 13 Mar 2014 15:59:13 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 13 Mar 2014 20:58:55 +0100 Message-Id: <1394740736-20771-2-git-send-email-afaerber@suse.de> In-Reply-To: <1394740736-20771-1-git-send-email-afaerber@suse.de> References: <1394740736-20771-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.0 1/2] Fix vga_interface_type for command line argument '-device VGA' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mark Wu , qemu-ppc@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori From: Mark Wu Some machine (like pseries) initialization code determines if it has graphics according to vga_interface_type. In the original code, vga_interface_type is evaluated to VGA_NONE even if a VGA is added via '-device VGA'. It causes the machine not aware of the graphics device configured. Add a new VGA device type to indicate that it has a VGA device, which will be initialized in QOM device initialization. Suggested-by: Paolo Bonzini Signed-off-by: Mark Wu Reviewed-by: Paolo Bonzini Signed-off-by: Andreas F=C3=A4rber --- include/sysemu/sysemu.h | 2 +- vl.c | 42 ++++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b90df9a..c01304d 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -104,7 +104,7 @@ extern int autostart; =20 typedef enum { VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, - VGA_TCX, VGA_CG3, + VGA_TCX, VGA_CG3, VGA_DEVICE } VGAInterfaceType; =20 extern int vga_interface_type; diff --git a/vl.c b/vl.c index 862cf20..98f6460 100644 --- a/vl.c +++ b/vl.c @@ -213,6 +213,7 @@ uint32_t xen_domid; enum xen_mode xen_mode =3D XEN_EMULATE; static int tcg_tb_size; =20 +static int has_defaults =3D 1; static int default_serial =3D 1; static int default_parallel =3D 1; static int default_virtcon =3D 1; @@ -2122,7 +2123,7 @@ static void select_vgahw (const char *p) { const char *opts; =20 - vga_interface_type =3D VGA_NONE; + assert(vga_interface_type =3D=3D VGA_NONE); if (strstart(p, "std", &opts)) { if (vga_available()) { vga_interface_type =3D VGA_STD; @@ -2912,7 +2913,7 @@ int main(int argc, char **argv, char **envp) MachineClass *machine_class; QEMUMachine *machine; const char *cpu_model; - const char *vga_model =3D "none"; + const char *vga_model =3D NULL; const char *qtest_chrdev =3D NULL; const char *qtest_log =3D NULL; const char *pid_file =3D NULL; @@ -3762,16 +3763,7 @@ int main(int argc, char **argv, char **envp) runstate_set(RUN_STATE_INMIGRATE); break; case QEMU_OPTION_nodefaults: - default_serial =3D 0; - default_parallel =3D 0; - default_virtcon =3D 0; - default_sclp =3D 0; - default_monitor =3D 0; - default_net =3D 0; - default_floppy =3D 0; - default_cdrom =3D 0; - default_sdcard =3D 0; - default_vga =3D 0; + has_defaults =3D 0; break; case QEMU_OPTION_xen_domid: if (!(xen_available())) { @@ -4004,27 +3996,35 @@ int main(int argc, char **argv, char **envp) qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NU= LL, 0); qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NU= LL, 0); =20 - if (machine->no_serial) { + if (!vga_model && !default_vga) { + vga_interface_type =3D VGA_DEVICE; + } + if (!has_defaults || machine->no_serial) { default_serial =3D 0; } - if (machine->no_parallel) { + if (!has_defaults || machine->no_parallel) { default_parallel =3D 0; } - if (!machine->use_virtcon) { + if (!has_defaults || !machine->use_virtcon) { default_virtcon =3D 0; } - if (!machine->use_sclp) { + if (!has_defaults || !machine->use_sclp) { default_sclp =3D 0; } - if (machine->no_floppy) { + if (!has_defaults || machine->no_floppy) { default_floppy =3D 0; } - if (machine->no_cdrom) { + if (!has_defaults || machine->no_cdrom) { default_cdrom =3D 0; } - if (machine->no_sdcard) { + if (!has_defaults || machine->no_sdcard) { default_sdcard =3D 0; } + if (!has_defaults) { + default_monitor =3D 0; + default_net =3D 0; + default_vga =3D 0; + } =20 if (is_daemonized()) { /* According to documentation and historically, -nographic redir= ects @@ -4329,7 +4329,9 @@ int main(int argc, char **argv, char **envp) vga_model =3D "std"; } } - select_vgahw(vga_model); + if (vga_model) { + select_vgahw(vga_model); + } =20 if (watchdog) { i =3D select_watchdog(watchdog); --=20 1.8.4.5