All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
@ 2013-07-03 16:29 Michael Tokarev
  2013-07-03 16:29 ` [Qemu-devel] [PATCH v3 2/2] display: stop using DT_NOGRAPHIC, use DT_NONE Michael Tokarev
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Michael Tokarev @ 2013-07-03 16:29 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Paolo Bonzini, Michael Tokarev, qemu-devel

From: Paolo Bonzini <pbonzini@redhat.com>

With mon:stdio you can exit the VM by switching to the monitor and
sending the "quit" command.  It is then useful to pass Ctrl-C to the
VM instead of exiting.

This in turn lets us stop tying the default signal handling behavior
to -nographic, removing gratuitous differences between "-display none"
and "-nographic".

This patch changes behavior for "-display none -serial mon:stdio", as
expected, but not for "-display none -serial stdio".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
V2: added code comments and documentation fixes by mjt
  (hopefully the s-o-b stands still)
V3: documentation fix, no code changed

 qemu-char.c     |   13 +++++++++----
 qemu-options.hx |    8 +++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 6cec5d7..18c42a3 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -926,7 +926,6 @@ static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo)
         tty.c_cc[VMIN] = 1;
         tty.c_cc[VTIME] = 0;
     }
-    /* if graphical mode, we allow Ctrl-C handling */
     if (!stdio_allow_signal)
         tty.c_lflag &= ~ISIG;
 
@@ -955,7 +954,6 @@ static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)
     chr = qemu_chr_open_fd(0, 1);
     chr->chr_close = qemu_chr_close_stdio;
     chr->chr_set_echo = qemu_chr_set_echo_stdio;
-    stdio_allow_signal = display_type != DT_NOGRAPHIC;
     if (opts->has_signal) {
         stdio_allow_signal = opts->signal;
     }
@@ -2932,6 +2930,14 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
     if (strstart(filename, "mon:", &p)) {
         filename = p;
         qemu_opt_set(opts, "mux", "on");
+        if (strcmp(filename, "stdio") == 0) {
+            /* Monitor is muxed to stdio: do not exit on Ctrl+C by default
+             * but pass it to the guest.  Handle this only for compat syntax,
+             * for -chardev syntax we have special option for this.
+             * This is what -nographic did, redirecting+muxing serial+monitor
+             * to stdio causing Ctrl+C to be passed to guest. */
+            qemu_opt_set(opts, "signal", "off");
+        }
     }
 
     if (strcmp(filename, "null")    == 0 ||
@@ -3060,8 +3066,7 @@ static void qemu_chr_parse_stdio(QemuOpts *opts, ChardevBackend *backend,
 {
     backend->stdio = g_new0(ChardevStdio, 1);
     backend->stdio->has_signal = true;
-    backend->stdio->signal =
-        qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC);
+    backend->stdio->signal = qemu_opt_get_bool(opts, "signal", true);
 }
 
 static void qemu_chr_parse_serial(QemuOpts *opts, ChardevBackend *backend,
diff --git a/qemu-options.hx b/qemu-options.hx
index 137a39b..7cc4d8e 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -842,7 +842,8 @@ STEXI
 Normally, QEMU uses SDL to display the VGA output. With this option,
 you can totally disable graphical output so that QEMU is a simple
 command line application. The emulated serial port is redirected on
-the console. Therefore, you can still use QEMU to debug a Linux kernel
+the console and muxed with the monitor (unless redirected elsewhere
+explicitly). Therefore, you can still use QEMU to debug a Linux kernel
 with a serial console.
 ETEXI
 
@@ -2485,14 +2486,15 @@ same as if you had specified @code{-serial tcp} except the unix domain socket
 @item mon:@var{dev_string}
 This is a special option to allow the monitor to be multiplexed onto
 another serial port.  The monitor is accessed with key sequence of
-@key{Control-a} and then pressing @key{c}. See monitor access
-@ref{pcsys_keys} in the -nographic section for more keys.
+@key{Control-a} and then pressing @key{c}.
 @var{dev_string} should be any one of the serial devices specified
 above.  An example to multiplex the monitor onto a telnet server
 listening on port 4444 would be:
 @table @code
 @item -serial mon:telnet::4444,server,nowait
 @end table
+When monitor is multiplexed to stdio this way, Ctrl+C will not terminate
+QEMU anymore but will be passed to the guest instead.
 
 @item braille
 Braille device.  This will use BrlAPI to display the braille output on a real
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH v3 2/2] display: stop using DT_NOGRAPHIC, use DT_NONE
  2013-07-03 16:29 [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
@ 2013-07-03 16:29 ` Michael Tokarev
  2013-07-09 14:07   ` Peter Maydell
  2013-07-09  7:39 ` [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Michael Tokarev @ 2013-07-03 16:29 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Todd T. Fries, Michael Tokarev, qemu-devel

It looks like initially there was -nographic option to turn
off display, now there's another option of the same sort,
-display none.  But code in other places of qemu checks for
DT_NOGRAPHIC and does not work well with -display none.
Make DT_NOGRAPHIC an internal version which selects DT_NONE,
and check for that in all other places where previously we
checked for DT_NOGRAPHIC.

While at it, rename two private variants of display (DT_DEFAULT
and DT_NOGRAPHIC) to use two underscores and make them negative,
and set DT_NONE to 0.

This should fix the issue of non-working sun serial console
with the suggested replacement of -nographic which is
-display none.

Cc: Todd T. Fries <todd@fries.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
V2:
 - do not touch qemu-char, fixed differently as suggested by pbonzini
 - a bit more explicit comments about private DT__* constants
 - documentation additions and fixes to describe actual reality
V3:
 - documentation rewording/fixes, no code changed

 hw/lm32/milkymist-hw.h  |    2 +-
 hw/nvram/fw_cfg.c       |    2 +-
 hw/sparc/sun4m.c        |    2 +-
 include/sysemu/sysemu.h |    6 +++---
 qemu-options.hx         |   28 +++++++++++++++++-----------
 vl.c                    |   15 +++++++--------
 6 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/hw/lm32/milkymist-hw.h b/hw/lm32/milkymist-hw.h
index 5317ce6..59af720 100644
--- a/hw/lm32/milkymist-hw.h
+++ b/hw/lm32/milkymist-hw.h
@@ -107,7 +107,7 @@ static inline DeviceState *milkymist_tmu2_create(hwaddr base,
     int nelements;
     int ver_major, ver_minor;
 
-    if (display_type == DT_NOGRAPHIC) {
+    if (display_type == DT_NONE) {
         return NULL;
     }
 
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 3c255ce..b3d163a 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -510,7 +510,7 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
     }
     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)(display_type == DT_NONE));
     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 0e86ca7..c1d42ec 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -919,7 +919,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
     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);
