default devices: qdev integration.
PATCH v4 1/22 default devices: qdev integration.
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
PATCH v4 1/22 qdev: make compat stuff more generic
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.
--- 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(-)
hw/boards.h +1 -1
@@ -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;
hw/pc.c +1 -1
@@ -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" ,
hw/qdev-properties.c +14 -8
@@ -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 ; }
hw/qdev.c +1 -1
@@ -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);
hw/qdev.h +6 -4
@@ -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;
vl.c +1 -1
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v4 2/22 qdev: add command line option to set global defaults for properties.
In reply to Gerd HoffmannThis 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.
--- qemu-config.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ qemu-config.h | 2 + qemu-options.hx | 3 ++ vl.c | 6 +++++ 4 files changed, 67 insertions(+), 0 deletions(-)
qemu-config.c +56 -0
@@ -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;
qemu-config.h +2 -0
@@ -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);
qemu-options.hx +3 -0
@@ -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}[,...]]]
vl.c +6 -0
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v4 3/22 qdev: also match bus name for global properties
In reply to Gerd Hoffmanni.e. -global PCI.<property>=<value> will set a default property for all PCI devices. Also works for the compat properties used by machine types.
--- hw/qdev-properties.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
hw/qdev-properties.c +2 -1
@@ -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 ) {
Signature · 1 line
1.6.5.2
[Qemu-devel] Re: [FOR 0.12 PATCH v4 03/22] qdev: also match bus name for global properties
Quoted 5 lines · Gerd Hoffmann
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 <[email protected]>
Looks like an earlier version of the patches was applied on staging, and so staging lacks this patch.
Quoted 22 lines
--- hw/qdev-properties.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)hw/qdev-properties.c +2
-1@@ -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 ) {Signature · 1 line
1.6.5.2
PATCH v4 4/22 chardev: make chardevs specified in config file work.
In reply to Gerd HoffmannThe patch decuples the -chardev switch and the actual chardev initialization. Without this patch qemu ignores chardev entries coming via -readconfig.
--- vl.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
vl.c +13 -3
@@ -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 _WIN32if (daemonize) {pid_t pid;
Signature · 1 line
1.6.5.2
PATCH v4 5/22 Revert "monitor: Command-line flag to enable control mode"
In reply to Gerd HoffmannThis reverts commit adcb181afe5a951c521411c7a8e9d9b791aa6742.
Conflicts:
monitor.h
--- monitor.c | 18 ------------------ monitor.h | 1 - qemu-options.hx | 5 ++--- vl.c | 11 ++++------- 4 files changed, 6 insertions(+), 29 deletions(-)
monitor.c +0 -18
@@ -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 ;
monitor.h +0 -1
@@ -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);
qemu-options.hx +2 -3
@@ -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, \
vl.c +4 -7
@@ -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 )); } }
Signature · 1 line
1.6.5.2
Re: [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode"
Quoted 1 line · Gerd Hoffmann
This reverts commit
adcb181afe5a951c521411c7a8e9d9b791aa6742.
Would be nice to state why it's reverted, and that it'll be back in a few commits.
Quoted 6 lines
Conflicts:
monitor.hSigned-off-by Gerd Hoffmann <[email protected]>
[...]
Re: [Qemu-devel] [FOR 0.12 PATCH v4 05/22] Revert "monitor: Command-line flag to enable control mode"
Quoted 6 lines · Markus Armbruster
Quoted 1 line · Gerd Hoffmann
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
PATCH v4 6/22 Revert "Set default console to virtio on S390x"
In reply to Gerd HoffmannThis reverts commit 93d434b4aec0702b87ebf52449a3cdf2c3596825.
--- vl.c | 26 -------------------------- 1 files changed, 0 insertions(+), 26 deletions(-)
vl.c +0 -26
@@ -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 ) {
Signature · 1 line
1.6.5.2
Re: [Qemu-devel] [FOR 0.12 PATCH v4 06/22] Revert "Set default console to virtio on S390x"
Quoted 1 line · Gerd Hoffmann
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.
Quoted 1 line
Signed-off-by Gerd Hoffmann <[email protected]>
[...]
PATCH v4 7/22 chardev: move greeting into vc backend.
In reply to Gerd HoffmannMake 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.
--- console.c | 8 ++++++++ vl.c | 24 ------------------------ 2 files changed, 8 insertions(+), 24 deletions(-)
console.c +8 -0
@@ -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);
vl.c +0 -24
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v4 8/22 vc: colorize chardev title line with blue background.
In reply to Gerd Hoffmann--- console.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
console.c +2 -0
@@ -1388,8 +1388,10 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, QemuOptchar 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);
Signature · 1 line
1.6.5.2
PATCH v4 9/22 default devices: core code & serial lines.
In reply to Gerd HoffmannQemu 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.
--- vl.c | 122 +++++++++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 81 insertions(+), 41 deletions(-)
vl.c +81 -41
@@ -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];
Signature · 1 line
1.6.5.2
PATCH v4 10/22 default devices: parallel port.
In reply to Gerd HoffmannQemu 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.
--- vl.c | 64 ++++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 34 insertions(+), 30 deletions(-)
vl.c +34 -30
@@ -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];
Signature · 1 line
1.6.5.2
PATCH v4 11/22 default devices: qemu monitor.
In reply to Gerd HoffmannThis 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.
--- vl.c | 94 +++++++++++++++++++++++++++++++++++------------------------------- 1 files changed, 50 insertions(+), 44 deletions(-)
vl.c +50 -44
@@ -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 ));
Signature · 1 line
1.6.5.2
PATCH v4 12/22 zap serial_monitor_mux
In reply to Gerd HoffmannThe 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 ;)
--- vl.c | 42 ++++++++---------------------------------- 1 files changed, 8 insertions(+), 34 deletions(-)
vl.c +8 -34
@@ -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;
Signature · 1 line
1.6.5.2
PATCH v4 13/22 default devices: vga adapter.
In reply to Gerd HoffmannQemu 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).
--- vl.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
vl.c +8 -1
@@ -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 );
Signature · 1 line
1.6.5.2
PATCH v4 14/22 default devices: add global cmd line option.
In reply to Gerd HoffmannAdd global command line option to disable default devices.
--- qemu-options.hx | 5 +++++ vl.c | 6 ++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
qemu-options.hx +5 -0
@@ -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")
vl.c +6 -0
@@ -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 _WIN32case QEMU_OPTION_chroot: chroot_dir = optarg;
Signature · 1 line
1.6.5.2
PATCH v4 15/22 default devices: network
In reply to Gerd HoffmannAdd 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.
--- net.c | 5 ++++- net.h | 1 + vl.c | 1 + 3 files changed, 6 insertions(+), 1 deletions(-)
net.c +4 -1
@@ -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 ; }
net.h +1 -0
@@ -139,6 +139,7 @@ struct NICInfo {extern int nb_nics;extern NICInfo nd_table[MAX_NICS ]; +extern int default_net;/* BT HCI info */
vl.c +1 -0
@@ -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 _WIN32case QEMU_OPTION_chroot:
Signature · 1 line
1.6.5.2
PATCH v4 16/22 default devices: drives
In reply to Gerd HoffmannAdd 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.
--- vl.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-)
vl.c +10 -6
@@ -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 _WIN32case 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)
Signature · 1 line
1.6.5.2
PATCH v4 17/22 un-static qemu_chr_parse_compat()
In reply to Gerd Hoffmann--- qemu-char.c | 2 +- qemu-char.h | 1 + 2 files changed, 2 insertions(+), 1 deletions(-)
qemu-char.c +1 -1
@@ -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;
qemu-char.h +1 -0
@@ -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));
Signature · 1 line
1.6.5.2
PATCH v4 18/22 rework -monitor handling, switch to QemuOpts
In reply to Gerd HoffmannThis 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.
--- qemu-config.c | 19 +++++++++ qemu-config.h | 1 + vl.c | 119 ++++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 96 insertions(+), 43 deletions(-)
qemu-config.c +19 -0
@@ -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, };
qemu-config.h +1 -0
@@ -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);
vl.c +76 -43
179 lines not on this page · raw message
Signature · 1 line
1.6.5.2
PATCH v4 19/22 add new -mon switch
In reply to Gerd HoffmannAdd -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"
--- qemu-options.hx | 7 +++++++ vl.c | 8 ++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
qemu-options.hx +7 -0
@@ -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
vl.c +8 -0
@@ -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) {
Signature · 1 line
1.6.5.2
PATCH v4 20/22 add -qmp convinience switch
In reply to Gerd HoffmannActs like -monitor but switched into qmp mode.
--- qemu-options.hx | 2 ++ vl.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-)
qemu-options.hx +2 -0
@@ -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")
vl.c +9 -5
@@ -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 ;
Signature · 1 line
1.6.5.2
PATCH v4 21/22 default devices: virtio consoles.
In reply to Gerd HoffmannThis 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.
--- vl.c | 65 +++++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 35 insertions(+), 30 deletions(-)
vl.c +35 -30
@@ -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 );
Signature · 1 line
1.6.5.2
Re: [Qemu-devel] [FOR 0.12 PATCH v4 21/22] default devices: virtio consoles.
Quoted 35 lines · Gerd Hoffmann
This patch adds a variable
default_virtconwhich 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 <[email protected]>--- vl.c | 65 +++++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 35 insertions(+), 30 deletions(-)vl.c +3
-0@@ -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 {
vl.c static void monitor_parse(const char *optarg, const char *mode) · line 4709
Quoted 10 lines
vl.c +5
-4enum { -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.
Quoted 3 lines
vl.c +0
-0} type;const char *cmdline;QTAILQ_ENTRY (device_config) next;
[...]
PATCH v4 22/22 Set default console to virtio on S390x
In reply to Gerd HoffmannAll "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.
--- hw/boards.h | 4 ++++ hw/s390-virtio.c | 4 ++++ vl.c | 19 ++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletions(-)
hw/boards.h +4 -0
@@ -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;
hw/s390-virtio.c +4 -0
@@ -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, };
vl.c +18 -1
@@ -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" ); }
Signature · 1 line
1.6.5.2
Re: [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x
Quoted 22 lines · Gerd Hoffmann
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 <[email protected]>--- hw/boards.h | 4 ++++ hw/s390-virtio.c | 4 ++++ vl.c | 19 ++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletions(-)hw/boards.h +0
-0
hw/boards.h typedef struct QEMUMachine { · line 28
Quoted 10 lines
hw/boards.h +4
-0@@ -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.
Quoted 50 lines
hw/s390-virtio.c +4
-0@@ -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, };vl.c +14
-1@@ -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" );
vl.c int main(int argc, char **argv, char **envp) · line 5659
Quoted 10 lines
vl.c +4
-0+ }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.
Re: [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x
Quoted 4 lines
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
Re: [Qemu-devel] [FOR 0.12 PATCH v4 22/22] Set default console to virtio on S390x
Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines
The other default devices could use per-machine suppression, too, but that can be left for another day.
Quoted 8 lines
Indeed.
default_driveshould 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.
Quoted 9 lines · On Tue, 8 Dec 2009 13:11:32 +0100 Gerd Hoffmann <[email protected]> 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.
* Replacedfprintf("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.
Quoted 3 lines
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.
Quoted 26 lines · Gerd Hoffmann
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.
* Replacedfprintf("fixme")with a real error message.
* Better commit messages for the monitor changes.
* Killed the #ifdef for s390 virtio console.
Quoted 6 lines
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.