From: Paolo Bonzini <pbonzini@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
Michael Walle <michael@walle.cc>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Subject: Re: [Qemu-devel] [PATCH 09/12] vl: Replace DT_NOGRAPHIC with MachineState field
Date: Thu, 12 Nov 2015 10:48:12 +0100 [thread overview]
Message-ID: <5644605C.2070802@redhat.com> (raw)
In-Reply-To: <1447268956-27500-10-git-send-email-ehabkost@redhat.com>
On 11/11/2015 20:09, Eduardo Habkost wrote:
> All DisplayType values are just UI options that don't affect any
> hardware emulation code, except for DT_NOGRAPHIC. Replace
> DT_NOGRAPHIC with DT_NONE plus a new MachineState.nographic
> field, so hardware emulation code don't need to use the
> display_type variable.
>
> Cc: Michael Walle <michael@walle.cc>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Can you add a QOM property too, so that "-machine graphics=yes|no" can
be used?
Paolo
> ---
> hw/lm32/milkymist.c | 2 +-
> hw/nvram/fw_cfg.c | 6 ++++--
> hw/sparc/sun4m.c | 2 +-
> include/hw/boards.h | 1 +
> include/sysemu/sysemu.h | 1 -
> vl.c | 12 ++++++------
> 6 files changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
> index e46283a..947c7db 100644
> --- a/hw/lm32/milkymist.c
> +++ b/hw/lm32/milkymist.c
> @@ -163,7 +163,7 @@ milkymist_init(MachineState *machine)
> milkymist_memcard_create(0x60004000);
> milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]);
> milkymist_pfpu_create(0x60006000, irq[8]);
> - if (display_type != DT_NOGRAPHIC) {
> + if (!machine->nographic) {
> milkymist_tmu2_create(0x60007000, irq[9]);
> }
> milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]);
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 73b0a81..e42b198 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -24,6 +24,7 @@
> #include "hw/hw.h"
> #include "sysemu/sysemu.h"
> #include "sysemu/dma.h"
> +#include "hw/boards.h"
> #include "hw/isa/isa.h"
> #include "hw/nvram/fw_cfg.h"
> #include "hw/sysbus.h"
> @@ -755,16 +756,17 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
> static void fw_cfg_init1(DeviceState *dev)
> {
> FWCfgState *s = FW_CFG(dev);
> + MachineState *machine = MACHINE(qdev_get_machine());
>
> assert(!object_resolve_path(FW_CFG_PATH, NULL));
>
> - object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);
> + object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NULL);
>
> qdev_init_nofail(dev);
>
> fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
> fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
> - fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
> + fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)machine->nographic);
> fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
> fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
> fw_cfg_bootsplash(s);
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 230dac9..d47f06a 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1017,7 +1017,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
> slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
>
> slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[14],
> - display_type == DT_NOGRAPHIC, ESCC_CLOCK, 1);
> + machine->nographic, ESCC_CLOCK, 1);
> /* Slavio TTYA (base+4, Linux ttyS0) is the first QEMU serial device
> Slavio TTYB (base+0, Linux ttyS1) is the second QEMU serial device */
> escc_init(hwdef->serial_base, slavio_irq[15], slavio_irq[15],
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 3e9a92c..1353f8a 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -120,6 +120,7 @@ struct MachineState {
> char *firmware;
> bool iommu;
> bool suppress_vmdesc;
> + bool nographic;
>
> ram_addr_t ram_size;
> ram_addr_t maxram_size;
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 0f4e520..f92a53c 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -139,7 +139,6 @@ typedef enum DisplayType
> DT_SDL,
> DT_COCOA,
> DT_GTK,
> - DT_NOGRAPHIC,
> DT_NONE,
> } DisplayType;
>
> diff --git a/vl.c b/vl.c
> index 57064ea..5d0228b 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2980,6 +2980,7 @@ int main(int argc, char **argv, char **envp)
> int show_vnc_port = 0;
> bool defconfig = true;
> bool userconfig = true;
> + bool nographic = false;
> const char *log_mask = NULL;
> const char *log_file = NULL;
> const char *trace_events = NULL;
> @@ -3226,7 +3227,8 @@ int main(int argc, char **argv, char **envp)
> display_type = select_display(optarg);
> break;
> case QEMU_OPTION_nographic:
> - display_type = DT_NOGRAPHIC;
> + nographic = true;
> + display_type = DT_NONE;
> break;
> case QEMU_OPTION_curses:
> #ifdef CONFIG_CURSES
> @@ -4177,7 +4179,7 @@ int main(int argc, char **argv, char **envp)
> * -nographic _and_ redirects all ports explicitly - this is valid
> * usage, -nographic is just a no-op in this case.
> */
> - if (display_type == DT_NOGRAPHIC
> + if (nographic
> && (default_parallel || default_serial
> || default_monitor || default_virtcon)) {
> error_report("-nographic cannot be used with -daemonize");
> @@ -4191,7 +4193,7 @@ int main(int argc, char **argv, char **envp)
> #endif
> }
>
> - if (display_type == DT_NOGRAPHIC) {
> + if (nographic) {
> if (default_parallel)
> add_device_config(DEV_PARALLEL, "null");
> if (default_serial && default_monitor) {
> @@ -4510,6 +4512,7 @@ int main(int argc, char **argv, char **envp)
> current_machine->ram_slots = ram_slots;
> current_machine->boot_order = boot_order;
> current_machine->cpu_model = cpu_model;
> + current_machine->nographic = nographic;
>
> machine_class->init(current_machine);
>
> @@ -4560,9 +4563,6 @@ int main(int argc, char **argv, char **envp)
>
> /* init local displays */
> switch (display_type) {
> - case DT_NOGRAPHIC:
> - (void)ds; /* avoid warning if no display is configured */
> - break;
> case DT_CURSES:
> curses_display_init(ds, full_screen);
> break;
>
next prev parent reply other threads:[~2015-11-12 9:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 19:09 [Qemu-devel] [PATCH 00/12] vl: graphics stubs + #ifdef cleanup, eliminate some global vars Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 01/12] vl: Add DT_COCOA DisplayType value Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 02/12] stubs: Add VNC initialization stubs Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 03/12] stubs: curses_display_init() stub Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 04/12] stubs: SDL initialization stubs Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 05/12] stubs: cocoa_display_init() stub Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 06/12] stubs: gtk_display_init() stub Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 07/12] stubs: spice initialization stubs Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 08/12] milkymist: Move DT_NOGRAPHIC check outside milkymist_tmu2_create() Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 09/12] vl: Replace DT_NOGRAPHIC with MachineState field Eduardo Habkost
2015-11-12 9:48 ` Paolo Bonzini [this message]
2015-11-12 19:44 ` Eduardo Habkost
2015-11-13 9:56 ` Paolo Bonzini
2015-11-13 12:22 ` Markus Armbruster
2015-11-13 11:49 ` Peter Maydell
2015-11-13 13:01 ` Paolo Bonzini
2015-11-13 15:13 ` Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 10/12] vl: Make display_type a local variable Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 11/12] vl: Move DisplayType typedef to vl.c Eduardo Habkost
2015-11-11 19:09 ` [Qemu-devel] [PATCH 12/12] vl: Make display_remote a local variable Eduardo Habkost
2015-11-12 9:46 ` [Qemu-devel] [PATCH 00/12] vl: graphics stubs + #ifdef cleanup, eliminate some global vars Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5644605C.2070802@redhat.com \
--to=pbonzini@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=ehabkost@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=michael@walle.cc \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).