+                              display_type == DT_NONE, 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/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 2fb71af..d1b7bd7 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -87,12 +87,12 @@ void do_info_slirp(Monitor *mon);
 
 typedef enum DisplayType
 {
-    DT_DEFAULT,
+    DT__DEFAULT = -1,   /* used internally in vl.c */
+    DT__NOGRAPHIC = -2, /* used internally in vl.c */
+    DT_NONE = 0,
     DT_CURSES,
     DT_SDL,
     DT_GTK,
-    DT_NOGRAPHIC,
-    DT_NONE,
 } DisplayType;
 
 extern int autostart;
diff --git a/qemu-options.hx b/qemu-options.hx
index 7cc4d8e..8bd8f01 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -825,7 +825,12 @@ a text mode. Generally only the VGA device models support text mode.
 @item none
 Do not display video output. The guest will still see an emulated
 graphics card, but its output will not be displayed to the QEMU
-user. This option differs from the -nographic option in that it
+user.  The fact that we have no display is passed to firmware and
+affects a few other places depending on the target architecture,
+like switching console output to serial console or disabling keyboard
+input.
+
+This option differs from the -nographic option in that it
 only affects what is done with video output; -nographic also changes
 the destination of the serial and parallel port data.
 @item vnc
@@ -841,10 +846,12 @@ STEXI
 @findex -nographic
 Normally, QEMU uses SDL to display the VGA output. With this option,
 you can totally disable graphical output so that QEMU is a simple
