summaryrefslogtreecommitdiffstats
path: root/vl.c
Commit message (Collapse)AuthorAgeFilesLines
* virtio-console: qdev conversion, new virtio-serial-busAmit Shah2010-01-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit converts the virtio-console device to create a new virtio-serial bus that can host console and generic serial ports. The file hosting this code is now called virtio-serial-bus.c. The virtio console is now a very simple qdev device that sits on the virtio-serial-bus and communicates between the bus and qemu's chardevs. This commit also includes a few changes to the virtio backing code for pci and s390 to spawn the virtio-serial bus. As a result of the qdev conversion, we get rid of a lot of legacy code. The old-style way of instantiating a virtio console using -virtioconsole ... is maintained, but the new, preferred way is to use -device virtio-serial -device virtconsole,chardev=... With this commit, multiple devices as well as multiple ports with a single device can be supported. For multiple ports support, each port gets an IO vq pair. Since the guest needs to know in advance how many vqs a particular device will need, we have to set this number as a property of the virtio-serial device and also as a config option. In addition, we also spawn a pair of control IO vqs. This is an internal channel meant for guest-host communication for things like port open/close, sending port properties over to the guest, etc. This commit is a part of a series of other commits to get the full implementation of multiport support. Future commits will add other support as well as ride on the savevm version that we bump up here. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Clean-up a little bit the RW related bits of BDRV_O_FLAGS. BDRV_O_RDONLY ↵Naphtali Sprei2010-01-201-4/+4
| | | | | | | | | | gone (and so is BDRV_O_ACCESS). Default value for bdrv_flags (0/zero) is READ-ONLY. Need to explicitly request READ-WRITE. Instead of using the field 'readonly' of the BlockDriverState struct for passing the request, pass the request in the flags parameter to the function. Signed-off-by: Naphtali Sprei <nsprei@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make CDROM a read-only driveNaphtali Sprei2010-01-201-0/+7
| | | | | Signed-off-by: Naphtali Sprei <nsprei@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vl.c: Remove dead assignmentAmit Shah2010-01-131-5/+1
| | | | | | | | clang-analyzer pointed out the value of 'sockets' is never reused. Signed-off-by: Amit Shah <amit.shah@redhat.com> CC: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* move kbd/mouse handling to input.cPaolo Bonzini2010-01-131-212/+2
| | | | | | | | Move 200 lines out of vl.c already into common code that only needs to be compiled once. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix CPU topology initializationJiri Denemark2010-01-111-4/+4
| | | | | | | | Late initialization of CPU topology in CPUState prevents KVM guests to actually see the topology. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* debugcon: support for debugging consoles (e.g. Bochs port 0xe9)H. Peter Anvin2010-01-081-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add generic support for debugging consoles (simple I/O ports which when written to cause debugging output to be written to a target.) The current implementation matches Bochs' port 0xe9, allowing the same debugging code to be used for both Bochs and Qemu. There is no vm state associated with the debugging port, simply because it has none -- the entire interface is a single, stateless, write-only port. Most of the code was cribbed from the serial port driver. v2: removed non-ISA variants (they can be introduced when/if someone wants them, using code from the serial port); added configurable readback (Bochs returns 0xe9 on a read from this register, mimic that by default) This retains the apparently somewhat controversial user friendly option, however. v3: reimplemented the user friendly option as a synthetic option ("-debugcon foo" basically ends up being a parser-level shorthand for "-chardev stdio,id=debugcon -device isa-debugcon,chardev=debugcon") -- this dramatically reduced the complexity while keeping the same level of user friendliness. v4: spaces, not tabs. v5: update to match current top of tree. Calling qemu_chr_open() already during parsing no longer works; defer until we are parsing the other console-like devices. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* USB: Improve usbdevice error messagesScott Tsai2009-12-231-3/+14
| | | | | | | | | When an non-existent USB device is specified on the command line, print "qemu: could not add USB device 'X'". Likewise for the usb_{add,del} monitor commands. Signed-off-by: Scott Tsai <scottt.tw@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* fix pidfile option to work in WIN32Juha Riihimäki2009-12-181-1/+3
| | | | | | | | | | | | | | Explicit read/write locking pidfile under WIN32 is bit extreme nobody get the chance to read the pidfile. Convert to a write-only lock. Also, creating pidfile was disabled along with daemonize under WIN32. Enable it, but do not enable daemon support which doesn't exist under WIN32 atm. From: Juha Riihimäki <juha.riihimaki@nokia.com> Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com> Signed-off-by: Riku Voipio <riku.voipio@nokia.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* fix vga names in default_listGerd Hoffmann2009-12-181-2/+2
| | | | | | | | Fix mismerge between 64465297 and 556cd098. Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* usb-net: use qdev for -usbdeviceGerd Hoffmann2009-12-181-18/+0
| | | | | | | | Rebased to master, adapted to device renaming by armbru, no other changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Check rom_load_all() return value.Gerd Hoffmann2009-12-181-1/+4
| | | | | | | | Check rom_load_all() return value. Also don't make option rom loading failure fatal. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* defaults: update device_list[]Gerd Hoffmann2009-12-181-0/+3
| | | | | | | | | | | Add isa-fdc (disables default_floppy). Add ide-drive (disables default_cdrom). Also walk the -global QemuOpts, so we'll catch -global isa-fdc.drive{A,B}=<name> too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* defaults: split default_driveGerd Hoffmann2009-12-181-3/+20
| | | | | | | | Split default_drive into default_{floppy,cdrom,sdcard}. Also add QEMUMachine flags to disable them per machine. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Rename DriveInfo.onerror to on_write_error" (fix mismerge)Kevin Wolf2009-12-181-4/+0
| | | | | | | | | | | | Part of the first patch of the -drive rerror series has been merged once more on top of the rest of the series. This effectively disables the rerror option and always goes with the default value. Reverting the commit re-enables the option. This reverts commit fc072ec4df0996682dfbff6c735e2bbc0d93132f. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add default virtcon initializationAlexander Graf2009-12-181-0/+2
| | | | | | | | | | | When going through the default devices, we don't initialize the virtio console, unless we're doing -nographic. I suppose that's just a leftover from the recent code restructuring, so let's put it in. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* monitor: Convert do_info_mice() to QObjectLuiz Capitulino2009-12-121-7/+55
| | | | | | | | | | Each mouse is represented by a QDict, the returned QObject is a QList of all mice. This commit should not change user output. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Set default console to virtio on S390xGerd Hoffmann2009-12-121-1/+18
| | | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: virtio consoles.Gerd Hoffmann2009-12-121-30/+35
| | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add -qmp convinience switchGerd Hoffmann2009-12-121-5/+9
| | | | | | | Acts like -monitor but switched into qmp mode. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add new -mon switchGerd Hoffmann2009-12-121-0/+8
| | | | | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rework -monitor handling, switch to QemuOptsGerd Hoffmann2009-12-121-43/+76
| | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: drivesGerd Hoffmann2009-12-121-6/+10
| | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: networkGerd Hoffmann2009-12-121-0/+1
| | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: add global cmd line option.Gerd Hoffmann2009-12-121-0/+6
| | | | | | | Add global command line option to disable default devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: vga adapter.Gerd Hoffmann2009-12-121-1/+8
| | | | | | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* zap serial_monitor_muxGerd Hoffmann2009-12-121-34/+8
| | | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: qemu monitor.Gerd Hoffmann2009-12-121-44/+50
| | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: parallel port.Gerd Hoffmann2009-12-121-30/+34
| | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: core code & serial lines.Gerd Hoffmann2009-12-121-41/+81
| | | | | | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* chardev: move greeting into vc backend.Gerd Hoffmann2009-12-121-24/+0
| | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Set default console to virtio on S390x"Gerd Hoffmann2009-12-121-26/+0
| | | | | | | This reverts commit 93d434b4aec0702b87ebf52449a3cdf2c3596825. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "monitor: Command-line flag to enable control mode"Gerd Hoffmann2009-12-121-7/+4
| | | | | | | | | | | This reverts commit adcb181afe5a951c521411c7a8e9d9b791aa6742. Conflicts: monitor.h Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* chardev: make chardevs specified in config file work.Gerd Hoffmann2009-12-121-3/+13
| | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: add command line option to set global defaults for properties.Gerd Hoffmann2009-12-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: make compat stuff more genericGerd Hoffmann2009-12-121-1/+1
| | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Set default console to virtio on S390xAlexander Graf2009-12-051-0/+26
| | | | | | | | | | | | | | | 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. I'm not particularly proud of this patch. It would be a lot better to have something in the machine description that tells us about the default terminal. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* monitor: rename EVENT_* to QEVENT_* to avoid conflict on mingw32Blue Swirl2009-12-041-5/+5
| | | | | | Partially fixes mingw32 build. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Rename DriveInfo.onerror to on_write_errorKevin Wolf2009-12-031-0/+4
| | | | | | | | Either rename variables and functions to refer to write errors (which is what they actually do) or introduce a parameter to distinguish reads and writes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Don't leak file descriptorsKevin Wolf2009-12-031-4/+7
| | | | | | | | We're leaking file descriptors to child processes. Set FD_CLOEXEC on file descriptors that don't need to be passed to children to stop this misbehaviour. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio-blk: Implement rerror optionKevin Wolf2009-12-031-1/+1
| | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ide: Implement rerror optionKevin Wolf2009-12-031-1/+1
| | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce rerror option for drivesKevin Wolf2009-12-031-19/+40
| | | | | | | | | | | | | rerror controls the action to be taken when an error occurs while accessing the guest image file. It corresponds to werror which already controls the action take for write errors. This purely introduces parsing rerror command line option into the right structures, real support for it in the device emulation is added in the following patches. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Rename DriveInfo.onerror to on_write_errorKevin Wolf2009-12-031-3/+8
| | | | | | | | Either rename variables and functions to refer to write errors (which is what they actually do) or introduce a parameter to distinguish reads and writes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ram migration: Properly reset statisticsJan Kiszka2009-12-031-1/+3
| | | | | | | | As we may do more than one migration (cancellation, live backup), reset bytes_transferred on stage 1. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* live migration: Propagate output monitor to callback handlerJan Kiszka2009-12-031-1/+1
| | | | | | | | | In order to allow proper progress reporting to the monitor that initiated the migration, forward the monitor reference through the migration layer down to SaveLiveStateHandler. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* live migration: Allow cleanup after cancellation or errorJan Kiszka2009-12-031-0/+5
| | | | | | | | | | Introduce qemu_savevm_state_cancel and inject a stage -1 to cancel a live migration. This gives the involved subsystems a chance to clean up dynamically allocated resources. Namely, the block migration layer can now free its device descriptors and pending blocks. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ram migration: Stop loading on errorJan Kiszka2009-12-031-1/+5
| | | | | | | | Besides catching real errors, this also allows to interrrupt the qemu process during restore. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move slirp code from net.c to net/slirp.cMark McLoughlin2009-12-031-0/+1
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QMP: Introduce basic asynchronous eventsLuiz Capitulino2009-12-031-2/+9
| | | | | | | | Debug, shutdown, reset, powerdown and stop are all basic events, as they are very simple they can be added in the same commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud