aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2018-04-26 16:59:54 +0200
committerCornelia Huck <cohuck@redhat.com>2018-04-30 10:48:29 +0200
commit052888f043bacb18231046045b1f9cd946703170 (patch)
treeb3753be496f7464383dbdd48f42d20685b834eb5 /vl.c
parente7c3246162398677eb96f55f267de00809ea213d (diff)
hw/s390x: Allow to configure the consoles with the "-serial" parameter
The consoles ("sclpconsole" and "sclplmconsole") can only be configured with "-device" and "-chardev" so far. Other machines use the convenience option "-serial" to configure the default consoles, even for virtual consoles like spapr-vty on the pseries machine. So let's support this option on s390x, too. This way we can easily enable the serial console here again with "-nodefaults", for example: qemu-system-s390x -no-shutdown -nographic -nodefaults -serial mon:stdio ... which is way shorter than typing: qemu-system-s390x -no-shutdown -nographic -nodefaults \ -chardev stdio,id=c1,mux=on -device sclpconsole,chardev=c1 \ -mon chardev=c1 The -serial parameter can also be used if you only want to see the QEMU monitor on stdio without using -nodefaults, but not the console output. That's something that is pretty impossible with the current code today: qemu-system-s390x -no-shutdown -nographic -serial none While we're at it, this patch also maps the second -serial option to the "sclplmconsole", so that there is now an easy way to configure this second console on s390x, too, for example: qemu-system-s390x -no-shutdown -nographic -serial null -serial mon:stdio Additionally, the new code is also smaller than the old one and we have less s390x-specific code in vl.c :-) I've also checked that migration still works as expected by migrating a guest with console output back and forth between a qemu-system-s390x that has this patch and an instance without this patch. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1524754794-28005-1-git-send-email-thuth@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/vl.c b/vl.c
index 7487535dca..806eec2ef6 100644
--- a/vl.c
+++ b/vl.c
@@ -133,7 +133,6 @@ int main(int argc, char **argv)
#include "sysemu/iothread.h"
#define MAX_VIRTIO_CONSOLES 1
-#define MAX_SCLP_CONSOLES 1
static const char *data_dir[16];
static int data_dir_idx;
@@ -158,7 +157,6 @@ static int num_serial_hds = 0;
static Chardev **serial_hds = NULL;
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES];
-Chardev *sclp_hds[MAX_SCLP_CONSOLES];
int win2k_install_hack = 0;
int singlestep = 0;
int smp_cpus;
@@ -210,7 +208,6 @@ static int has_defaults = 1;
static int default_serial = 1;
static int default_parallel = 1;
static int default_virtcon = 1;
-static int default_sclp = 1;
static int default_monitor = 1;
static int default_floppy = 1;
static int default_cdrom = 1;
@@ -2588,39 +2585,6 @@ static int virtcon_parse(const char *devname)
return 0;
}
-static int sclp_parse(const char *devname)
-{
- QemuOptsList *device = qemu_find_opts("device");
- static int index = 0;
- char label[32];
- QemuOpts *dev_opts;
-
- if (strcmp(devname, "none") == 0) {
- return 0;
- }
- if (index == MAX_SCLP_CONSOLES) {
- error_report("too many sclp consoles");
- exit(1);
- }
-
- assert(arch_type == QEMU_ARCH_S390X);
-
- dev_opts = qemu_opts_create(device, NULL, 0, NULL);
- qemu_opt_set(dev_opts, "driver", "sclpconsole", &error_abort);
-
- snprintf(label, sizeof(label), "sclpcon%d", index);
- sclp_hds[index] = qemu_chr_new(label, devname);
- if (!sclp_hds[index]) {
- error_report("could not connect sclp console"
- " to character backend '%s'", devname);
- return -1;
- }
- qemu_opt_set(dev_opts, "chardev", label, &error_abort);
-
- index++;
- return 0;
-}
-
static int debugcon_parse(const char *devname)
{
QemuOpts *opts;
@@ -4254,9 +4218,6 @@ int main(int argc, char **argv, char **envp)
if (!has_defaults || !machine_class->use_virtcon) {
default_virtcon = 0;
}
- if (!has_defaults || !machine_class->use_sclp) {
- default_sclp = 0;
- }
if (!has_defaults || machine_class->no_floppy) {
default_floppy = 0;
}
@@ -4303,16 +4264,11 @@ int main(int argc, char **argv, char **envp)
add_device_config(DEV_SERIAL, "mon:stdio");
} else if (default_virtcon && default_monitor) {
add_device_config(DEV_VIRTCON, "mon:stdio");
- } else if (default_sclp && default_monitor) {
- add_device_config(DEV_SCLP, "mon:stdio");
} else {
if (default_serial)
add_device_config(DEV_SERIAL, "stdio");
if (default_virtcon)
add_device_config(DEV_VIRTCON, "stdio");
- if (default_sclp) {
- add_device_config(DEV_SCLP, "stdio");
- }
if (default_monitor)
monitor_parse("stdio", "readline", false);
}
@@ -4325,9 +4281,6 @@ int main(int argc, char **argv, char **envp)
monitor_parse("vc:80Cx24C", "readline", false);
if (default_virtcon)
add_device_config(DEV_VIRTCON, "vc:80Cx24C");
- if (default_sclp) {
- add_device_config(DEV_SCLP, "vc:80Cx24C");
- }
}
#if defined(CONFIG_VNC)
@@ -4577,9 +4530,6 @@ int main(int argc, char **argv, char **envp)
exit(1);
if (foreach_device_config(DEV_VIRTCON, virtcon_parse) < 0)
exit(1);
- if (foreach_device_config(DEV_SCLP, sclp_parse) < 0) {
- exit(1);
- }
if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
exit(1);