-command line application. The emulated serial port is redirected on
-the console and muxed with the monitor (unless redirected elsewhere
-explicitly). Therefore, you can still use QEMU to debug a Linux kernel
-with a serial console.
+command line application.  When this option is specified,
+the emulated serial port and the monitor are by default multiplexed
+on the console (stdio).  This option is equivalent to
+@example
+-display none -serial mon:stdio -parallel none
+@end example
 ETEXI
 
 DEF("curses", 0, QEMU_OPTION_curses,
@@ -2867,12 +2874,11 @@ STEXI
 @item -echr @var{numeric_ascii_value}
 @findex -echr
 Change the escape character used for switching to the monitor when using
-monitor and serial sharing.  The default is @code{0x01} when using the
-@code{-nographic} option.  @code{0x01} is equal to pressing
-@code{Control-a}.  You can select a different character from the ascii
-control keys where 1 through 26 map to Control-a through Control-z.  For
-instance you could use the either of the following to change the escape
-character to Control-t.
+monitor and serial sharing.  The default is @code{0x01}, which is equivalent
+to pressing @code{Control-a}.
+You can select a different character from the ascii control keys where
+1 through 26 map to Control-a through Control-z.  For instance you could
+use the either of the following to change the escape character to Control-t.
 @table @code
 @item -echr 0x14
 @item -echr 20
diff --git a/vl.c b/vl.c
index 6d9fd7d..98d3e62 100644
--- a/vl.c
+++ b/vl.c
@@ -183,7 +183,7 @@ static const char *data_dir[16];
 static int data_dir_idx;
 const char *bios_name = NULL;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
-DisplayType display_type = DT_DEFAULT;
+DisplayType display_type = DT__DEFAULT;
 static int display_remote;
 const char* keyboard_layout = NULL;
 ram_addr_t ram_size;
@@ -2183,7 +2183,7 @@ static void select_vgahw (const char *p)
 static DisplayType select_display(const char *p)
 {
     const char *opts;
-    DisplayType display = DT_DEFAULT;
+    DisplayType display = DT__DEFAULT;
 
     if (strstart(p, "sdl", &opts)) {
 #ifdef CONFIG_SDL
@@ -3125,7 +3125,7 @@ int main(int argc, char **argv, char **envp)
                 display_type = select_display(optarg);
                 break;
             case QEMU_OPTION_nographic:
-                display_type = DT_NOGRAPHIC;
+                display_type = DT__NOGRAPHIC;
                 break;
             case QEMU_OPTION_curses:
 #ifdef CONFIG_CURSES
@@ -3971,7 +3971,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 (display_type == DT__NOGRAPHIC
             && (default_parallel || default_serial
                 || default_monitor || default_virtcon)) {
             fprintf(stderr, "-nographic can not be used with -daemonize\n");
@@ -3985,7 +3985,8 @@ int main(int argc, char **argv, char **envp)
 #endif
     }
 
-    if (display_type == DT_NOGRAPHIC) {
+    if (display_type == DT__NOGRAPHIC) {
+        display_type = DT_NONE;
         if (default_parallel)
             add_device_config(DEV_PARALLEL, "null");
         if (default_serial && default_monitor) {
@@ -4019,7 +4020,7 @@ int main(int argc, char **argv, char **envp)
         }
     }
 
-    if (display_type == DT_DEFAULT && !display_remote) {
+    if (display_type == DT__DEFAULT && !display_remote) {
 #if defined(CONFIG_GTK)
         display_type = DT_GTK;
 #elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
@@ -4309,8 +4310,6 @@ int main(int argc, char **argv, char **envp)
 
     /* init local displays */
     switch (display_type) {
-    case DT_NOGRAPHIC:
-        break;
 #if defined(CONFIG_CURSES)
     case DT_CURSES:
         curses_display_init(ds, full_screen);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-03 16:29 [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
  2013-07-03 16:29 ` [Qemu-devel] [PATCH v3 2/2] display: stop using DT_NOGRAPHIC, use DT_NONE Michael Tokarev
@ 2013-07-09  7:39 ` Michael Tokarev
  2013-07-09  8:42   ` Andreas Färber
  2013-07-09 14:04 ` Peter Maydell
  2013-07-10 19:33 ` Anthony Liguori
  3 siblings, 1 reply; 16+ messages in thread
From: Michael Tokarev @ 2013-07-09  7:39 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

Ping?

03.07.2013 20:29, Michael Tokarev wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> With mon:stdio you can exit the VM by switching to the monitor and
> sending the "quit" command.  It is then useful to pass Ctrl-C to the
> VM instead of exiting.
> 
> This in turn lets us stop tying the default signal handling behavior
> to -nographic, removing gratuitous differences between "-display none"
> and "-nographic".
> 
> This patch changes behavior for "-display none -serial mon:stdio", as
> expected, but not for "-display none -serial stdio".
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
> V2: added code comments and documentation fixes by mjt
>   (hopefully the s-o-b stands still)
> V3: documentation fix, no code changed
> 
>  qemu-char.c     |   13 +++++++++----
>  qemu-options.hx |    8 +++++---
>  2 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 6cec5d7..18c42a3 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -926,7 +926,6 @@ static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo)
>          tty.c_cc[VMIN] = 1;
>          tty.c_cc[VTIME] = 0;
>      }
> -    /* if graphical mode, we allow Ctrl-C handling */
>      if (!stdio_allow_signal)
>          tty.c_lflag &= ~ISIG;
>  
> @@ -955,7 +954,6 @@ static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)
>      chr = qemu_chr_open_fd(0, 1);
>      chr->chr_close = qemu_chr_close_stdio;
>      chr->chr_set_echo = qemu_chr_set_echo_stdio;
> -    stdio_allow_signal = display_type != DT_NOGRAPHIC;
>      if (opts->has_signal) {
>          stdio_allow_signal = opts->signal;
>      }
> @@ -2932,6 +2930,14 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
>      if (strstart(filename, "mon:", &p)) {
>          filename = p;
>          qemu_opt_set(opts, "mux", "on");
> +        if (strcmp(filename, "stdio") == 0) {
> +            /* Monitor is muxed to stdio: do not exit on Ctrl+C by default
> +             * but pass it to the guest.  Handle this only for compat syntax,
> +             * for -chardev syntax we have special option for this.
> +             * This is what -nographic did, redirecting+muxing serial+monitor
> +             * to stdio causing Ctrl+C to be passed to guest. */
> +            qemu_opt_set(opts, "signal", "off");
> +        }
>      }
>  
>      if (strcmp(filename, "null")    == 0 ||
> @@ -3060,8 +3066,7 @@ static void qemu_chr_parse_stdio(QemuOpts *opts, ChardevBackend *backend,
>  {
>      backend->stdio = g_new0(ChardevStdio, 1);
>      backend->stdio->has_signal = true;
> -    backend->stdio->signal =
> -        qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC);
> +    backend->stdio->signal = qemu_opt_get_bool(opts, "signal", true);
>  }
>  
>  static void qemu_chr_parse_serial(QemuOpts *opts, ChardevBackend *backend,
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 137a39b..7cc4d8e 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -842,7 +842,8 @@ STEXI
>  Normally, QEMU uses SDL to display the VGA output. With this option,
>  you can totally disable graphical output so that QEMU is a simple
>  command line application. The emulated serial port is redirected on
> -the console. Therefore, you can still use QEMU to debug a Linux kernel
> +the console and muxed with the monitor (unless redirected elsewhere
> +explicitly). Therefore, you can still use QEMU to debug a Linux kernel
>  with a serial console.
>  ETEXI
>  
> @@ -2485,14 +2486,15 @@ same as if you had specified @code{-serial tcp} except the unix domain socket
>  @item mon:@var{dev_string}
>  This is a special option to allow the monitor to be multiplexed onto
>  another serial port.  The monitor is accessed with key sequence of
> -@key{Control-a} and then pressing @key{c}. See monitor access
> -@ref{pcsys_keys} in the -nographic section for more keys.
> +@key{Control-a} and then pressing @key{c}.
>  @var{dev_string} should be any one of the serial devices specified
>  above.  An example to multiplex the monitor onto a telnet server
>  listening on port 4444 would be:
>  @table @code
>  @item -serial mon:telnet::4444,server,nowait
>  @end table
> +When monitor is multiplexed to stdio this way, Ctrl+C will not terminate
> +QEMU anymore but will be passed to the guest instead.
>  
>  @item braille
>  Braille device.  This will use BrlAPI to display the braille output on a real
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09  7:39 ` [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
@ 2013-07-09  8:42   ` Andreas Färber
  2013-07-09  8:57     ` Michael Tokarev
                       ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Andreas Färber @ 2013-07-09  8:42 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, Max Filippov

Am 09.07.2013 09:39, schrieb Michael Tokarev:
> Ping?

Have you tested -semihosting? The xtensa test image on the Wiki uses
-nographic, but semihosting content always seems to go to stdout without
going through a chardev IIUC...

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09  8:42   ` Andreas Färber
@ 2013-07-09  8:57     ` Michael Tokarev
  2013-07-09 11:00     ` Max Filippov
  2013-07-09 12:02     ` Michael Tokarev
  2 siblings, 0 replies; 16+ messages in thread
From: Michael Tokarev @ 2013-07-09  8:57 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, Max Filippov

09.07.2013 12:42, Andreas Färber wrote:
> Am 09.07.2013 09:39, schrieb Michael Tokarev:
>> Ping?
> 
> Have you tested -semihosting? The xtensa test image on the Wiki uses
> -nographic, but semihosting content always seems to go to stdout without
> going through a chardev IIUC...

Thanks for the info. I've no idea what is -semihosting, what is xtensa
and that we have xtensa test image on the wiki.  I'll try for sure,
once I can find that image (googling for xtensa image site:qemu.org
does not help much, after failing searching in qemu wiki).  Maybe
you can give some hint?

/mjt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09  8:42   ` Andreas Färber
  2013-07-09  8:57     ` Michael Tokarev
@ 2013-07-09 11:00     ` Max Filippov
  2013-07-09 11:21       ` Andreas Färber
  2013-07-09 12:02     ` Michael Tokarev
  2 siblings, 1 reply; 16+ messages in thread
From: Max Filippov @ 2013-07-09 11:00 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Paolo Bonzini, Anthony Liguori, Michael Tokarev, qemu-devel

On Tue, Jul 9, 2013 at 12:42 PM, Andreas Färber <afaerber@suse.de> wrote:
> Am 09.07.2013 09:39, schrieb Michael Tokarev:
>> Ping?
>
> Have you tested -semihosting? The xtensa test image on the Wiki uses
> -nographic, but semihosting content always seems to go to stdout without
> going through a chardev IIUC...

Andreas,

xtensa semihosting allows guest privileged code to work with host's file
descriptors doing open/read/write/lseek/close. Linux sim machine uses it
to implement console (with standard 0/1 file descriptors), simulated disks
and networking. Do you think it's worth tying these descriptors with a
chardev? If so, I'm probably the right person to do it (:

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09 11:00     ` Max Filippov
@ 2013-07-09 11:21       ` Andreas Färber
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-07-09 11:21 UTC (permalink / raw)
  To: Max Filippov
  Cc: Peter Maydell, Anthony Liguori, Michael Tokarev, qemu-devel,
	Blue Swirl, Paolo Bonzini

Hi Max,

Am 09.07.2013 13:00, schrieb Max Filippov:
> On Tue, Jul 9, 2013 at 12:42 PM, Andreas Färber <afaerber@suse.de> wrote:
>> Am 09.07.2013 09:39, schrieb Michael Tokarev:
>>> Ping?
>>
>> Have you tested -semihosting? The xtensa test image on the Wiki uses
>> -nographic, but semihosting content always seems to go to stdout without
>> going through a chardev IIUC...
> 
> xtensa semihosting allows guest privileged code to work with host's file
> descriptors doing open/read/write/lseek/close. Linux sim machine uses it
> to implement console (with standard 0/1 file descriptors), simulated disks
> and networking. Do you think it's worth tying these descriptors with a
> chardev? If so, I'm probably the right person to do it (:

Paolo's/Michael's patches are relying on -serial stdio,signal=on as a
replacement implementation for -nographic, so I raised the question of
whether that would work as expected for -semihosting in general. I do
not have test images for arm or m68k semihosting, so I cannot tell
whether xtensa should be doing something differently.

Peter and me seemed to agree that unicore32 instructions shouldn't mess
with the host's ncurses directly, but Blue apparently didn't agree and
applied it (and I guess neither of us has access to a test image to see
it in action).

stdio seems less intrusive compared to that, but I did have issues with
input at the xtensa login prompt going to the monitor instead (I use
-qmp for all my test machines to inspect the QOM tree, so I needed to
specify -monitor mon:stdio manually); -display none -monitor none -qmp
unix:... worked better for me.

Cheers,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09  8:42   ` Andreas Färber
  2013-07-09  8:57     ` Michael Tokarev
  2013-07-09 11:00     ` Max Filippov
@ 2013-07-09 12:02     ` Michael Tokarev
  2013-07-09 12:37       ` Peter Maydell
  2 siblings, 1 reply; 16+ messages in thread
From: Michael Tokarev @ 2013-07-09 12:02 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, Max Filippov

09.07.2013 12:42, Andreas Färber wrote:
> Am 09.07.2013 09:39, schrieb Michael Tokarev:
>> Ping?
> 
> Have you tested -semihosting? The xtensa test image on the Wiki uses
> -nographic, but semihosting content always seems to go to stdout without
> going through a chardev IIUC...

Ok.  I tried the xtensa image from wiki.qemu.org/Testing , and it
appears to work with or without the changes in question.  Which,
I think, is wrong, because it is a bug of the same theme - with
-daemonize we can't do -semihosting due to std file descriptors
being redirected to /dev/null.  So it looks like there's another
bug of waiting to hunt, but I really am a wrong person to do that,
maybe Max Filippov can take a look.

Thanks,

/mjt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09 12:02     ` Michael Tokarev
@ 2013-07-09 12:37       ` Peter Maydell
  2013-07-09 12:40         ` Andreas Färber
  0 siblings, 1 reply; 16+ messages in thread
From: Peter Maydell @ 2013-07-09 12:37 UTC (permalink / raw)
  To: Michael Tokarev
  Cc: Max Filippov, Paolo Bonzini, Anthony Liguori,
	Andreas Färber, qemu-devel

On 9 July 2013 13:02, Michael Tokarev <mjt@tls.msk.ru> wrote:
> 09.07.2013 12:42, Andreas Färber wrote:
>> Am 09.07.2013 09:39, schrieb Michael Tokarev:
>>> Ping?
>>
>> Have you tested -semihosting? The xtensa test image on the Wiki uses
>> -nographic, but semihosting content always seems to go to stdout without
>> going through a chardev IIUC...

This is I think correct, or at least not worth trying to
change to make it talk to a chardev. The semihosting ABI
in this area is intended primarily for debugging and similar
purposes. I don't think this patch should adversely affect
semihosting users.

> Ok.  I tried the xtensa image from wiki.qemu.org/Testing , and it
> appears to work with or without the changes in question.  Which,
> I think, is wrong, because it is a bug of the same theme - with
> -daemonize we can't do -semihosting due to std file descriptors
> being redirected to /dev/null.  So it looks like there's another
> bug of waiting to hunt, but I really am a wrong person to do that,
> maybe Max Filippov can take a look.

daemonize + semihosting is a bit of an odd combination, but in
theory I guess it might be ok if the guest restricts its use of
the semihosting ABI.

-- PMM

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09 12:37       ` Peter Maydell
@ 2013-07-09 12:40         ` Andreas Färber
  2013-07-09 12:45           ` Peter Maydell
  2013-07-09 13:13           ` Michael Tokarev
  0 siblings, 2 replies; 16+ messages in thread
From: Andreas Färber @ 2013-07-09 12:40 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, Anthony Liguori, Michael Tokarev, qemu-devel,
	Max Filippov

Am 09.07.2013 14:37, schrieb Peter Maydell:
> On 9 July 2013 13:02, Michael Tokarev <mjt@tls.msk.ru> wrote:
>> 09.07.2013 12:42, Andreas Färber wrote:
>>> Am 09.07.2013 09:39, schrieb Michael Tokarev:
>>>> Ping?
>>>
>>> Have you tested -semihosting? The xtensa test image on the Wiki uses
>>> -nographic, but semihosting content always seems to go to stdout without
>>> going through a chardev IIUC...
> 
> This is I think correct, or at least not worth trying to
> change to make it talk to a chardev. The semihosting ABI
> in this area is intended primarily for debugging and similar
> purposes. I don't think this patch should adversely affect
> semihosting users.

The way I interpreted it (without having tested it yet) is that we would
not be able to use Ctrl+C in -semihosting mode, no? At least that's how
-display none is like today IIRC.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09 12:40         ` Andreas Färber
@ 2013-07-09 12:45           ` Peter Maydell
  2013-07-09 13:13           ` Michael Tokarev
  1 sibling, 0 replies; 16+ messages in thread
From: Peter Maydell @ 2013-07-09 12:45 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Paolo Bonzini, Anthony Liguori, Michael Tokarev, qemu-devel,
	Max Filippov

On 9 July 2013 13:40, Andreas Färber <afaerber@suse.de> wrote:
> The way I interpreted it (without having tested it yet) is that we would
> not be able to use Ctrl+C in -semihosting mode, no? At least that's how
> -display none is like today IIRC.

I don't think anybody expects ctrl-C to interact with the semihosting
ABI. It should either kill QEMU or go to QEMU's console, depending
on whether you were using -display none or -nographic, as usual.

I really ought to test this patchset...

-- PMM

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09 12:40         ` Andreas Färber
  2013-07-09 12:45           ` Peter Maydell
@ 2013-07-09 13:13           ` Michael Tokarev
  1 sibling, 0 replies; 16+ messages in thread
From: Michael Tokarev @ 2013-07-09 13:13 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Max Filippov, Peter Maydell, Anthony Liguori, qemu-devel, Paolo Bonzini

09.07.2013 16:40, Andreas Färber wrote:
> The way I interpreted it (without having tested it yet) is that we would
> not be able to use Ctrl+C in -semihosting mode, no? At least that's how
> -display none is like today IIRC.

With -display none qemu terminates when you hit Ctrl+C, with or
without the changes in question.

Only in case you use -serial mux:stdio (with the patch in question,
regardless of -display) or you use -nographic (without the patch
in question) Ctrl+C is forwarded to the guest.

Thanks,

/mjt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-03 16:29 [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
  2013-07-03 16:29 ` [Qemu-devel] [PATCH v3 2/2] display: stop using DT_NOGRAPHIC, use DT_NONE Michael Tokarev
  2013-07-09  7:39 ` [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
@ 2013-07-09 14:04 ` Peter Maydell
  2013-07-09 14:24   ` Michael Tokarev
  2013-07-10 19:33 ` Anthony Liguori
  3 siblings, 1 reply; 16+ messages in thread
From: Peter Maydell @ 2013-07-09 14:04 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

On 3 July 2013 17:29, Michael Tokarev <mjt@tls.msk.ru> wrote:
> +When monitor is multiplexed to stdio this way, Ctrl+C will not terminate
> +QEMU anymore but will be passed to the guest instead.

"the monitor", "in this way", "any more".
Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 2/2] display: stop using DT_NOGRAPHIC, use DT_NONE
  2013-07-03 16:29 ` [Qemu-devel] [PATCH v3 2/2] display: stop using DT_NOGRAPHIC, use DT_NONE Michael Tokarev
@ 2013-07-09 14:07   ` Peter Maydell
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Maydell @ 2013-07-09 14:07 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Anthony Liguori, Todd T. Fries, qemu-devel

On 3 July 2013 17:29, Michael Tokarev <mjt@tls.msk.ru> wrote:
> It looks like initially there was -nographic option to turn
> off display, now there's another option of the same sort,
> -display none.  But code in other places of qemu checks for
> DT_NOGRAPHIC and does not work well with -display none.
> Make DT_NOGRAPHIC an internal version which selects DT_NONE,
> and check for that in all other places where previously we
> checked for DT_NOGRAPHIC.
>
> While at it, rename two private variants of display (DT_DEFAULT
> and DT_NOGRAPHIC) to use two underscores and make them negative,
> and set DT_NONE to 0.
>
> This should fix the issue of non-working sun serial console
> with the suggested replacement of -nographic which is
> -display none.
>
> Cc: Todd T. Fries <todd@fries.net>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

I tested, and this retains the current behaviour for the
two use cases I care about (-display none -serial stdio
vs -nographic).

thanks
-- PMM

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-09 14:04 ` Peter Maydell
@ 2013-07-09 14:24   ` Michael Tokarev
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Tokarev @ 2013-07-09 14:24 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

09.07.2013 18:04, Peter Maydell wrote:
> On 3 July 2013 17:29, Michael Tokarev <mjt@tls.msk.ru> wrote:
>> +When monitor is multiplexed to stdio this way, Ctrl+C will not terminate
>> +QEMU anymore but will be passed to the guest instead.
> 
> "the monitor", "in this way", "any more".

Grr.  This is 3rd change for the same sentence. Can we go without a v4?

> Otherwise
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thank you for the review!

/mjt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio"
  2013-07-03 16:29 [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
                   ` (2 preceding siblings ...)
  2013-07-09 14:04 ` Peter Maydell
@ 2013-07-10 19:33 ` Anthony Liguori
  3 siblings, 0 replies; 16+ messages in thread
From: Anthony Liguori @ 2013-07-10 19:33 UTC (permalink / raw)
  To: Michael Tokarev, Anthony Liguori; +Cc: qemu-devel, Blue Swirl, Paolo Bonzini

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-07-10 20:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-03 16:29 [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
2013-07-03 16:29 ` [Qemu-devel] [PATCH v3 2/2] display: stop using DT_NOGRAPHIC, use DT_NONE Michael Tokarev
2013-07-09 14:07   ` Peter Maydell
2013-07-09  7:39 ` [Qemu-devel] [PATCH v3 1/2] trap signals for "-serial mon:stdio" Michael Tokarev
2013-07-09  8:42   ` Andreas Färber
2013-07-09  8:57     ` Michael Tokarev
2013-07-09 11:00     ` Max Filippov
2013-07-09 11:21       ` Andreas Färber
2013-07-09 12:02     ` Michael Tokarev
2013-07-09 12:37       ` Peter Maydell
2013-07-09 12:40         ` Andreas Färber
2013-07-09 12:45           ` Peter Maydell
2013-07-09 13:13           ` Michael Tokarev
2013-07-09 14:04 ` Peter Maydell
2013-07-09 14:24   ` Michael Tokarev
2013-07-10 19:33 ` Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.