summaryrefslogtreecommitdiffstats
path: root/vl.c
Commit message (Collapse)AuthorAgeFilesLines
* Make strtosz() return int64_t instead of ssize_tJes Sorensen2011-01-241-2/+2
| | | | | | | | | strtosz() needs to return a 64 bit type even on 32 bit architectures. Otherwise qemu-img will fail to create disk images >= 2GB Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori2011-01-101-1/+3
|\
| * qbus: register reset handler for qbus whose parent is NULLIsaku Yamahata2010-12-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stefan Weil reported the regression caused by ec990eb622ad46df5ddcb1e94c418c271894d416 as follows > The second regression also occurs with MIPS malta. > Networking no longer works with the default pcnet nic. > > This is caused because the reset function for pcnet is no > longer called during system boot. The result in an invalid > mac address (all zero) and a non-working nic. > > For this second regression I still have no simple solution. > Of course mips_malta.c should be converted to qdev which > would fix both problems (but only for malta system emulation). The issue is, it is assumed that all qbuses, qdeves are under main_system_bus. But there are qbuses whose parent is NULL. So it is necessary to trigger reset for those qbuses. (On the other hand, if NULL is passed to qdev_create(), its parent bus is main_system_bus.) Ideally those buses should be moved under bus controller device which is qdev. But it's not done yet. So register qbus reset handler for qbus whose parent is NULL. Reported-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | Merge branch 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemuAurelien Jarno2010-12-271-1/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemu: vnc/spice: add set_passwd monitor command. vnc: support password expire vnc: auth reject cleanup spice: add qmp 'query-spice' and hmp 'info spice' commands. spice: connection events. spice: add qxl device spice: add qxl vgabios binary.
| * | spice: add qxl deviceGerd Hoffmann2010-12-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qxl is a paravirtual graphics card. The qxl device is the bridge between the guest and the spice server (aka libspice-server). The spice server will send the rendering commands to the spice client, which will actually render them. The spice server is also able to render locally, which is done in case the guest wants read something from video memory. Local rendering is also used to support display over vnc and sdl. qxl is activated using "-vga qxl". qxl supports multihead, additional cards can be added via '-device qxl". [ v2: add copyright to files ] [ v2: use qemu-common.h for standard includes ] [ v2: create separate qxl-vga device for primary ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | | Fix a missing trailing newlineAurelien Jarno2010-12-271-1/+1
| | | | | | | | | | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* | | Avoid a warning from OpenBSD linkerBlue Swirl2010-12-191-2/+4
| |/ |/| | | | | | | | | | | | | Avoid the warning below by using snprintf: ../libhw64/vl.o(.text+0x78d4): In function `get_boot_devices_list': /src/qemu/vl.c:763: warning: sprintf() is often misused, please use snprintf() Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Pass boot device list to firmware.Gleb Natapov2010-12-111-0/+48
| | | | | | | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Add notifier that will be called when machine is fully created.Gleb Natapov2010-12-111-0/+15
| | | | | | | | | | | | | | | | Action that depends on fully initialized device model should register with this notifier chain. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Add bootindex for option roms.Gleb Natapov2010-12-111-2/+9
| | | | | | | | | | | | | | Extend -option-rom command to have additional parameter ,bootindex=. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Add bootindex parameter to net/block/fd deviceGleb Natapov2010-12-111-0/+40
|/ | | | | | | | | If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote branch 'origin/master' into pciMichael S. Tsirkin2010-12-011-7/+11
|\ | | | | | | | | | | Conflicts: Makefile.objs hw/virtio.c
| * trace: Trace vm_start()/vm_stop()Stefan Hajnoczi2010-11-211-0/+3
| | | | | | | | | | | | | | | | | | VM state change notifications are invoked from vm_start()/vm_stop(). Trace these state changes so we can reason about the state of the VM from trace output. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * Delete IOHandlers after potentially running themStefan Hajnoczi2010-11-161-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | Since commit 4bed9837309e58d208183f81d8344996744292cf an .fd_read() handler that deletes its IOHandler is exposed to .fd_write() being called on the deleted IOHandler. This patch fixes deletion so that .fd_read() and .fd_write() are never called on an IOHandler that is marked for deletion. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* | qdev: reset qdev along with qdev treeAnthony Liguori2010-11-221-0/+1
|/ | | | | | | | | | | | | | | | This patch changes the reset handling so that qdev has no knowledge of the global system reset. Instead, a new bus/device level function is introduced that allows all devices/buses on the bus/device to be reset using a depth first transversal. N.B. we have to expose the implicit system bus because we have various hacks that result in an implicit system bus existing. Instead, we ought to have an explicitly created system bus that we can trigger reset from. That's a topic for a future patch though. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Introduce strtosz() library function to convert a string to a byte count.Jes Sorensen2010-11-031-20/+9
| | | | | | | | | | | | | | | | | strtosz() returns -1 on error. It now supports human unit formats in eg. 1.0G, with better error handling. The following suffixes are supported: B/b = bytes K/k = KB M/m = MB G/g = GB T/t = TB This patch changes -numa and -m input to use strtosz(). Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-timer: move commonly used timer code to qemu-timer-commonBlue Swirl2010-10-231-24/+0
| | | | | | | | | | | | | | | | | | | | Move timer init functions to a new file, qemu-timer-common.c. Make other critical timer functions inlined to preserve performance in qemu-timer.c, also move muldiv64() (used by the inline functions) to qemu-timer.h. Adjust block/raw-posix.c and simpletrace.c to use get_clock() directly. Remove a similar/duplicate definition in qemu-tool.c. Adjust hw/omap_clk.c to include qemu-timer.h because muldiv64() is used there. After this change, tracing can be used also for user code and simpletrace on Win32. Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote branch 'spice/submit.6' into stagingAnthony Liguori2010-10-051-16/+34
|\ | | | | | | | | | | | | Conflicts: configure Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * spice: simple displayGerd Hoffmann2010-09-211-0/+7
| | | | | | | | | | | | | | | | | | With that patch applied you'll actually see the guests screen in the spice client. This does *not* bring qxl and full spice support though. This is basically the qxl vga mode made more generic, so it plays together with any qemu-emulated gfx card. You can display stdvga or cirrus via spice client. You can have both vnc and spice enabled and clients connected at the same time.
| * spice: core bitsGerd Hoffmann2010-09-211-0/+14
| | | | | | | | | | | | Add -spice command line switch. Has support setting passwd and port for now. With this patch applied the spice client can successfully connect to qemu. You can't do anything useful yet though.
| * Use machine_init() to register virtfs config options.Gerd Hoffmann2010-09-211-5/+0
| |
| * Use display types for local display only.Gerd Hoffmann2010-09-211-11/+13
| | | | | | | | | | | | | | This patch drops DT_VNC. The display types are only used to select select the local display (i.e. curses, sdl, coca, ...). Remote displays (for now only vnc, spice will follow) can be enabled independently.
* | Add option to turn on JSON pretty printing in monitorDaniel P. Berrange2010-10-011-0/+3
| | | | | | | | | | | | | | | | Expaned '-mon' arg to allow a 'pretty=on' flag. This makes the monitor pretty print its replies to easy human debugging / reading Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* | Introduce qemu_madvise()Andreas Färber2010-09-251-3/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vl.c has a Sun-specific hack to supply a prototype for madvise(), but the call site has apparently moved to arch_init.c. Haiku doesn't implement madvise() in favor of posix_madvise(). OpenBSD and Solaris 10 don't implement posix_madvise() but madvise(). MinGW implements neither. Check for madvise() and posix_madvise() in configure and supply qemu_madvise() as wrapper. Prefer madvise() over posix_madvise() due to flag availability. Convert all callers to use qemu_madvise() and QEMU_MADV_*. Note that on Solaris the warning is fixed by moving the madvise() prototype, not by qemu_madvise() itself. It helps with porting though, and it simplifies most call sites. v7 -> v8: * Some versions of MinGW have no sys/mman.h header. Reported by Blue Swirl. v6 -> v7: * Adopt madvise() rather than posix_madvise() semantics for returning errors. * Use EINVAL in place of ENOTSUP. v5 -> v6: * Replace two leftover instances of POSIX_MADV_NORMAL with QEMU_MADV_INVALID. Spotted by Blue Swirl. v4 -> v5: * Introduce QEMU_MADV_INVALID, suggested by Alexander Graf. Note that this relies on -1 not being a valid advice value. v3 -> v4: * Eliminate #ifdefs at qemu_advise() call sites. Requested by Blue Swirl. This will currently break the check in kvm-all.c by calling madvise() with a supported flag, which will not fail. Ideas/patches welcome. v2 -> v3: * Reuse the *_MADV_* defines for QEMU_MADV_*. Suggested by Alexander Graf. * Add configure check for madvise(), too. Add defines to Makefile, not QEMU_CFLAGS. Convert all callers, untested. Suggested by Blue Swirl. * Keep Solaris' madvise() prototype around. Pointed out by Alexander Graf. * Display configure check results. v1 -> v2: * Don't rely on posix_madvise() availability, add qemu_madvise(). Suggested by Blue Swirl. Signed-off-by: Andreas Färber <afaerber@opensolaris.org> Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Alexander Graf <agraf@suse.de> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* trace: Add trace file name command-line optionPrerna Saxena2010-09-091-0/+21
| | | | | | | | | | | | This patch adds an optional command line switch '-trace' to specify the filename to write traces to, when qemu starts. Eg, If compiled with the 'simple' trace backend, [temp@system]$ qemu -trace FILENAME IMAGE Allows the binary traces to be written to FILENAME instead of the option set at config-time. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* virtio-9p: Add SM_NONE security modelAneesh Kumar K.V2010-09-081-1/+1
| | | | | | | | | This is equivalent to SM_PASSTHROUGH security model. The only exception is, failure of privilige operation like chown are ignored. This makes a passthrough like security model usable for people who runs kvm as non root Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
* virtio-9p: Make sure -virtfs option works correctlyAneesh Kumar K.V2010-09-041-2/+2
| | | | | | | When making copy of arguments we were doing partial copy Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix OpenBSD linker warningBlue Swirl2010-08-311-8/+10
| | | | | | | | Fix a warning from OpenBSD linker: ../libhw32/vl.o(.text+0x5c3c): In function `main': /src/qemu/vl.c:2335: warning: sprintf() is often misused, please use snprintf() Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* compile -fsdev and -virtfs cmd line options unconditionally.Gerd Hoffmann2010-08-221-4/+13
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QemuOpts: make most qemu_*_opts staticGerd Hoffmann2010-08-221-25/+31
| | | | | | | | Switch tree to lookup-by-name using qemu_find_opts(). Also hook up virtfs options so qemu_find_opts works for them too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove useless NULL checks for qemu_malloc return valueBlue Swirl2010-08-191-12/+0
| | | | | | | | | | | | | | | | Found with this Coccinelle semantic patch: @@ expression E; identifier ptr; identifier fn ~= "qemu_mallocz*"; @@ -ptr = fn(E); -if (ptr == NULL) { ... } - +ptr = fn(E); Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* migration: Accept 'cont' only after successful incoming migrationAmit Shah2010-07-301-0/+2
| | | | | | | | | | | | | | | | | When a 'cont' is issued on a VM that's just waiting for an incoming migration, the VM reboots and boots into the guest, possibly corrupting its storage since it could be shared with another VM running elsewhere. Ensure that a VM started with '-incoming' is only run when an incoming migration successfully completes. A new qerror, QERR_MIGRATION_EXPECTED, is added to signal that 'cont' failed due to no incoming migration has been attempted yet. Reported-by: Laine Stump <laine@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* remove pointless if from vl.cJoel Schopp2010-07-301-3/+1
| | | | | | | | We already set sockets to nonzero in the code above. So this if statement always evaluates true. Remove it. Signed-off-by: Joel Schopp <jschopp@austin.ibm.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Rename tcg_cpu_exec and tcg_has_workJan Kiszka2010-07-221-1/+1
| | | | | | | | | | These functions are also used for kvm under !CONFIG_IOTHREAD, having 'tcg' in their name is just misleading. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* savevm: Migrate RAM based on name/offsetAlex Williamson2010-07-061-1/+1
| | | | | | | | | Synchronize RAM blocks with the target and migrate using name/offset pairs. This ensures both source and target have the same view of RAM and that we get the right bits into the right slot. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* savevm: Add DeviceState paramAlex Williamson2010-07-061-1/+1
| | | | | | | | | | When available, we'd like to be able to access the DeviceState when registering a savevm. For buses with a get_dev_path() function, this will allow us to create more unique savevm id strings. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Exit if incoming migration failsJuan Quintela2010-06-221-1/+6
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio-9p: Make infrastructure for the new security model.Venkateswararao Jujjuri (JV)2010-06-221-4/+4
| | | | | | | | | | | This patch adds required infrastructure for the new security model. - A new configure option for attr/xattr. - if CONFIG_VIRTFS will be defined if both CONFIG_LINUX and CONFIG_ATTR defined. - Defines routines related to both security models. Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio-9p: Introduces an option to specify the security model.Venkateswararao Jujjuri (JV)2010-06-221-3/+15
| | | | | | | | | | | | | | | The new option is: -fsdev fstype,id=myid,path=/share_path/,security_model=[mapped|passthrough] -virtfs fstype,path=/share_path/,security_model=[mapped|passthrough],mnt_tag=tag In the case of mapped security model, files are created with QEMU user credentials and the client-user's credentials are saved in extended attributes. Whereas in the case of passthrough security model, files on the filesystem are directly created with client-user's credentials. Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add exit notifiers.Gerd Hoffmann2010-06-141-0/+19
| | | | | | | | | | | | | | Hook up any cleanup work which needs to be done here. Advantages over using atexit(3): (1) You get passed in a pointer to the notifier. If you embed that into your state struct you can use container_of() to get get your state info. (2) You can unregister, say when un-plugging a device. [ v2: move code out of #ifndef _WIN32 ] Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori2010-06-141-491/+8
|\ | | | | | | | | Conflicts: hw/pc.c
| * blockdev: Collect block device code in new blockdev.cMarkus Armbruster2010-06-041-482/+1
| | | | | | | | | | | | | | Anything that moves hundreds of lines out of vl.c can't be all bad. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * blockdev: Hide QEMUMachine from drive_init()Markus Armbruster2010-06-041-7/+5
| | | | | | | | | | | | | | To pave the way for moving it out of vl.c. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * close all the block drivers before the qemu process exitsMORITA Kazutaka2010-06-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | This patch calls the close handler of the block driver before the qemu process exits. This is necessary because the sheepdog block driver releases the lock of VM images in the close handler. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * Fix error message in drive_initKevin Wolf2010-06-041-2/+4
| | | | | | | | | | | | | | The real error is the return value of bdrv_open. errno might be overwritten or not even set to that value in the first place. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * usb: Remove unused usb_device_add() parameter is_hotplugMarkus Armbruster2010-06-041-3/+3
| | | | | | | | | | | | | | Unused since commit b3e461d3. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * blockdev: Belatedly remove driveoptsMarkus Armbruster2010-06-041-1/+0
| | | | | | | | | | | | | | Unused since commit 9dfd7c7a. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * blockdev: Belatedly remove MAX_DRIVESMarkus Armbruster2010-06-041-2/+0
| | | | | | | | | | | | | | Unused since commit 751c6a17. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | Move set_proc_name() to OS specific files.Jes Sorensen2010-06-121-18/+1
| | | | | | | | | | | | | | | | | | | | | | Move handling to change process name to POSIX specific files plus add a better error message to cover the case where the feature isn't supported. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Move line-buffering setup to OS specific files.Jes Sorensen2010-06-121-4/+1
| | | | | | | | | | | | | | | | | | Move line-buffering setup to OS specific files. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
OpenPOWER on IntegriCloud