* [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration.
@ 2009-12-08 12:11 Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 01/22] qdev: make compat stuff more generic Gerd Hoffmann
` (23 more replies)
0 siblings, 24 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Hi,
Qemu creates a bunch of default devices (serial, parallel, vga, ...) if
the user didn't specify one on the command line. Unfortunaly this
doesn't work well with the qdev way of doing things because this logic
is tied to the -serial, -parallel, ... command line switches. Devices
created via -device are ignored. This patch set fixes this. It also
adds a command line switch to disable all default devices and does a few
cleanups in the code touched anyway.
New in v3: Rebased against latest master. Two patches (qmp monitor +
s390 console) came into the way. Because the way how serial lines and
the monitor are initialized changes quite heavily it looked alot cleaner
to me just revert those patches, apply the v2 patches, then reimplement
the two patches on top of that.
New in v4:
* Rebased against latest master.
* Moved the included fixes from (yesterdays) staging to the head
of this series.
* Fixed segfault without -monitor switch.
* Killed noisy debug leftover.
* Replaced fprintf("fixme") with a real error message.
* Better commit messages for the monitor changes.
* Killed the #ifdef for s390 virtio console.
Luiz + Alex, please have a closer look at this.
http://repo.or.cz/w/qemu/kraxel.git/shortlog/refs/heads/default.v4
thanks,
Gerd
^ permalink raw reply [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 01/22] qdev: make compat stuff more generic
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 02/22] qdev: add command line option to set global defaults for properties Gerd Hoffmann
` (22 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
This patch renames the compat properties into global properties and
makes them more generic. The compatibility stuff is only one of
multiple possible users now.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/boards.h | 2 +-
hw/pc.c | 2 +-
hw/qdev-properties.c | 22 ++++++++++++++--------
hw/qdev.c | 2 +-
hw/qdev.h | 10 ++++++----
vl.c | 2 +-
6 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/hw/boards.h b/hw/boards.h
index d889341..7a0f20f 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -20,7 +20,7 @@ typedef struct QEMUMachine {
int use_scsi;
int max_cpus;
int is_default;
- CompatProperty *compat_props;
+ GlobalProperty *compat_props;
struct QEMUMachine *next;
} QEMUMachine;
diff --git a/hw/pc.c b/hw/pc.c
index 8c1b7ea..147a9a7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1298,7 +1298,7 @@ static QEMUMachine pc_machine_v0_10 = {
.desc = "Standard PC, qemu 0.10",
.init = pc_init_pci,
.max_cpus = 255,
- .compat_props = (CompatProperty[]) {
+ .compat_props = (GlobalProperty[]) {
{
.driver = "virtio-blk-pci",
.property = "class",
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index bda6699..fe106bd 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -593,21 +593,27 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props)
}
}
-static CompatProperty *compat_props;
+static QTAILQ_HEAD(, GlobalProperty) global_props = QTAILQ_HEAD_INITIALIZER(global_props);
-void qdev_prop_register_compat(CompatProperty *props)
+void qdev_prop_register_global(GlobalProperty *prop)
{
- compat_props = props;
+ QTAILQ_INSERT_TAIL(&global_props, prop, next);
}
-void qdev_prop_set_compat(DeviceState *dev)
+void qdev_prop_register_global_list(GlobalProperty *props)
{
- CompatProperty *prop;
+ int i;
- if (!compat_props) {
- return;
+ for (i = 0; props[i].driver != NULL; i++) {
+ qdev_prop_register_global(props+i);
}
- for (prop = compat_props; prop->driver != NULL; prop++) {
+}
+
+void qdev_prop_set_globals(DeviceState *dev)
+{
+ GlobalProperty *prop;
+
+ QTAILQ_FOREACH(prop, &global_props, next) {
if (strcmp(dev->info->name, prop->driver) != 0) {
continue;
}
diff --git a/hw/qdev.c b/hw/qdev.c
index 13c9fe2..b6bd4ae 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -103,7 +103,7 @@ DeviceState *qdev_create(BusState *bus, const char *name)
dev->parent_bus = bus;
qdev_prop_set_defaults(dev, dev->info->props);
qdev_prop_set_defaults(dev, dev->parent_bus->info->props);
- qdev_prop_set_compat(dev);
+ qdev_prop_set_globals(dev);
QLIST_INSERT_HEAD(&bus->children, dev, sibling);
if (qdev_hotplug) {
assert(bus->allow_hotplug);
diff --git a/hw/qdev.h b/hw/qdev.h
index 8d53754..bbcdba1 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -92,11 +92,12 @@ struct PropertyInfo {
int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
};
-struct CompatProperty {
+typedef struct GlobalProperty {
const char *driver;
const char *property;
const char *value;
-};
+ QTAILQ_ENTRY(GlobalProperty) next;
+} GlobalProperty;
/*** Board API. This should go away once we have a machine config file. ***/
@@ -256,8 +257,9 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value);
void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);
void qdev_prop_set_defaults(DeviceState *dev, Property *props);
-void qdev_prop_register_compat(CompatProperty *props);
-void qdev_prop_set_compat(DeviceState *dev);
+void qdev_prop_register_global(GlobalProperty *prop);
+void qdev_prop_register_global_list(GlobalProperty *props);
+void qdev_prop_set_globals(DeviceState *dev);
/* This is a nasty hack to allow passing a NULL bus to qdev_create. */
extern struct BusInfo system_bus_info;
diff --git a/vl.c b/vl.c
index 09a0ec5..a242a11 100644
--- a/vl.c
+++ b/vl.c
@@ -5779,7 +5779,7 @@ int main(int argc, char **argv, char **envp)
}
if (machine->compat_props) {
- qdev_prop_register_compat(machine->compat_props);
+ qdev_prop_register_global_list(machine->compat_props);
}
machine->init(ram_size, boot_devices,
kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 02/22] qdev: add command line option to set global defaults for properties.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 01/22] qdev: make compat stuff more generic Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 03/22] qdev: also match bus name for global properties Gerd Hoffmann
` (21 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
This patch adds infrastructure and command line option for setting
global defaults for device properties, i.e. you can for example use
-global virtio-blk-pci.vectors=0
to turn off msi by default for all virtio block devices. The config
file syntax is:
[global]
driver = "virtio-blk-pci"
property = "vectors"
value = "0"
This can also be used to set properties for devices which are not
created via -device but implicitly via machine init, i.e.
-global isa-fdc,driveA=<name>
This patch uses the mechanism which configures properties for the
compatibility machine types (pc-0.10 & friends). The command line
takes precedence over the machine type values.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
qemu-config.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
qemu-config.h | 2 +
qemu-options.hx | 3 ++
vl.c | 6 +++++
4 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/qemu-config.c b/qemu-config.c
index 92b5363..a23b125 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -2,6 +2,7 @@
#include "qemu-option.h"
#include "qemu-config.h"
#include "sysemu.h"
+#include "hw/qdev.h"
QemuOptsList qemu_drive_opts = {
.name = "drive",
@@ -205,6 +206,24 @@ QemuOptsList qemu_rtc_opts = {
},
};
+QemuOptsList qemu_global_opts = {
+ .name = "global",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_global_opts.head),
+ .desc = {
+ {
+ .name = "driver",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "property",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "value",
+ .type = QEMU_OPT_STRING,
+ },
+ { /* end if list */ }
+ },
+};
+
static QemuOptsList *lists[] = {
&qemu_drive_opts,
&qemu_chardev_opts,
@@ -212,6 +231,7 @@ static QemuOptsList *lists[] = {
&qemu_netdev_opts,
&qemu_net_opts,
&qemu_rtc_opts,
+ &qemu_global_opts,
NULL,
};
@@ -260,6 +280,42 @@ int qemu_set_option(const char *str)
return 0;
}
+int qemu_global_option(const char *str)
+{
+ char driver[64], property[64];
+ QemuOpts *opts;
+ int rc, offset;
+
+ rc = sscanf(str, "%63[^.].%63[^=]%n", driver, property, &offset);
+ if (rc < 2 || str[offset] != '=') {
+ qemu_error("can't parse: \"%s\"\n", str);
+ return -1;
+ }
+
+ opts = qemu_opts_create(&qemu_global_opts, NULL, 0);
+ qemu_opt_set(opts, "driver", driver);
+ qemu_opt_set(opts, "property", property);
+ qemu_opt_set(opts, "value", str+offset+1);
+ return 0;
+}
+
+static int qemu_add_one_global(QemuOpts *opts, void *opaque)
+{
+ GlobalProperty *g;
+
+ g = qemu_mallocz(sizeof(*g));
+ g->driver = qemu_opt_get(opts, "driver");
+ g->property = qemu_opt_get(opts, "property");
+ g->value = qemu_opt_get(opts, "value");
+ qdev_prop_register_global(g);
+ return 0;
+}
+
+void qemu_add_globals(void)
+{
+ qemu_opts_foreach(&qemu_global_opts, qemu_add_one_global, NULL, 0);
+}
+
struct ConfigWriteData {
QemuOptsList *list;
FILE *fp;
diff --git a/qemu-config.h b/qemu-config.h
index b564851..6246e76 100644
--- a/qemu-config.h
+++ b/qemu-config.h
@@ -9,6 +9,8 @@ extern QemuOptsList qemu_net_opts;
extern QemuOptsList qemu_rtc_opts;
int qemu_set_option(const char *str);
+int qemu_global_option(const char *str);
+void qemu_add_globals(void);
void qemu_config_write(FILE *fp);
int qemu_config_parse(FILE *fp);
diff --git a/qemu-options.hx b/qemu-options.hx
index 1b5781a..b6f3075 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -109,6 +109,9 @@ DEF("set", HAS_ARG, QEMU_OPTION_set,
"-set group.id.arg=value\n"
" set <arg> parameter for item <id> of type <group>\n"
" i.e. -set drive.$id.file=/path/to/image\n")
+DEF("global", HAS_ARG, QEMU_OPTION_global,
+ "-global driver.property=value\n"
+ " set a global default for a driver property\n")
STEXI
@item -drive @var{option}[,@var{option}[,@var{option}[,...]]]
diff --git a/vl.c b/vl.c
index a242a11..f7acdd4 100644
--- a/vl.c
+++ b/vl.c
@@ -4851,6 +4851,10 @@ int main(int argc, char **argv, char **envp)
if (qemu_set_option(optarg) != 0)
exit(1);
break;
+ case QEMU_OPTION_global:
+ if (qemu_global_option(optarg) != 0)
+ exit(1);
+ break;
case QEMU_OPTION_mtdblock:
drive_add(optarg, MTD_ALIAS);
break;
@@ -5781,6 +5785,8 @@ int main(int argc, char **argv, char **envp)
if (machine->compat_props) {
qdev_prop_register_global_list(machine->compat_props);
}
+ qemu_add_globals();
+
machine->init(ram_size, boot_devices,
kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 03/22] qdev: also match bus name for global properties
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 01/22] qdev: make compat stuff more generic Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 02/22] qdev: add command line option to set global defaults for properties Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-09 16:14 ` [Qemu-devel] " Michael S. Tsirkin
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 04/22] chardev: make chardevs specified in config file work Gerd Hoffmann
` (20 subsequent siblings)
23 siblings, 1 reply; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
i.e. -global PCI.<property>=<value> will set a default property for all
PCI devices. Also works for the compat properties used by machine
types.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qdev-properties.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index fe106bd..fb07279 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -614,7 +614,8 @@ void qdev_prop_set_globals(DeviceState *dev)
GlobalProperty *prop;
QTAILQ_FOREACH(prop, &global_props, next) {
- if (strcmp(dev->info->name, prop->driver) != 0) {
+ if (strcmp(dev->info->name, prop->driver) != 0 &&
+ strcmp(dev->info->bus_info->name, prop->driver) != 0) {
continue;
}
if (qdev_prop_parse(dev, prop->property, prop->value) != 0) {
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 04/22] chardev: make chardevs specified in config file work.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (2 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 03/22] qdev: also match bus name for global properties Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode" Gerd Hoffmann
` (19 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
The patch decuples the -chardev switch and the actual chardev
initialization. Without this patch qemu ignores chardev entries
coming via -readconfig.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/vl.c b/vl.c
index f7acdd4..aa678ad 100644
--- a/vl.c
+++ b/vl.c
@@ -4586,6 +4586,16 @@ static int device_init_func(QemuOpts *opts, void *opaque)
return 0;
}
+static int chardev_init_func(QemuOpts *opts, void *opaque)
+{
+ CharDriverState *chr;
+
+ chr = qemu_chr_open_opts(opts, NULL);
+ if (!chr)
+ return -1;
+ return 0;
+}
+
struct device_config {
enum {
DEV_USB, /* -usbdevice */
@@ -5180,9 +5190,6 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "parse error: %s\n", optarg);
exit(1);
}
- if (qemu_chr_open_opts(opts, NULL) == NULL) {
- exit(1);
- }
break;
case QEMU_OPTION_serial:
if (serial_device_index >= MAX_SERIAL_PORTS) {
@@ -5501,6 +5508,9 @@ int main(int argc, char **argv, char **envp)
}
}
+ if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0)
+ exit(1);
+
#ifndef _WIN32
if (daemonize) {
pid_t pid;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode"
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (3 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 04/22] chardev: make chardevs specified in config file work Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-10 7:59 ` Markus Armbruster
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 06/22] Revert "Set default console to virtio on S390x" Gerd Hoffmann
` (18 subsequent siblings)
23 siblings, 1 reply; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
This reverts commit adcb181afe5a951c521411c7a8e9d9b791aa6742.
Conflicts:
monitor.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
monitor.c | 18 ------------------
monitor.h | 1 -
qemu-options.hx | 5 ++---
vl.c | 11 ++++-------
4 files changed, 6 insertions(+), 29 deletions(-)
diff --git a/monitor.c b/monitor.c
index a38a103..8a1be39 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4038,24 +4038,6 @@ static void monitor_event(void *opaque, int event)
* End:
*/
-const char *monitor_cmdline_parse(const char *cmdline, int *flags)
-{
- const char *dev;
-
- if (strstart(cmdline, "control,", &dev)) {
- if (strstart(dev, "vc", NULL)) {
- fprintf(stderr, "qemu: control mode is for low-level interaction ");
- fprintf(stderr, "cannot be used with device 'vc'\n");
- exit(1);
- }
- *flags &= ~MONITOR_USE_READLINE;
- *flags |= MONITOR_USE_CONTROL;
- return dev;
- }
-
- return cmdline;
-}
-
void monitor_init(CharDriverState *chr, int flags)
{
static int is_first_init = 1;
diff --git a/monitor.h b/monitor.h
index 38cc223..6ed117a 100644
--- a/monitor.h
+++ b/monitor.h
@@ -24,7 +24,6 @@ typedef enum MonitorEvent {
} MonitorEvent;
void monitor_protocol_event(MonitorEvent event, QObject *data);
-const char *monitor_cmdline_parse(const char *cmdline, int *flags);
void monitor_init(CharDriverState *chr, int flags);
int monitor_suspend(Monitor *mon);
diff --git a/qemu-options.hx b/qemu-options.hx
index b6f3075..420b7d8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1580,14 +1580,13 @@ Use @code{-parallel none} to disable all parallel ports.
ETEXI
DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \
- "-monitor [control,]dev redirect the monitor to char device 'dev'\n")
+ "-monitor dev redirect the monitor to char device 'dev'\n")
STEXI
-@item -monitor [@var{control},]@var{dev}
+@item -monitor @var{dev}
Redirect the monitor to host device @var{dev} (same devices as the
serial port).
The default device is @code{vc} in graphical mode and @code{stdio} in
non graphical mode.
-The option @var{control} enables the QEMU Monitor Protocol.
ETEXI
DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
diff --git a/vl.c b/vl.c
index aa678ad..11eda45 100644
--- a/vl.c
+++ b/vl.c
@@ -4648,7 +4648,6 @@ int main(int argc, char **argv, char **envp)
const char *r, *optarg;
CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
const char *monitor_devices[MAX_MONITOR_DEVICES];
- int monitor_flags[MAX_MONITOR_DEVICES];
int monitor_device_index;
const char *serial_devices[MAX_SERIAL_PORTS];
int serial_device_index;
@@ -4751,10 +4750,8 @@ int main(int argc, char **argv, char **envp)
#endif
monitor_devices[0] = "vc:80Cx24C";
- monitor_flags[0] = MONITOR_IS_DEFAULT | MONITOR_USE_READLINE;
for (i = 1; i < MAX_MONITOR_DEVICES; i++) {
monitor_devices[i] = NULL;
- monitor_flags[i] = MONITOR_USE_READLINE;
}
monitor_device_index = 0;
@@ -5179,9 +5176,7 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "qemu: too many monitor devices\n");
exit(1);
}
- monitor_devices[monitor_device_index] =
- monitor_cmdline_parse(optarg,
- &monitor_flags[monitor_device_index]);
+ monitor_devices[monitor_device_index] = optarg;
monitor_device_index++;
break;
case QEMU_OPTION_chardev:
@@ -5891,7 +5886,9 @@ int main(int argc, char **argv, char **envp)
for (i = 0; i < MAX_MONITOR_DEVICES; i++) {
if (monitor_devices[i] && monitor_hds[i]) {
- monitor_init(monitor_hds[i], monitor_flags[i]);
+ monitor_init(monitor_hds[i],
+ MONITOR_USE_READLINE |
+ ((i == 0) ? MONITOR_IS_DEFAULT : 0));
}
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 06/22] Revert "Set default console to virtio on S390x"
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (4 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode" Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-10 8:00 ` Markus Armbruster
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 07/22] chardev: move greeting into vc backend Gerd Hoffmann
` (17 subsequent siblings)
23 siblings, 1 reply; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
This reverts commit 93d434b4aec0702b87ebf52449a3cdf2c3596825.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 26 --------------------------
1 files changed, 0 insertions(+), 26 deletions(-)
diff --git a/vl.c b/vl.c
index 11eda45..172828a 100644
--- a/vl.c
+++ b/vl.c
@@ -4720,20 +4720,6 @@ int main(int argc, char **argv, char **envp)
cyls = heads = secs = 0;
translation = BIOS_ATA_TRANSLATION_AUTO;
-#ifdef TARGET_S390X
- for(i = 0; i < MAX_SERIAL_PORTS; i++)
- serial_devices[i] = NULL;
- serial_device_index = 0;
-
- for(i = 0; i < MAX_PARALLEL_PORTS; i++)
- parallel_devices[i] = NULL;
- parallel_device_index = 0;
-
- virtio_consoles[0] = "mon:stdio";
- for(i = 1; i < MAX_VIRTIO_CONSOLES; i++)
- virtio_consoles[i] = NULL;
- virtio_console_index = 0;
-#else
serial_devices[0] = "vc:80Cx24C";
for(i = 1; i < MAX_SERIAL_PORTS; i++)
serial_devices[i] = NULL;
@@ -4747,7 +4733,6 @@ int main(int argc, char **argv, char **envp)
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++)
virtio_consoles[i] = NULL;
virtio_console_index = 0;
-#endif
monitor_devices[0] = "vc:80Cx24C";
for (i = 1; i < MAX_MONITOR_DEVICES; i++) {
@@ -5664,17 +5649,6 @@ int main(int argc, char **argv, char **envp)
break;
}
}
- for (i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
- const char *devname = virtio_consoles[i];
- if (devname && !strcmp(devname,"mon:stdio")) {
- monitor_devices[0] = NULL;
- break;
- } else if (devname && !strcmp(devname,"stdio")) {
- monitor_devices[0] = NULL;
- virtio_consoles[i] = "mon:stdio";
- break;
- }
- }
}
if (nb_numa_nodes > 0) {
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 07/22] chardev: move greeting into vc backend.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (5 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 06/22] Revert "Set default console to virtio on S390x" Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 08/22] vc: colorize chardev title line with blue background Gerd Hoffmann
` (16 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Make the 'vc' chardev backend print a title line with the chardev name
after initialization, using CharDriverState->label.
This replaces the banner printing code in vl.c.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
console.c | 8 ++++++++
vl.c | 24 ------------------------
2 files changed, 8 insertions(+), 24 deletions(-)
diff --git a/console.c b/console.c
index 82ddbe4..2aeb5b3 100644
--- a/console.c
+++ b/console.c
@@ -1384,6 +1384,14 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, QemuOpt
s->t_attrib = s->t_attrib_default;
text_console_resize(s);
+ if (chr->label) {
+ char msg[128];
+ int len;
+
+ len = snprintf(msg, sizeof(msg), "%s console\r\n", chr->label);
+ console_puts(chr, (uint8_t*)msg, len);
+ }
+
qemu_chr_generic_open(chr);
if (chr->init)
chr->init(chr);
diff --git a/vl.c b/vl.c
index 172828a..333780f 100644
--- a/vl.c
+++ b/vl.c
@@ -5866,30 +5866,6 @@ int main(int argc, char **argv, char **envp)
}
}
- for(i = 0; i < MAX_SERIAL_PORTS; i++) {
- const char *devname = serial_devices[i];
- if (devname && strcmp(devname, "none")) {
- if (strstart(devname, "vc", 0))
- qemu_chr_printf(serial_hds[i], "serial%d console\r\n", i);
- }
- }
-
- for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
- const char *devname = parallel_devices[i];
- if (devname && strcmp(devname, "none")) {
- if (strstart(devname, "vc", 0))
- qemu_chr_printf(parallel_hds[i], "parallel%d console\r\n", i);
- }
- }
-
- for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
- const char *devname = virtio_consoles[i];
- if (virtcon_hds[i] && devname) {
- if (strstart(devname, "vc", 0))
- qemu_chr_printf(virtcon_hds[i], "virtio console%d\r\n", i);
- }
- }
-
if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) {
fprintf(stderr, "qemu: could not open gdbserver on device '%s'\n",
gdbstub_dev);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 08/22] vc: colorize chardev title line with blue background.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (6 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 07/22] chardev: move greeting into vc backend Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 09/22] default devices: core code & serial lines Gerd Hoffmann
` (15 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
console.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/console.c b/console.c
index 2aeb5b3..8086bd6 100644
--- a/console.c
+++ b/console.c
@@ -1388,8 +1388,10 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, QemuOpt
char msg[128];
int len;
+ s->t_attrib.bgcol = COLOR_BLUE;
len = snprintf(msg, sizeof(msg), "%s console\r\n", chr->label);
console_puts(chr, (uint8_t*)msg, len);
+ s->t_attrib = s->t_attrib_default;
}
qemu_chr_generic_open(chr);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 09/22] default devices: core code & serial lines.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (7 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 08/22] vc: colorize chardev title line with blue background Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 10/22] default devices: parallel port Gerd Hoffmann
` (14 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Qemu creates a default serial line for you in case you didn't specify
one on the command line. Right now this is tied to the '-serial
<chardev>' command line switch, which in turn causes trouble if you are
creating your serial line via '-device isa-serial,<props>'.
This patch adds a variable default_serial which says whenever a default
serial line should be added. It is enabled by default. It is cleared
when qemu finds '-serial' or '-device isa-serial' on the command line.
Part of the patch is some infrastructure for the '-device $driver'
checking (default_driver_check function) which will also be used by the
other patches of this series.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 122 +++++++++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 81 insertions(+), 41 deletions(-)
diff --git a/vl.c b/vl.c
index 333780f..ef9e480 100644
--- a/vl.c
+++ b/vl.c
@@ -271,6 +271,30 @@ uint8_t qemu_uuid[16];
static QEMUBootSetHandler *boot_set_handler;
static void *boot_set_opaque;
+static int default_serial = 1;
+
+static struct {
+ const char *driver;
+ int *flag;
+} default_list[] = {
+ { .driver = "isa-serial", .flag = &default_serial },
+};
+
+static int default_driver_check(QemuOpts *opts, void *opaque)
+{
+ const char *driver = qemu_opt_get(opts, "driver");
+ int i;
+
+ if (!driver)
+ return 0;
+ for (i = 0; i < ARRAY_SIZE(default_list); i++) {
+ if (strcmp(default_list[i].driver, driver) != 0)
+ continue;
+ *(default_list[i].flag) = 0;
+ }
+ return 0;
+}
+
/***********************************************************/
/* x86 ISA bus support */
@@ -4600,6 +4624,7 @@ struct device_config {
enum {
DEV_USB, /* -usbdevice */
DEV_BT, /* -bt */
+ DEV_SERIAL, /* -serial */
} type;
const char *cmdline;
QTAILQ_ENTRY(device_config) next;
@@ -4631,6 +4656,50 @@ static int foreach_device_config(int type, int (*func)(const char *cmdline))
return 0;
}
+static void serial_monitor_mux(const char *monitor_devices[])
+{
+ struct device_config *serial;
+ const char *devname;
+
+ if (strcmp(monitor_devices[0],"stdio") != 0)
+ return;
+ QTAILQ_FOREACH(serial, &device_configs, next) {
+ if (serial->type != DEV_SERIAL)
+ continue;
+ devname = serial->cmdline;
+ if (devname && !strcmp(devname,"mon:stdio")) {
+ monitor_devices[0] = NULL;
+ break;
+ } else if (devname && !strcmp(devname,"stdio")) {
+ monitor_devices[0] = NULL;
+ serial->cmdline = "mon:stdio";
+ break;
+ }
+ }
+}
+
+static int serial_parse(const char *devname)
+{
+ static int index = 0;
+ char label[32];
+
+ if (strcmp(devname, "none") == 0)
+ return 0;
+ if (index == MAX_SERIAL_PORTS) {
+ fprintf(stderr, "qemu: too many serial ports\n");
+ exit(1);
+ }
+ snprintf(label, sizeof(label), "serial%d", index);
+ serial_hds[index] = qemu_chr_open(label, devname, NULL);
+ if (!serial_hds[index]) {
+ fprintf(stderr, "qemu: could not open serial device '%s': %s\n",
+ devname, strerror(errno));
+ return -1;
+ }
+ index++;
+ return 0;
+}
+
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
@@ -4649,8 +4718,6 @@ int main(int argc, char **argv, char **envp)
CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
const char *monitor_devices[MAX_MONITOR_DEVICES];
int monitor_device_index;
- const char *serial_devices[MAX_SERIAL_PORTS];
- int serial_device_index;
const char *parallel_devices[MAX_PARALLEL_PORTS];
int parallel_device_index;
const char *virtio_consoles[MAX_VIRTIO_CONSOLES];
@@ -4720,11 +4787,6 @@ int main(int argc, char **argv, char **envp)
cyls = heads = secs = 0;
translation = BIOS_ATA_TRANSLATION_AUTO;
- serial_devices[0] = "vc:80Cx24C";
- for(i = 1; i < MAX_SERIAL_PORTS; i++)
- serial_devices[i] = NULL;
- serial_device_index = 0;
-
parallel_devices[0] = "vc:80Cx24C";
for(i = 1; i < MAX_PARALLEL_PORTS; i++)
parallel_devices[i] = NULL;
@@ -5172,12 +5234,8 @@ int main(int argc, char **argv, char **envp)
}
break;
case QEMU_OPTION_serial:
- if (serial_device_index >= MAX_SERIAL_PORTS) {
- fprintf(stderr, "qemu: too many serial ports\n");
- exit(1);
- }
- serial_devices[serial_device_index] = optarg;
- serial_device_index++;
+ add_device_config(DEV_SERIAL, optarg);
+ default_serial = 0;
break;
case QEMU_OPTION_watchdog:
if (watchdog) {
@@ -5478,14 +5536,19 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
+ qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0);
+
if (display_type == DT_NOGRAPHIC) {
- if (serial_device_index == 0)
- serial_devices[0] = "stdio";
+ if (default_serial)
+ add_device_config(DEV_SERIAL, "stdio");
if (parallel_device_index == 0)
parallel_devices[0] = "null";
if (strncmp(monitor_devices[0], "vc", 2) == 0) {
monitor_devices[0] = "stdio";
}
+ } else {
+ if (default_serial)
+ add_device_config(DEV_SERIAL, "vc:80Cx24C");
}
if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0)
@@ -5637,19 +5700,7 @@ int main(int argc, char **argv, char **envp)
ram_load, NULL);
/* Maintain compatibility with multiple stdio monitors */
- if (!strcmp(monitor_devices[0],"stdio")) {
- for (i = 0; i < MAX_SERIAL_PORTS; i++) {
- const char *devname = serial_devices[i];
- if (devname && !strcmp(devname,"mon:stdio")) {
- monitor_devices[0] = NULL;
- break;
- } else if (devname && !strcmp(devname,"stdio")) {
- monitor_devices[0] = NULL;
- serial_devices[i] = "mon:stdio";
- break;
- }
- }
- }
+ serial_monitor_mux(monitor_devices);
if (nb_numa_nodes > 0) {
int i;
@@ -5711,19 +5762,8 @@ int main(int argc, char **argv, char **envp)
}
}
- for(i = 0; i < MAX_SERIAL_PORTS; i++) {
- const char *devname = serial_devices[i];
- if (devname && strcmp(devname, "none")) {
- char label[32];
- snprintf(label, sizeof(label), "serial%d", i);
- serial_hds[i] = qemu_chr_open(label, devname, NULL);
- if (!serial_hds[i]) {
- fprintf(stderr, "qemu: could not open serial device '%s': %s\n",
- devname, strerror(errno));
- exit(1);
- }
- }
- }
+ if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
+ exit(1);
for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
const char *devname = parallel_devices[i];
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 10/22] default devices: parallel port.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (8 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 09/22] default devices: core code & serial lines Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 11/22] default devices: qemu monitor Gerd Hoffmann
` (13 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Qemu creates a default parallel port for you in case you didn't specify
one on the command line. Right now this is tied to the '-parallel
<chardev>' command line switch, which in turn causes trouble if you are
creating your parallel port via '-device isa-parallel,<props>'.
This patch adds a variable default_parallel which says whenever a default
parallel port should be added. It is enabled by default. It is cleared
when qemu finds '-parallel' or '-device isa-parallel' on the command line.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 64 ++++++++++++++++++++++++++++++++++------------------------------
1 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/vl.c b/vl.c
index ef9e480..b10cdf8 100644
--- a/vl.c
+++ b/vl.c
@@ -272,12 +272,14 @@ static QEMUBootSetHandler *boot_set_handler;
static void *boot_set_opaque;
static int default_serial = 1;
+static int default_parallel = 1;
static struct {
const char *driver;
int *flag;
} default_list[] = {
- { .driver = "isa-serial", .flag = &default_serial },
+ { .driver = "isa-serial", .flag = &default_serial },
+ { .driver = "isa-parallel", .flag = &default_parallel },
};
static int default_driver_check(QemuOpts *opts, void *opaque)
@@ -4625,6 +4627,7 @@ struct device_config {
DEV_USB, /* -usbdevice */
DEV_BT, /* -bt */
DEV_SERIAL, /* -serial */
+ DEV_PARALLEL, /* -parallel */
} type;
const char *cmdline;
QTAILQ_ENTRY(device_config) next;
@@ -4700,6 +4703,28 @@ static int serial_parse(const char *devname)
return 0;
}
+static int parallel_parse(const char *devname)
+{
+ static int index = 0;
+ char label[32];
+
+ if (strcmp(devname, "none") == 0)
+ return 0;
+ if (index == MAX_PARALLEL_PORTS) {
+ fprintf(stderr, "qemu: too many parallel ports\n");
+ exit(1);
+ }
+ snprintf(label, sizeof(label), "parallel%d", index);
+ parallel_hds[index] = qemu_chr_open(label, devname, NULL);
+ if (!parallel_hds[index]) {
+ fprintf(stderr, "qemu: could not open parallel device '%s': %s\n",
+ devname, strerror(errno));
+ return -1;
+ }
+ index++;
+ return 0;
+}
+
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
@@ -4718,8 +4743,6 @@ int main(int argc, char **argv, char **envp)
CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
const char *monitor_devices[MAX_MONITOR_DEVICES];
int monitor_device_index;
- const char *parallel_devices[MAX_PARALLEL_PORTS];
- int parallel_device_index;
const char *virtio_consoles[MAX_VIRTIO_CONSOLES];
int virtio_console_index;
const char *loadvm = NULL;
@@ -4787,11 +4810,6 @@ int main(int argc, char **argv, char **envp)
cyls = heads = secs = 0;
translation = BIOS_ATA_TRANSLATION_AUTO;
- parallel_devices[0] = "vc:80Cx24C";
- for(i = 1; i < MAX_PARALLEL_PORTS; i++)
- parallel_devices[i] = NULL;
- parallel_device_index = 0;
-
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++)
virtio_consoles[i] = NULL;
virtio_console_index = 0;
@@ -5260,12 +5278,8 @@ int main(int argc, char **argv, char **envp)
virtio_console_index++;
break;
case QEMU_OPTION_parallel:
- if (parallel_device_index >= MAX_PARALLEL_PORTS) {
- fprintf(stderr, "qemu: too many parallel ports\n");
- exit(1);
- }
- parallel_devices[parallel_device_index] = optarg;
- parallel_device_index++;
+ add_device_config(DEV_PARALLEL, optarg);
+ default_parallel = 0;
break;
case QEMU_OPTION_loadvm:
loadvm = optarg;
@@ -5541,14 +5555,16 @@ int main(int argc, char **argv, char **envp)
if (display_type == DT_NOGRAPHIC) {
if (default_serial)
add_device_config(DEV_SERIAL, "stdio");
- if (parallel_device_index == 0)
- parallel_devices[0] = "null";
+ if (default_parallel)
+ add_device_config(DEV_PARALLEL, "null");
if (strncmp(monitor_devices[0], "vc", 2) == 0) {
monitor_devices[0] = "stdio";
}
} else {
if (default_serial)
add_device_config(DEV_SERIAL, "vc:80Cx24C");
+ if (default_parallel)
+ add_device_config(DEV_PARALLEL, "vc:80Cx24C");
}
if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0)
@@ -5764,20 +5780,8 @@ int main(int argc, char **argv, char **envp)
if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
exit(1);
-
- for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
- const char *devname = parallel_devices[i];
- if (devname && strcmp(devname, "none")) {
- char label[32];
- snprintf(label, sizeof(label), "parallel%d", i);
- parallel_hds[i] = qemu_chr_open(label, devname, NULL);
- if (!parallel_hds[i]) {
- fprintf(stderr, "qemu: could not open parallel device '%s': %s\n",
- devname, strerror(errno));
- exit(1);
- }
- }
- }
+ if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
+ exit(1);
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
const char *devname = virtio_consoles[i];
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 11/22] default devices: qemu monitor.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (9 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 10/22] default devices: parallel port Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 12/22] zap serial_monitor_mux Gerd Hoffmann
` (12 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
This patch makes the monitor default device configuration work like the
default serial and parallel port devices. It adds a variable
default_monitor which says whenever a default monitor should be added.
It is enabled by default. It is cleared when qemu finds '-monitor' on
the command line.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 94 +++++++++++++++++++++++++++++++++++-------------------------------
1 files changed, 50 insertions(+), 44 deletions(-)
diff --git a/vl.c b/vl.c
index b10cdf8..0d3f5e6 100644
--- a/vl.c
+++ b/vl.c
@@ -211,6 +211,7 @@ int no_quit = 0;
CharDriverState *serial_hds[MAX_SERIAL_PORTS];
CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
+CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
#ifdef TARGET_I386
int win2k_install_hack = 0;
int rtc_td_hack = 0;
@@ -273,6 +274,7 @@ static void *boot_set_opaque;
static int default_serial = 1;
static int default_parallel = 1;
+static int default_monitor = 1;
static struct {
const char *driver;
@@ -4628,6 +4630,7 @@ struct device_config {
DEV_BT, /* -bt */
DEV_SERIAL, /* -serial */
DEV_PARALLEL, /* -parallel */
+ DEV_MONITOR, /* -monitor */
} type;
const char *cmdline;
QTAILQ_ENTRY(device_config) next;
@@ -4659,22 +4662,27 @@ static int foreach_device_config(int type, int (*func)(const char *cmdline))
return 0;
}
-static void serial_monitor_mux(const char *monitor_devices[])
+static void serial_monitor_mux(void)
{
- struct device_config *serial;
+ struct device_config *mon0, *serial;
const char *devname;
- if (strcmp(monitor_devices[0],"stdio") != 0)
- return;
+ QTAILQ_FOREACH(mon0, &device_configs, next) {
+ if (mon0->type != DEV_MONITOR)
+ continue;
+ if (strcmp(mon0->cmdline,"stdio") != 0)
+ return;
+ break;
+ }
QTAILQ_FOREACH(serial, &device_configs, next) {
if (serial->type != DEV_SERIAL)
continue;
devname = serial->cmdline;
if (devname && !strcmp(devname,"mon:stdio")) {
- monitor_devices[0] = NULL;
+ QTAILQ_REMOVE(&device_configs, mon0, next);
break;
} else if (devname && !strcmp(devname,"stdio")) {
- monitor_devices[0] = NULL;
+ QTAILQ_REMOVE(&device_configs, mon0, next);
serial->cmdline = "mon:stdio";
break;
}
@@ -4725,6 +4733,32 @@ static int parallel_parse(const char *devname)
return 0;
}
+static int monitor_parse(const char *devname)
+{
+ static int index = 0;
+ char label[32];
+
+ if (strcmp(devname, "none") == 0)
+ return 0;
+ if (index == MAX_MONITOR_DEVICES) {
+ fprintf(stderr, "qemu: too many monitor devices\n");
+ exit(1);
+ }
+ if (index == 0) {
+ snprintf(label, sizeof(label), "monitor");
+ } else {
+ snprintf(label, sizeof(label), "monitor%d", index);
+ }
+ monitor_hds[index] = qemu_chr_open(label, devname, NULL);
+ if (!monitor_hds[index]) {
+ fprintf(stderr, "qemu: could not open monitor device '%s'\n",
+ devname);
+ return -1;
+ }
+ index++;
+ return 0;
+}
+
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
@@ -4740,9 +4774,6 @@ int main(int argc, char **argv, char **envp)
QemuOpts *hda_opts = NULL, *opts;
int optind;
const char *r, *optarg;
- CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
- const char *monitor_devices[MAX_MONITOR_DEVICES];
- int monitor_device_index;
const char *virtio_consoles[MAX_VIRTIO_CONSOLES];
int virtio_console_index;
const char *loadvm = NULL;
@@ -4814,12 +4845,6 @@ int main(int argc, char **argv, char **envp)
virtio_consoles[i] = NULL;
virtio_console_index = 0;
- monitor_devices[0] = "vc:80Cx24C";
- for (i = 1; i < MAX_MONITOR_DEVICES; i++) {
- monitor_devices[i] = NULL;
- }
- monitor_device_index = 0;
-
for (i = 0; i < MAX_NODES; i++) {
node_mem[i] = 0;
node_cpumask[i] = 0;
@@ -5237,12 +5262,8 @@ int main(int argc, char **argv, char **envp)
break;
}
case QEMU_OPTION_monitor:
- if (monitor_device_index >= MAX_MONITOR_DEVICES) {
- fprintf(stderr, "qemu: too many monitor devices\n");
- exit(1);
- }
- monitor_devices[monitor_device_index] = optarg;
- monitor_device_index++;
+ add_device_config(DEV_MONITOR, optarg);
+ default_monitor = 0;
break;
case QEMU_OPTION_chardev:
opts = qemu_opts_parse(&qemu_chardev_opts, optarg, "backend");
@@ -5557,14 +5578,15 @@ int main(int argc, char **argv, char **envp)
add_device_config(DEV_SERIAL, "stdio");
if (default_parallel)
add_device_config(DEV_PARALLEL, "null");
- if (strncmp(monitor_devices[0], "vc", 2) == 0) {
- monitor_devices[0] = "stdio";
- }
+ if (default_monitor)
+ add_device_config(DEV_MONITOR, "stdio");
} else {
if (default_serial)
add_device_config(DEV_SERIAL, "vc:80Cx24C");
if (default_parallel)
add_device_config(DEV_PARALLEL, "vc:80Cx24C");
+ if (default_monitor)
+ add_device_config(DEV_MONITOR, "vc:80Cx24C");
}
if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0)
@@ -5716,7 +5738,7 @@ int main(int argc, char **argv, char **envp)
ram_load, NULL);
/* Maintain compatibility with multiple stdio monitors */
- serial_monitor_mux(monitor_devices);
+ serial_monitor_mux();
if (nb_numa_nodes > 0) {
int i;
@@ -5760,24 +5782,8 @@ int main(int argc, char **argv, char **envp)
}
}
- for (i = 0; i < MAX_MONITOR_DEVICES; i++) {
- const char *devname = monitor_devices[i];
- if (devname && strcmp(devname, "none")) {
- char label[32];
- if (i == 0) {
- snprintf(label, sizeof(label), "monitor");
- } else {
- snprintf(label, sizeof(label), "monitor%d", i);
- }
- monitor_hds[i] = qemu_chr_open(label, devname, NULL);
- if (!monitor_hds[i]) {
- fprintf(stderr, "qemu: could not open monitor device '%s'\n",
- devname);
- exit(1);
- }
- }
- }
-
+ if (foreach_device_config(DEV_MONITOR, monitor_parse) < 0)
+ exit(1);
if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
exit(1);
if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
@@ -5903,7 +5909,7 @@ int main(int argc, char **argv, char **envp)
text_consoles_set_display(display_state);
for (i = 0; i < MAX_MONITOR_DEVICES; i++) {
- if (monitor_devices[i] && monitor_hds[i]) {
+ if (monitor_hds[i]) {
monitor_init(monitor_hds[i],
MONITOR_USE_READLINE |
((i == 0) ? MONITOR_IS_DEFAULT : 0));
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 12/22] zap serial_monitor_mux
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (10 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 11/22] default devices: qemu monitor Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 13/22] default devices: vga adapter Gerd Hoffmann
` (11 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
The logic in this code obviously predates the multiple monitor
capability of qemu and looks increasingly silly these days.
I think the intention of this piece of code is to get a reasonable
default for the -nographic case: have monitor and serial line muxed
on stdio.
With the new default_serial and default_monitor variables we have now
doing just that became much easier ;)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 42 ++++++++----------------------------------
1 files changed, 8 insertions(+), 34 deletions(-)
diff --git a/vl.c b/vl.c
index 0d3f5e6..e3e035f 100644
--- a/vl.c
+++ b/vl.c
@@ -4662,33 +4662,6 @@ static int foreach_device_config(int type, int (*func)(const char *cmdline))
return 0;
}
-static void serial_monitor_mux(void)
-{
- struct device_config *mon0, *serial;
- const char *devname;
-
- QTAILQ_FOREACH(mon0, &device_configs, next) {
- if (mon0->type != DEV_MONITOR)
- continue;
- if (strcmp(mon0->cmdline,"stdio") != 0)
- return;
- break;
- }
- QTAILQ_FOREACH(serial, &device_configs, next) {
- if (serial->type != DEV_SERIAL)
- continue;
- devname = serial->cmdline;
- if (devname && !strcmp(devname,"mon:stdio")) {
- QTAILQ_REMOVE(&device_configs, mon0, next);
- break;
- } else if (devname && !strcmp(devname,"stdio")) {
- QTAILQ_REMOVE(&device_configs, mon0, next);
- serial->cmdline = "mon:stdio";
- break;
- }
- }
-}
-
static int serial_parse(const char *devname)
{
static int index = 0;
@@ -5574,12 +5547,16 @@ int main(int argc, char **argv, char **envp)
qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0);
if (display_type == DT_NOGRAPHIC) {
- if (default_serial)
- add_device_config(DEV_SERIAL, "stdio");
if (default_parallel)
add_device_config(DEV_PARALLEL, "null");
- if (default_monitor)
- add_device_config(DEV_MONITOR, "stdio");
+ if (default_serial && default_monitor) {
+ add_device_config(DEV_SERIAL, "mon:stdio");
+ } else {
+ if (default_serial)
+ add_device_config(DEV_SERIAL, "stdio");
+ if (default_monitor)
+ add_device_config(DEV_MONITOR, "stdio");
+ }
} else {
if (default_serial)
add_device_config(DEV_SERIAL, "vc:80Cx24C");
@@ -5737,9 +5714,6 @@ int main(int argc, char **argv, char **envp)
register_savevm_live("ram", 0, 3, NULL, ram_save_live, NULL,
ram_load, NULL);
- /* Maintain compatibility with multiple stdio monitors */
- serial_monitor_mux();
-
if (nb_numa_nodes > 0) {
int i;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 13/22] default devices: vga adapter.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (11 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 12/22] zap serial_monitor_mux Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 14/22] default devices: add global cmd line option Gerd Hoffmann
` (10 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Qemu creates a vga display for you in case you didn't specify one on the
command line. Right now this is tied to the '-vga <type>' command line
switch, which in turn causes trouble if you are creating your gfx card
using '-device VGA,<props>'.
This patch adds a variable default_vga which says whenever a default
serial line should be added. It is enabled by default. It is cleared
when qemu finds '-vga' or '-device {VGA,Cirrus VGA,QEMUware SVGA}' on
the command line.
'-device VGA' still doesn't work though due to a initialization order
issue (vga must init before calling i440fx_init_memory_mappings).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/vl.c b/vl.c
index e3e035f..444f414 100644
--- a/vl.c
+++ b/vl.c
@@ -193,7 +193,7 @@ int autostart;
static int rtc_utc = 1;
static int rtc_date_offset = -1; /* -1 means no change */
QEMUClock *rtc_clock;
-int vga_interface_type = VGA_CIRRUS;
+int vga_interface_type = VGA_NONE;
#ifdef TARGET_SPARC
int graphic_width = 1024;
int graphic_height = 768;
@@ -275,6 +275,7 @@ static void *boot_set_opaque;
static int default_serial = 1;
static int default_parallel = 1;
static int default_monitor = 1;
+static int default_vga = 1;
static struct {
const char *driver;
@@ -282,6 +283,9 @@ static struct {
} default_list[] = {
{ .driver = "isa-serial", .flag = &default_serial },
{ .driver = "isa-parallel", .flag = &default_parallel },
+ { .driver = "VGA", .flag = &default_vga },
+ { .driver = "Cirrus VGA", .flag = &default_vga },
+ { .driver = "QEMUware SVGA", .flag = &default_vga },
};
static int default_driver_check(QemuOpts *opts, void *opaque)
@@ -4373,6 +4377,7 @@ static void select_vgahw (const char *p)
{
const char *opts;
+ default_vga = 0;
vga_interface_type = VGA_NONE;
if (strstart(p, "std", &opts)) {
vga_interface_type = VGA_STD;
@@ -5565,6 +5570,8 @@ int main(int argc, char **argv, char **envp)
if (default_monitor)
add_device_config(DEV_MONITOR, "vc:80Cx24C");
}
+ if (default_vga)
+ vga_interface_type = VGA_CIRRUS;
if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0)
exit(1);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 14/22] default devices: add global cmd line option.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (12 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 13/22] default devices: vga adapter Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 15/22] default devices: network Gerd Hoffmann
` (9 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Add global command line option to disable default devices.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
qemu-options.hx | 5 +++++
vl.c | 6 ++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 420b7d8..e05b2a0 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1881,6 +1881,11 @@ DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \
STEXI
ETEXI
+DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \
+ "-nodefaults don't create default devices.\n")
+STEXI
+ETEXI
+
#ifndef _WIN32
DEF("chroot", HAS_ARG, QEMU_OPTION_chroot, \
"-chroot dir Chroot to dir just before starting the VM.\n")
diff --git a/vl.c b/vl.c
index 444f414..69b577f 100644
--- a/vl.c
+++ b/vl.c
@@ -5471,6 +5471,12 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_incoming:
incoming = optarg;
break;
+ case QEMU_OPTION_nodefaults:
+ default_serial = 0;
+ default_parallel = 0;
+ default_monitor = 0;
+ default_vga = 0;
+ break;
#ifndef _WIN32
case QEMU_OPTION_chroot:
chroot_dir = optarg;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 15/22] default devices: network
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (13 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 14/22] default devices: add global cmd line option Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 16/22] default devices: drives Gerd Hoffmann
` (8 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Add a default_net variable which specified whenever a default network
should be created. It is cleared in case any -net option is specified
and it is also added to the new -nodefaults switch.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
net.c | 5 ++++-
net.h | 1 +
vl.c | 1 +
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/net.c b/net.c
index 13bdbb2..6ef93e6 100644
--- a/net.c
+++ b/net.c
@@ -39,6 +39,8 @@
static QTAILQ_HEAD(, VLANState) vlans;
static QTAILQ_HEAD(, VLANClientState) non_vlan_clients;
+int default_net = 1;
+
/***********************************************************/
/* network device redirectors */
@@ -1317,7 +1319,7 @@ static int net_init_netdev(QemuOpts *opts, void *dummy)
int net_init_clients(void)
{
- if (QTAILQ_EMPTY(&qemu_net_opts.head)) {
+ if (default_net) {
/* if no clients, we use a default config */
qemu_opts_set(&qemu_net_opts, NULL, "type", "nic");
#ifdef CONFIG_SLIRP
@@ -1353,5 +1355,6 @@ int net_client_parse(QemuOptsList *opts_list, const char *optarg)
return -1;
}
+ default_net = 0;
return 0;
}
diff --git a/net.h b/net.h
index d583d59..4971fcb 100644
--- a/net.h
+++ b/net.h
@@ -139,6 +139,7 @@ struct NICInfo {
extern int nb_nics;
extern NICInfo nd_table[MAX_NICS];
+extern int default_net;
/* BT HCI info */
diff --git a/vl.c b/vl.c
index 69b577f..4825836 100644
--- a/vl.c
+++ b/vl.c
@@ -5476,6 +5476,7 @@ int main(int argc, char **argv, char **envp)
default_parallel = 0;
default_monitor = 0;
default_vga = 0;
+ default_net = 0;
break;
#ifndef _WIN32
case QEMU_OPTION_chroot:
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 16/22] default devices: drives
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (14 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 15/22] default devices: network Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 17/22] un-static qemu_chr_parse_compat() Gerd Hoffmann
` (7 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Add a default_drive variable which specified whenever the default drives
(cdrom, floppy, sd) should be created. It is cleared when the new
-nodefaults switch is specified on the command line.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/vl.c b/vl.c
index 4825836..f64f72e 100644
--- a/vl.c
+++ b/vl.c
@@ -276,6 +276,7 @@ static int default_serial = 1;
static int default_parallel = 1;
static int default_monitor = 1;
static int default_vga = 1;
+static int default_drive = 1;
static struct {
const char *driver;
@@ -5477,6 +5478,7 @@ int main(int argc, char **argv, char **envp)
default_monitor = 0;
default_vga = 0;
default_net = 0;
+ default_drive = 0;
break;
#ifndef _WIN32
case QEMU_OPTION_chroot:
@@ -5709,14 +5711,16 @@ int main(int argc, char **argv, char **envp)
blk_mig_init();
- /* we always create the cdrom drive, even if no disk is there */
- drive_add(NULL, CDROM_ALIAS);
+ if (default_drive) {
+ /* we always create the cdrom drive, even if no disk is there */
+ drive_add(NULL, CDROM_ALIAS);
- /* we always create at least one floppy */
- drive_add(NULL, FD_ALIAS, 0);
+ /* we always create at least one floppy */
+ drive_add(NULL, FD_ALIAS, 0);
- /* we always create one sd slot, even if no card is in it */
- drive_add(NULL, SD_ALIAS);
+ /* we always create one sd slot, even if no card is in it */
+ drive_add(NULL, SD_ALIAS);
+ }
/* open the virtual block devices */
if (snapshot)
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 17/22] un-static qemu_chr_parse_compat()
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (15 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 16/22] default devices: drives Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 18/22] rework -monitor handling, switch to QemuOpts Gerd Hoffmann
` (6 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
qemu-char.c | 2 +-
qemu-char.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index da5c15c..c6008c3 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2231,7 +2231,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
return NULL;
}
-static QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
+QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
{
char host[65], port[33], width[8], height[8];
int pos;
diff --git a/qemu-char.h b/qemu-char.h
index 9957db1..7fa8e5c 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -69,6 +69,7 @@ struct CharDriverState {
QTAILQ_ENTRY(CharDriverState) next;
};
+QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
void (*init)(struct CharDriverState *s));
CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 18/22] rework -monitor handling, switch to QemuOpts
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (16 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 17/22] un-static qemu_chr_parse_compat() Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 19/22] add new -mon switch Gerd Hoffmann
` (5 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
This patch reworks the -monitor handling:
- It adds a new "mon" QemuOpts list for the monitor(s).
- It adds a monitor_parse() function to parse the -monitor switch.
- It adds a mon_init function to initialize the monitor(s) from the
"mon" QemuOpts list.
- It winds up everything and removes the old bits.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
qemu-config.c | 19 +++++++++
qemu-config.h | 1 +
vl.c | 119 ++++++++++++++++++++++++++++++++++++--------------------
3 files changed, 96 insertions(+), 43 deletions(-)
diff --git a/qemu-config.c b/qemu-config.c
index a23b125..c3203c8 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -224,6 +224,24 @@ QemuOptsList qemu_global_opts = {
},
};
+QemuOptsList qemu_mon_opts = {
+ .name = "mon",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_mon_opts.head),
+ .desc = {
+ {
+ .name = "mode",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "chardev",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "default",
+ .type = QEMU_OPT_BOOL,
+ },
+ { /* end if list */ }
+ },
+};
+
static QemuOptsList *lists[] = {
&qemu_drive_opts,
&qemu_chardev_opts,
@@ -232,6 +250,7 @@ static QemuOptsList *lists[] = {
&qemu_net_opts,
&qemu_rtc_opts,
&qemu_global_opts,
+ &qemu_mon_opts,
NULL,
};
diff --git a/qemu-config.h b/qemu-config.h
index 6246e76..34dfadc 100644
--- a/qemu-config.h
+++ b/qemu-config.h
@@ -7,6 +7,7 @@ extern QemuOptsList qemu_device_opts;
extern QemuOptsList qemu_netdev_opts;
extern QemuOptsList qemu_net_opts;
extern QemuOptsList qemu_rtc_opts;
+extern QemuOptsList qemu_mon_opts;
int qemu_set_option(const char *str);
int qemu_global_option(const char *str);
diff --git a/vl.c b/vl.c
index f64f72e..bb9ffd3 100644
--- a/vl.c
+++ b/vl.c
@@ -172,9 +172,6 @@ int main(int argc, char **argv)
#define DEFAULT_RAM_SIZE 128
-/* Maximum number of monitor devices */
-#define MAX_MONITOR_DEVICES 10
-
static const char *data_dir;
const char *bios_name = NULL;
/* Note: drives_table[MAX_DRIVES] is a dummy block driver if none available
@@ -211,7 +208,6 @@ int no_quit = 0;
CharDriverState *serial_hds[MAX_SERIAL_PORTS];
CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
-CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
#ifdef TARGET_I386
int win2k_install_hack = 0;
int rtc_td_hack = 0;
@@ -4630,13 +4626,83 @@ static int chardev_init_func(QemuOpts *opts, void *opaque)
return 0;
}
+static int mon_init_func(QemuOpts *opts, void *opaque)
+{
+ CharDriverState *chr;
+ const char *chardev;
+ const char *mode;
+ int flags;
+
+ mode = qemu_opt_get(opts, "mode");
+ if (mode == NULL) {
+ mode = "readline";
+ }
+ if (strcmp(mode, "readline") == 0) {
+ flags = MONITOR_USE_READLINE;
+ } else if (strcmp(mode, "control") == 0) {
+ flags = MONITOR_USE_CONTROL;
+ } else {
+ fprintf(stderr, "unknown monitor mode \"%s\"\n", mode);
+ exit(1);
+ }
+
+ if (qemu_opt_get_bool(opts, "default", 0))
+ flags |= MONITOR_IS_DEFAULT;
+
+ chardev = qemu_opt_get(opts, "chardev");
+ chr = qemu_chr_find(chardev);
+ if (chr == NULL) {
+ fprintf(stderr, "chardev \"%s\" not found\n", chardev);
+ exit(1);
+ }
+
+ monitor_init(chr, flags);
+ return 0;
+}
+
+static void monitor_parse(const char *optarg)
+{
+ static int monitor_device_index = 0;
+ QemuOpts *opts;
+ const char *p;
+ char label[32];
+ int def = 0;
+
+ if (strstart(optarg, "chardev:", &p)) {
+ snprintf(label, sizeof(label), "%s", p);
+ } else {
+ if (monitor_device_index) {
+ snprintf(label, sizeof(label), "monitor%d",
+ monitor_device_index);
+ } else {
+ snprintf(label, sizeof(label), "monitor");
+ def = 1;
+ }
+ opts = qemu_chr_parse_compat(label, optarg);
+ if (!opts) {
+ fprintf(stderr, "parse error: %s\n", optarg);
+ exit(1);
+ }
+ }
+
+ opts = qemu_opts_create(&qemu_mon_opts, label, 1);
+ if (!opts) {
+ fprintf(stderr, "duplicate chardev: %s\n", label);
+ exit(1);
+ }
+ qemu_opt_set(opts, "mode", "readline");
+ qemu_opt_set(opts, "chardev", label);
+ if (def)
+ qemu_opt_set(opts, "default", "on");
+ monitor_device_index++;
+}
+
struct device_config {
enum {
DEV_USB, /* -usbdevice */
DEV_BT, /* -bt */
DEV_SERIAL, /* -serial */
DEV_PARALLEL, /* -parallel */
- DEV_MONITOR, /* -monitor */
} type;
const char *cmdline;
QTAILQ_ENTRY(device_config) next;
@@ -4712,32 +4778,6 @@ static int parallel_parse(const char *devname)
return 0;
}
-static int monitor_parse(const char *devname)
-{
- static int index = 0;
- char label[32];
-
- if (strcmp(devname, "none") == 0)
- return 0;
- if (index == MAX_MONITOR_DEVICES) {
- fprintf(stderr, "qemu: too many monitor devices\n");
- exit(1);
- }
- if (index == 0) {
- snprintf(label, sizeof(label), "monitor");
- } else {
- snprintf(label, sizeof(label), "monitor%d", index);
- }
- monitor_hds[index] = qemu_chr_open(label, devname, NULL);
- if (!monitor_hds[index]) {
- fprintf(stderr, "qemu: could not open monitor device '%s'\n",
- devname);
- return -1;
- }
- index++;
- return 0;
-}
-
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
@@ -5241,7 +5281,7 @@ int main(int argc, char **argv, char **envp)
break;
}
case QEMU_OPTION_monitor:
- add_device_config(DEV_MONITOR, optarg);
+ monitor_parse(optarg);
default_monitor = 0;
break;
case QEMU_OPTION_chardev:
@@ -5569,7 +5609,7 @@ int main(int argc, char **argv, char **envp)
if (default_serial)
add_device_config(DEV_SERIAL, "stdio");
if (default_monitor)
- add_device_config(DEV_MONITOR, "stdio");
+ monitor_parse("stdio");
}
} else {
if (default_serial)
@@ -5577,7 +5617,7 @@ int main(int argc, char **argv, char **envp)
if (default_parallel)
add_device_config(DEV_PARALLEL, "vc:80Cx24C");
if (default_monitor)
- add_device_config(DEV_MONITOR, "vc:80Cx24C");
+ monitor_parse("vc:80Cx24C");
}
if (default_vga)
vga_interface_type = VGA_CIRRUS;
@@ -5774,8 +5814,6 @@ int main(int argc, char **argv, char **envp)
}
}
- if (foreach_device_config(DEV_MONITOR, monitor_parse) < 0)
- exit(1);
if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
exit(1);
if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
@@ -5900,13 +5938,8 @@ int main(int argc, char **argv, char **envp)
text_consoles_set_display(display_state);
- for (i = 0; i < MAX_MONITOR_DEVICES; i++) {
- if (monitor_hds[i]) {
- monitor_init(monitor_hds[i],
- MONITOR_USE_READLINE |
- ((i == 0) ? MONITOR_IS_DEFAULT : 0));
- }
- }
+ if (qemu_opts_foreach(&qemu_mon_opts, mon_init_func, NULL, 1) != 0)
+ exit(1);
if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) {
fprintf(stderr, "qemu: could not open gdbserver on device '%s'\n",
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 19/22] add new -mon switch
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (17 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 18/22] rework -monitor handling, switch to QemuOpts Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 20/22] add -qmp convinience switch Gerd Hoffmann
` (4 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Add -mon switch which maps pretty straight forward into the QemuOpts
internal representation:
-mon chardev=<name>[,mode=[control|readline]][,[no]default]
Via config file:
[mon]
chardev = "<name>"
mode = "readline"
default = "on"
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
qemu-options.hx | 7 +++++++
vl.c | 8 ++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index e05b2a0..7234447 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1589,6 +1589,13 @@ The default device is @code{vc} in graphical mode and @code{stdio} in
non graphical mode.
ETEXI
+DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
+ "-mon chardev=[name][,mode=readline|control][,default]\n")
+STEXI
+@item -mon chardev=[name][,mode=readline|control][,default]
+Setup monitor on chardev @var{name}.
+ETEXI
+
DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
"-pidfile file write PID to 'file'\n")
STEXI
diff --git a/vl.c b/vl.c
index bb9ffd3..d90975f 100644
--- a/vl.c
+++ b/vl.c
@@ -5284,6 +5284,14 @@ int main(int argc, char **argv, char **envp)
monitor_parse(optarg);
default_monitor = 0;
break;
+ case QEMU_OPTION_mon:
+ opts = qemu_opts_parse(&qemu_mon_opts, optarg, "chardev");
+ if (!opts) {
+ fprintf(stderr, "parse error: %s\n", optarg);
+ exit(1);
+ }
+ default_monitor = 0;
+ break;
case QEMU_OPTION_chardev:
opts = qemu_opts_parse(&qemu_chardev_opts, optarg, "backend");
if (!opts) {
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 20/22] add -qmp convinience switch
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (18 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 19/22] add new -mon switch Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 21/22] default devices: virtio consoles Gerd Hoffmann
` (3 subsequent siblings)
23 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
Acts like -monitor but switched into qmp mode.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
qemu-options.hx | 2 ++
vl.c | 14 +++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 7234447..b8cc375 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1588,6 +1588,8 @@ serial port).
The default device is @code{vc} in graphical mode and @code{stdio} in
non graphical mode.
ETEXI
+DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
+ "-qmp dev like -monitor but opens in 'control' mode.\n")
DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
"-mon chardev=[name][,mode=readline|control][,default]\n")
diff --git a/vl.c b/vl.c
index d90975f..ab77c35 100644
--- a/vl.c
+++ b/vl.c
@@ -4660,7 +4660,7 @@ static int mon_init_func(QemuOpts *opts, void *opaque)
return 0;
}
-static void monitor_parse(const char *optarg)
+static void monitor_parse(const char *optarg, const char *mode)
{
static int monitor_device_index = 0;
QemuOpts *opts;
@@ -4690,7 +4690,7 @@ static void monitor_parse(const char *optarg)
fprintf(stderr, "duplicate chardev: %s\n", label);
exit(1);
}
- qemu_opt_set(opts, "mode", "readline");
+ qemu_opt_set(opts, "mode", mode);
qemu_opt_set(opts, "chardev", label);
if (def)
qemu_opt_set(opts, "default", "on");
@@ -5281,7 +5281,11 @@ int main(int argc, char **argv, char **envp)
break;
}
case QEMU_OPTION_monitor:
- monitor_parse(optarg);
+ monitor_parse(optarg, "readline");
+ default_monitor = 0;
+ break;
+ case QEMU_OPTION_qmp:
+ monitor_parse(optarg, "control");
default_monitor = 0;
break;
case QEMU_OPTION_mon:
@@ -5617,7 +5621,7 @@ int main(int argc, char **argv, char **envp)
if (default_serial)
add_device_config(DEV_SERIAL, "stdio");
if (default_monitor)
- monitor_parse("stdio");
+ monitor_parse("stdio", "readline");
}
} else {
if (default_serial)
@@ -5625,7 +5629,7 @@ int main(int argc, char **argv, char **envp)
if (default_parallel)
add_device_config(DEV_PARALLEL, "vc:80Cx24C");
if (default_monitor)
- monitor_parse("vc:80Cx24C");
+ monitor_parse("vc:80Cx24C", "readline");
}
if (default_vga)
vga_interface_type = VGA_CIRRUS;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 21/22] default devices: virtio consoles.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (19 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 20/22] add -qmp convinience switch Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-10 8:37 ` Markus Armbruster
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x Gerd Hoffmann
` (2 subsequent siblings)
23 siblings, 1 reply; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
This patch adds a variable default_virtcon which says whenever a default
virtio console should be added. It is disabled by default, followup
patch will enable it for s390. It is cleared when qemu finds
'-virtiocon', '-device virtio-console-s390' or '-device
virtio-console-pci' on the command line.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vl.c | 65 +++++++++++++++++++++++++++++++++++------------------------------
1 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/vl.c b/vl.c
index ab77c35..b4138be 100644
--- a/vl.c
+++ b/vl.c
@@ -270,6 +270,7 @@ static void *boot_set_opaque;
static int default_serial = 1;
static int default_parallel = 1;
+static int default_virtcon = 0;
static int default_monitor = 1;
static int default_vga = 1;
static int default_drive = 1;
@@ -280,6 +281,8 @@ static struct {
} default_list[] = {
{ .driver = "isa-serial", .flag = &default_serial },
{ .driver = "isa-parallel", .flag = &default_parallel },
+ { .driver = "virtio-console-pci", .flag = &default_virtcon },
+ { .driver = "virtio-console-s390", .flag = &default_virtcon },
{ .driver = "VGA", .flag = &default_vga },
{ .driver = "Cirrus VGA", .flag = &default_vga },
{ .driver = "QEMUware SVGA", .flag = &default_vga },
@@ -4699,10 +4702,11 @@ static void monitor_parse(const char *optarg, const char *mode)
struct device_config {
enum {
- DEV_USB, /* -usbdevice */
- DEV_BT, /* -bt */
- DEV_SERIAL, /* -serial */
- DEV_PARALLEL, /* -parallel */
+ DEV_USB, /* -usbdevice */
+ DEV_BT, /* -bt */
+ DEV_SERIAL, /* -serial */
+ DEV_PARALLEL, /* -parallel */
+ DEV_VIRTCON, /* -virtioconsole */
} type;
const char *cmdline;
QTAILQ_ENTRY(device_config) next;
@@ -4778,6 +4782,28 @@ static int parallel_parse(const char *devname)
return 0;
}
+static int virtcon_parse(const char *devname)
+{
+ static int index = 0;
+ char label[32];
+
+ if (strcmp(devname, "none") == 0)
+ return 0;
+ if (index == MAX_VIRTIO_CONSOLES) {
+ fprintf(stderr, "qemu: too many virtio consoles\n");
+ exit(1);
+ }
+ snprintf(label, sizeof(label), "virtcon%d", index);
+ virtcon_hds[index] = qemu_chr_open(label, devname, NULL);
+ if (!virtcon_hds[index]) {
+ fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
+ devname, strerror(errno));
+ return -1;
+ }
+ index++;
+ return 0;
+}
+
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
@@ -4793,8 +4819,6 @@ int main(int argc, char **argv, char **envp)
QemuOpts *hda_opts = NULL, *opts;
int optind;
const char *r, *optarg;
- const char *virtio_consoles[MAX_VIRTIO_CONSOLES];
- int virtio_console_index;
const char *loadvm = NULL;
QEMUMachine *machine;
const char *cpu_model;
@@ -4860,10 +4884,6 @@ int main(int argc, char **argv, char **envp)
cyls = heads = secs = 0;
translation = BIOS_ATA_TRANSLATION_AUTO;
- for(i = 0; i < MAX_VIRTIO_CONSOLES; i++)
- virtio_consoles[i] = NULL;
- virtio_console_index = 0;
-
for (i = 0; i < MAX_NODES; i++) {
node_mem[i] = 0;
node_cpumask[i] = 0;
@@ -5322,12 +5342,8 @@ int main(int argc, char **argv, char **envp)
}
break;
case QEMU_OPTION_virtiocon:
- if (virtio_console_index >= MAX_VIRTIO_CONSOLES) {
- fprintf(stderr, "qemu: too many virtio consoles\n");
- exit(1);
- }
- virtio_consoles[virtio_console_index] = optarg;
- virtio_console_index++;
+ add_device_config(DEV_VIRTCON, optarg);
+ default_virtcon = 0;
break;
case QEMU_OPTION_parallel:
add_device_config(DEV_PARALLEL, optarg);
@@ -5527,6 +5543,7 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_nodefaults:
default_serial = 0;
default_parallel = 0;
+ default_virtcon = 0;
default_monitor = 0;
default_vga = 0;
default_net = 0;
@@ -5830,20 +5847,8 @@ int main(int argc, char **argv, char **envp)
exit(1);
if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
exit(1);
-
- for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
- const char *devname = virtio_consoles[i];
- if (devname && strcmp(devname, "none")) {
- char label[32];
- snprintf(label, sizeof(label), "virtcon%d", i);
- virtcon_hds[i] = qemu_chr_open(label, devname, NULL);
- if (!virtcon_hds[i]) {
- fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
- devname, strerror(errno));
- exit(1);
- }
- }
- }
+ if (foreach_device_config(DEV_VIRTCON, virtcon_parse) < 0)
+ exit(1);
module_call_init(MODULE_INIT_DEVICE);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (20 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 21/22] default devices: virtio consoles Gerd Hoffmann
@ 2009-12-08 12:11 ` Gerd Hoffmann
2009-12-10 8:36 ` Markus Armbruster
2009-12-08 18:21 ` [Qemu-devel] Re: [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Luiz Capitulino
2009-12-10 8:39 ` [Qemu-devel] " Markus Armbruster
23 siblings, 1 reply; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, agraf, lcapitulino
All "normal" system emulation targets in qemu I'm aware of display
output on either VGA or serial output.
Our S390x virtio machine doesn't have such kind of legacy hardware. So
instead we need to default to a virtio console.
Add flags to QEMUMachine to indicate which kind of default devices make
sense for the machine in question. Use it for S390x: enable virtcon,
disable serial, parallel and vga.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/boards.h | 4 ++++
hw/s390-virtio.c | 4 ++++
vl.c | 19 ++++++++++++++++++-
3 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/hw/boards.h b/hw/boards.h
index 7a0f20f..8fe0fbc 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -19,6 +19,10 @@ typedef struct QEMUMachine {
QEMUMachineInitFunc *init;
int use_scsi;
int max_cpus;
+ int no_serial:1,
+ no_parallel:1,
+ use_virtcon:1,
+ no_vga:1;
int is_default;
GlobalProperty *compat_props;
struct QEMUMachine *next;
diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index cc21ee6..51c032a 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -243,6 +243,10 @@ static QEMUMachine s390_machine = {
.alias = "s390",
.desc = "VirtIO based S390 machine",
.init = s390_init,
+ .no_serial = 1,
+ .no_parallel = 1,
+ .use_virtcon = 1.
+ .no_vga = 1,
.max_cpus = 255,
.is_default = 1,
};
diff --git a/vl.c b/vl.c
index b4138be..d028931 100644
--- a/vl.c
+++ b/vl.c
@@ -270,7 +270,7 @@ static void *boot_set_opaque;
static int default_serial = 1;
static int default_parallel = 1;
-static int default_virtcon = 0;
+static int default_virtcon = 1;
static int default_monitor = 1;
static int default_vga = 1;
static int default_drive = 1;
@@ -5629,14 +5629,31 @@ int main(int argc, char **argv, char **envp)
qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0);
+ if (machine->no_serial) {
+ default_serial = 0;
+ }
+ if (machine->no_parallel) {
+ default_parallel = 0;
+ }
+ if (!machine->use_virtcon) {
+ default_virtcon = 0;
+ }
+ if (machine->no_vga) {
+ default_vga = 0;
+ }
+
if (display_type == DT_NOGRAPHIC) {
if (default_parallel)
add_device_config(DEV_PARALLEL, "null");
if (default_serial && default_monitor) {
add_device_config(DEV_SERIAL, "mon:stdio");
+ } else if (default_virtcon && default_monitor) {
+ add_device_config(DEV_VIRTCON, "mon:stdio");
} else {
if (default_serial)
add_device_config(DEV_SERIAL, "stdio");
+ if (default_virtcon)
+ add_device_config(DEV_VIRTCON, "stdio");
if (default_monitor)
monitor_parse("stdio", "readline");
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [Qemu-devel] Re: [FOR 0.12 PATCH v4 01/22] default devices: qdev integration.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (21 preceding siblings ...)
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x Gerd Hoffmann
@ 2009-12-08 18:21 ` Luiz Capitulino
2009-12-10 8:39 ` [Qemu-devel] " Markus Armbruster
23 siblings, 0 replies; 33+ messages in thread
From: Luiz Capitulino @ 2009-12-08 18:21 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel, agraf
On Tue, 8 Dec 2009 13:11:32 +0100
Gerd Hoffmann <kraxel@redhat.com> wrote:
> New in v4:
> * Rebased against latest master.
> * Moved the included fixes from (yesterdays) staging to the head
> of this series.
> * Fixed segfault without -monitor switch.
> * Killed noisy debug leftover.
> * Replaced fprintf("fixme") with a real error message.
> * Better commit messages for the monitor changes.
> * Killed the #ifdef for s390 virtio console.
I've ran some basic tests with -monitor, -qmp and -mon and they
all worked. No more segfaults.
> Luiz + Alex, please have a closer look at this.
>
> http://repo.or.cz/w/qemu/kraxel.git/shortlog/refs/heads/default.v4
I've tested that branch for convenience, but of course the
patches should be the same.
^ permalink raw reply [flat|nested] 33+ messages in thread
* [Qemu-devel] Re: [FOR 0.12 PATCH v4 03/22] qdev: also match bus name for global properties
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 03/22] qdev: also match bus name for global properties Gerd Hoffmann
@ 2009-12-09 16:14 ` Michael S. Tsirkin
0 siblings, 0 replies; 33+ messages in thread
From: Michael S. Tsirkin @ 2009-12-09 16:14 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: lcapitulino, qemu-devel, agraf
On Tue, Dec 08, 2009 at 01:11:35PM +0100, Gerd Hoffmann wrote:
> i.e. -global PCI.<property>=<value> will set a default property for all
> PCI devices. Also works for the compat properties used by machine
> types.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Looks like an earlier version of the patches was applied
on staging, and so staging lacks this patch.
> ---
> hw/qdev-properties.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index fe106bd..fb07279 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -614,7 +614,8 @@ void qdev_prop_set_globals(DeviceState *dev)
> GlobalProperty *prop;
>
> QTAILQ_FOREACH(prop, &global_props, next) {
> - if (strcmp(dev->info->name, prop->driver) != 0) {
> + if (strcmp(dev->info->name, prop->driver) != 0 &&
> + strcmp(dev->info->bus_info->name, prop->driver) != 0) {
> continue;
> }
> if (qdev_prop_parse(dev, prop->property, prop->value) != 0) {
> --
> 1.6.5.2
>
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode"
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode" Gerd Hoffmann
@ 2009-12-10 7:59 ` Markus Armbruster
2009-12-10 9:26 ` Gerd Hoffmann
0 siblings, 1 reply; 33+ messages in thread
From: Markus Armbruster @ 2009-12-10 7:59 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: lcapitulino, qemu-devel, agraf
Gerd Hoffmann <kraxel@redhat.com> writes:
> This reverts commit adcb181afe5a951c521411c7a8e9d9b791aa6742.
Would be nice to state why it's reverted, and that it'll be back in a
few commits.
>
> Conflicts:
>
> monitor.h
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
[...]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 06/22] Revert "Set default console to virtio on S390x"
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 06/22] Revert "Set default console to virtio on S390x" Gerd Hoffmann
@ 2009-12-10 8:00 ` Markus Armbruster
0 siblings, 0 replies; 33+ messages in thread
From: Markus Armbruster @ 2009-12-10 8:00 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: lcapitulino, qemu-devel, agraf
Gerd Hoffmann <kraxel@redhat.com> writes:
> This reverts commit 93d434b4aec0702b87ebf52449a3cdf2c3596825.
Same here: would be nice to state why it's reverted, and that it'll be
back in a few commits.
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
[...]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x Gerd Hoffmann
@ 2009-12-10 8:36 ` Markus Armbruster
2009-12-10 9:34 ` Gerd Hoffmann
0 siblings, 1 reply; 33+ messages in thread
From: Markus Armbruster @ 2009-12-10 8:36 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: lcapitulino, qemu-devel, agraf
Gerd Hoffmann <kraxel@redhat.com> writes:
> All "normal" system emulation targets in qemu I'm aware of display
> output on either VGA or serial output.
>
> Our S390x virtio machine doesn't have such kind of legacy hardware. So
> instead we need to default to a virtio console.
>
> Add flags to QEMUMachine to indicate which kind of default devices make
> sense for the machine in question. Use it for S390x: enable virtcon,
> disable serial, parallel and vga.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/boards.h | 4 ++++
> hw/s390-virtio.c | 4 ++++
> vl.c | 19 ++++++++++++++++++-
> 3 files changed, 26 insertions(+), 1 deletions(-)
>
> diff --git a/hw/boards.h b/hw/boards.h
> index 7a0f20f..8fe0fbc 100644
> --- a/hw/boards.h
> +++ b/hw/boards.h
> @@ -19,6 +19,10 @@ typedef struct QEMUMachine {
> QEMUMachineInitFunc *init;
> int use_scsi;
> int max_cpus;
> + int no_serial:1,
> + no_parallel:1,
> + use_virtcon:1,
> + no_vga:1;
> int is_default;
> GlobalProperty *compat_props;
> struct QEMUMachine *next;
Funny indentation.
> diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
> index cc21ee6..51c032a 100644
> --- a/hw/s390-virtio.c
> +++ b/hw/s390-virtio.c
> @@ -243,6 +243,10 @@ static QEMUMachine s390_machine = {
> .alias = "s390",
> .desc = "VirtIO based S390 machine",
> .init = s390_init,
> + .no_serial = 1,
> + .no_parallel = 1,
> + .use_virtcon = 1.
> + .no_vga = 1,
> .max_cpus = 255,
> .is_default = 1,
> };
> diff --git a/vl.c b/vl.c
> index b4138be..d028931 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -270,7 +270,7 @@ static void *boot_set_opaque;
>
> static int default_serial = 1;
> static int default_parallel = 1;
> -static int default_virtcon = 0;
> +static int default_virtcon = 1;
> static int default_monitor = 1;
> static int default_vga = 1;
> static int default_drive = 1;
> @@ -5629,14 +5629,31 @@ int main(int argc, char **argv, char **envp)
>
> qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0);
>
> + if (machine->no_serial) {
> + default_serial = 0;
> + }
> + if (machine->no_parallel) {
> + default_parallel = 0;
> + }
> + if (!machine->use_virtcon) {
> + default_virtcon = 0;
> + }
> + if (machine->no_vga) {
> + default_vga = 0;
> + }
> +
> if (display_type == DT_NOGRAPHIC) {
> if (default_parallel)
> add_device_config(DEV_PARALLEL, "null");
> if (default_serial && default_monitor) {
> add_device_config(DEV_SERIAL, "mon:stdio");
> + } else if (default_virtcon && default_monitor) {
> + add_device_config(DEV_VIRTCON, "mon:stdio");
> } else {
> if (default_serial)
> add_device_config(DEV_SERIAL, "stdio");
> + if (default_virtcon)
> + add_device_config(DEV_VIRTCON, "stdio");
> if (default_monitor)
> monitor_parse("stdio", "readline");
> }
The other default devices could use per-machine suppression, too, but
that can be left for another day.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 21/22] default devices: virtio consoles.
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 21/22] default devices: virtio consoles Gerd Hoffmann
@ 2009-12-10 8:37 ` Markus Armbruster
0 siblings, 0 replies; 33+ messages in thread
From: Markus Armbruster @ 2009-12-10 8:37 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: lcapitulino, qemu-devel, agraf
Gerd Hoffmann <kraxel@redhat.com> writes:
> This patch adds a variable default_virtcon which says whenever a default
> virtio console should be added. It is disabled by default, followup
> patch will enable it for s390. It is cleared when qemu finds
> '-virtiocon', '-device virtio-console-s390' or '-device
> virtio-console-pci' on the command line.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> vl.c | 65 +++++++++++++++++++++++++++++++++++------------------------------
> 1 files changed, 35 insertions(+), 30 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index ab77c35..b4138be 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -270,6 +270,7 @@ static void *boot_set_opaque;
>
> static int default_serial = 1;
> static int default_parallel = 1;
> +static int default_virtcon = 0;
> static int default_monitor = 1;
> static int default_vga = 1;
> static int default_drive = 1;
> @@ -280,6 +281,8 @@ static struct {
> } default_list[] = {
> { .driver = "isa-serial", .flag = &default_serial },
> { .driver = "isa-parallel", .flag = &default_parallel },
> + { .driver = "virtio-console-pci", .flag = &default_virtcon },
> + { .driver = "virtio-console-s390", .flag = &default_virtcon },
> { .driver = "VGA", .flag = &default_vga },
> { .driver = "Cirrus VGA", .flag = &default_vga },
> { .driver = "QEMUware SVGA", .flag = &default_vga },
> @@ -4699,10 +4702,11 @@ static void monitor_parse(const char *optarg, const char *mode)
>
> struct device_config {
> enum {
> - DEV_USB, /* -usbdevice */
> - DEV_BT, /* -bt */
> - DEV_SERIAL, /* -serial */
> - DEV_PARALLEL, /* -parallel */
> + DEV_USB, /* -usbdevice */
> + DEV_BT, /* -bt */
> + DEV_SERIAL, /* -serial */
> + DEV_PARALLEL, /* -parallel */
> + DEV_VIRTCON, /* -virtioconsole */
Elaborate comment decorations mess up git-blame. Just say no.
> } type;
> const char *cmdline;
> QTAILQ_ENTRY(device_config) next;
[...]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration.
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
` (22 preceding siblings ...)
2009-12-08 18:21 ` [Qemu-devel] Re: [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Luiz Capitulino
@ 2009-12-10 8:39 ` Markus Armbruster
23 siblings, 0 replies; 33+ messages in thread
From: Markus Armbruster @ 2009-12-10 8:39 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: lcapitulino, qemu-devel, agraf
Gerd Hoffmann <kraxel@redhat.com> writes:
> Hi,
>
> Qemu creates a bunch of default devices (serial, parallel, vga, ...) if
> the user didn't specify one on the command line. Unfortunaly this
> doesn't work well with the qdev way of doing things because this logic
> is tied to the -serial, -parallel, ... command line switches. Devices
> created via -device are ignored. This patch set fixes this. It also
> adds a command line switch to disable all default devices and does a few
> cleanups in the code touched anyway.
>
> New in v3: Rebased against latest master. Two patches (qmp monitor +
> s390 console) came into the way. Because the way how serial lines and
> the monitor are initialized changes quite heavily it looked alot cleaner
> to me just revert those patches, apply the v2 patches, then reimplement
> the two patches on top of that.
>
> New in v4:
> * Rebased against latest master.
> * Moved the included fixes from (yesterdays) staging to the head
> of this series.
> * Fixed segfault without -monitor switch.
> * Killed noisy debug leftover.
> * Replaced fprintf("fixme") with a real error message.
> * Better commit messages for the monitor changes.
> * Killed the #ifdef for s390 virtio console.
>
> Luiz + Alex, please have a closer look at this.
>
> http://repo.or.cz/w/qemu/kraxel.git/shortlog/refs/heads/default.v4
>
> thanks,
> Gerd
Series looks good to me, my nitpicking on some of its parts
notwithstanding. Without it, chardev entries in configuration files are
broken, -device doesn't work for the first serial, parallel, NIC, and
-drive doesn't work for first CD-ROM, floppy or SD. These are important
fixes, so please consider for 0.12.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode"
2009-12-10 7:59 ` Markus Armbruster
@ 2009-12-10 9:26 ` Gerd Hoffmann
0 siblings, 0 replies; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-10 9:26 UTC (permalink / raw)
To: Markus Armbruster; +Cc: agraf, qemu-devel, lcapitulino
On 12/10/09 08:59, Markus Armbruster wrote:
> Gerd Hoffmann<kraxel@redhat.com> writes:
>
>> This reverts commit adcb181afe5a951c521411c7a8e9d9b791aa6742.
>
> Would be nice to state why it's reverted, and that it'll be back in a
> few commits.
Is mentioned in the 00/22 intro text. But, yea, that one doesn't end up
in the chaneglog, so it is indeed a good idea to add this here too.
cheers,
Gerd
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x
2009-12-10 8:36 ` Markus Armbruster
@ 2009-12-10 9:34 ` Gerd Hoffmann
2009-12-10 9:44 ` Markus Armbruster
0 siblings, 1 reply; 33+ messages in thread
From: Gerd Hoffmann @ 2009-12-10 9:34 UTC (permalink / raw)
To: Markus Armbruster; +Cc: agraf, qemu-devel, lcapitulino
>
> The other default devices could use per-machine suppression, too, but
> that can be left for another day.
>
Indeed. default_drive should probably be splitted so
sd-card/floppy/cdrom can be set separately, then we can start disabling
them for machine types which don't use them. Probably most boards have
either sdcard (embedded) or cdrom (normal computers), but rarely both ...
I didn't want to grow the patch series even more though and I don't
think this is a must-have for 0.12 ...
cheers,
Gerd
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x
2009-12-10 9:34 ` Gerd Hoffmann
@ 2009-12-10 9:44 ` Markus Armbruster
0 siblings, 0 replies; 33+ messages in thread
From: Markus Armbruster @ 2009-12-10 9:44 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: agraf, qemu-devel, lcapitulino
Gerd Hoffmann <kraxel@redhat.com> writes:
>>
>> The other default devices could use per-machine suppression, too, but
>> that can be left for another day.
>>
>
> Indeed. default_drive should probably be splitted so
> sd-card/floppy/cdrom can be set separately, then we can start
> disabling them for machine types which don't use them. Probably most
> boards have either sdcard (embedded) or cdrom (normal computers), but
> rarely both ...
>
> I didn't want to grow the patch series even more though and I don't
> think this is a must-have for 0.12 ...
Agreed.
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2009-12-10 9:45 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-08 12:11 [Qemu-devel] [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 01/22] qdev: make compat stuff more generic Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 02/22] qdev: add command line option to set global defaults for properties Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 03/22] qdev: also match bus name for global properties Gerd Hoffmann
2009-12-09 16:14 ` [Qemu-devel] " Michael S. Tsirkin
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 04/22] chardev: make chardevs specified in config file work Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode" Gerd Hoffmann
2009-12-10 7:59 ` Markus Armbruster
2009-12-10 9:26 ` Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 06/22] Revert "Set default console to virtio on S390x" Gerd Hoffmann
2009-12-10 8:00 ` Markus Armbruster
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 07/22] chardev: move greeting into vc backend Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 08/22] vc: colorize chardev title line with blue background Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 09/22] default devices: core code & serial lines Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 10/22] default devices: parallel port Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 11/22] default devices: qemu monitor Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 12/22] zap serial_monitor_mux Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 13/22] default devices: vga adapter Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 14/22] default devices: add global cmd line option Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 15/22] default devices: network Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 16/22] default devices: drives Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 17/22] un-static qemu_chr_parse_compat() Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 18/22] rework -monitor handling, switch to QemuOpts Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 19/22] add new -mon switch Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 20/22] add -qmp convinience switch Gerd Hoffmann
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 21/22] default devices: virtio consoles Gerd Hoffmann
2009-12-10 8:37 ` Markus Armbruster
2009-12-08 12:11 ` [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x Gerd Hoffmann
2009-12-10 8:36 ` Markus Armbruster
2009-12-10 9:34 ` Gerd Hoffmann
2009-12-10 9:44 ` Markus Armbruster
2009-12-08 18:21 ` [Qemu-devel] Re: [FOR 0.12 PATCH v4 01/22] default devices: qdev integration Luiz Capitulino
2009-12-10 8:39 ` [Qemu-devel] " Markus Armbruster
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).