History | View | Annotate | Download (87.7 kB)
Synchronize VCPU states before reset
This is required to support keeping VCPU states across a system reset.If we do not read the current state before the reset,cpu_synchronize_all_post_reset may write back incorrect stateinformation.
The first user of this will be MCE MSR synchronization which currently...
simpletrace: Thread-safe tracing
Trace events outside the global mutex cannot be used with the simpletrace backend since it is not thread-safe. There is no check to preventthem being enabled so people sometimes learn this the hard way.
This patch restructures the simple trace backend with a ring buffer...
Improve vm_stop reason declarations
Define and use dedicated constants for vm_stop reasons, they actuallyhave nothing to do with the EXCP_* defines used so far. At this chance,specify more detailed reasons so that VM state change handlers canevaluate them....
Refactor debug and vmstop request interface
Instead of fiddling with debug_requested and vmstop_requested directly,introduce qemu_system_debug_request and turn qemu_system_vmstop_requestinto a public interface. This aligns those services with exiting ones in...
Move debug exception handling out of cpu_exec
To prepare splitting up KVM and TCG CPU entry/exit, move the debugexception into cpus.c and invoke cpu_handle_debug_exception on returnfrom qemu_cpu_exec.
This also allows to clean up the debug request signaling: We can assign...
Stop current VCPU on synchronous reset requests
If some I/O operation ends up calling qemu_system_reset_request in VCPUcontext, we record this and inform the io-thread, but we do notterminate the VCPU loop. This can lead to fairly unexpected behavior if...
Process vmstop requests in IO thread
A pending vmstop request is also a reason to leave the inner main loop.So far we ignored it, and pending stop requests issued over VCPU threadswere simply ignored.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Leave inner main_loop faster on pending requests
If there is any pending request that requires us to leave the inner loopif main_loop, makes sure we do this as soon as possible by enforcingnon-blocking IO processing.
At this change, move variable definitions out of the inner loop to...
Flatten the main loop
First of all, vm_can_run is a misnomer, it actually means "no requestpending". Moreover, there is no need to check all pending requeststwice, the first time via the inner loop check and then again whenactually processing the requests. We can simply remove the inner loop...
do not pass NULL to strdup.
Also use qemu_strdup() instead of strdup() in bootindex code.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Merge remote branch 'qemu-kvm/uq/master' into staging
aliguori: fix build with !defined(KVM_CAP_ASYNC_PF)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
blockdev: Fix drive_add for drives without media
Watch this:
(qemu) drive_add 0 if=none (qemu) info block none0: type=hd removable=0 [not inserted] (qemu) drive_del none0 Segmentation fault (core dumped)
add_init_drive() is confused about drive_init()'s failure modes, and...
blockdev: Replace drive_add()'s fmt, ... by optstr parameter
Let the callers build the optstr. Only one wants to. All the othersbecome simpler, because they don't have to worry about escaping '%'.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev: Reject multiple definitions for the same drive
We silently ignore multiple definitions for the same drive:
$ qemu-system-x86_64 -nodefaults -vnc :1 -S -monitor stdio -drive if=ide,index=1,file=tmp.qcow2 -drive if=ide,index=1,file=nonexistant...
blockdev: Make drive_add() take explicit type, index parameters
Before, type & index were hidden in printf-like fmt, ... parameters,which get expanded into an option string. Rather inconvenient foruses later in this series.
New IF_DEFAULT to ask for the machine's default interface. Before,...
Make strtosz() return int64_t instead of ssize_t
strtosz() needs to return a 64 bit type even on 32 bitarchitectures. Otherwise qemu-img will fail to create diskimages >= 2GB
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
kvm: Drop smp_cpus argument from init functions
No longer used.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Merge remote branch 'mst/for_anthony' into staging
Merge branch 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemu
Fix a missing trailing newline
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
qbus: register reset handler for qbus whose parent is NULL
Stefan Weil reported the regression caused byec990eb622ad46df5ddcb1e94c418c271894d416 as follows
The second regression also occurs with MIPS malta.Networking no longer works with the default pcnet nic....
Avoid a warning from OpenBSD linker
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>
Add notifier that will be called when machine is fully created.
Action that depends on fully initialized device model should registerwith this notifier chain.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Pass boot device list to firmware.
Add bootindex for option roms.
Extend -option-rom command to have additional parameter ,bootindex=.
Add bootindex parameter to net/block/fd device
If bootindex is specified on command line a string that describes devicein firmware readable way is added into sorted list. Later this list willbe passed into firmware to control boot order.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
spice: add qxl device
qxl is a paravirtual graphics card. The qxl device is the bridgebetween the guest and the spice server (aka libspice-server). Thespice server will send the rendering commands to the spice client, whichwill actually render them....
Merge remote branch 'origin/master' into pci
Conflicts: Makefile.objs hw/virtio.c
qdev: reset qdev along with qdev tree
This patch changes the reset handling so that qdev has no knowledge of theglobal system reset. Instead, a new bus/device level function is introducedthat allows all devices/buses on the bus/device to be reset using a depth...
trace: Trace vm_start()/vm_stop()
VM state change notifications are invoked from vm_start()/vm_stop().Trace these state changes so we can reason about the state of the VMfrom 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 them
Since commit 4bed9837309e58d208183f81d8344996744292cf an .fd_read()handler that deletes its IOHandler is exposed to .fd_write() beingcalled on the deleted IOHandler.
This patch fixes deletion so that .fd_read() and .fd_write() are never...
Introduce strtosz() library function to convert a string to a byte count.
strtosz() returns -1 on error. It now supports human unit formats ineg. 1.0G, with better error handling.
The following suffixes are supported:B/b = bytesK/k = KBM/m = MBG/g = GB...
qemu-timer: move commonly used timer code to qemu-timer-common
Move timer init functions to a new file, qemu-timer-common.c. Make othercritical timer functions inlined to preserve performance inqemu-timer.c, also move muldiv64() (used by the inline functions)...
Merge remote branch 'spice/submit.6' into staging
Conflicts: configure
Add option to turn on JSON pretty printing in monitor
Expaned '-mon' arg to allow a 'pretty=on' flag. This makes themonitor 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()
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()....
spice: simple display
With that patch applied you'll actually see the guests screen in thespice client. This does not bring qxl and full spice support though.This is basically the qxl vga mode made more generic, so it playstogether with any qemu-emulated gfx card. You can display stdvga or...
spice: core bits
Add -spice command line switch. Has support setting passwd and port fornow. With this patch applied the spice client can successfully connectto qemu. You can't do anything useful yet though.
Use display types for local display only.
This patch drops DT_VNC. The display types are only used to selectselect the local display (i.e. curses, sdl, coca, ...). Remotedisplays (for now only vnc, spice will follow) can be enabledindependently.
Use machine_init() to register virtfs config options.
trace: Add trace file name command-line option
This patch adds an optional command line switch '-trace' to specify thefilename to write traces to, when qemu starts.Eg, If compiled with the 'simple' trace backend,[temp@system]$ qemu -trace FILENAME IMAGE...
virtio-9p: Add SM_NONE security model
This is equivalent to SM_PASSTHROUGH security model.The only exception is, failure of privilige operation like chownare ignored. This makes a passthrough like security model usablefor people who runs kvm as non root...
virtio-9p: Make sure -virtfs option works correctly
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 warning
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()
QemuOpts: make most qemu_*_opts static
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>
compile -fsdev and -virtfs cmd line options unconditionally.
Remove useless NULL checks for qemu_malloc return value
Found with this Coccinelle semantic patch:@expression E;identifier ptr;identifier fn ~= "qemu_mallocz*";@
@expression E;identifier ptr;identifier fn ~= "qemu_mallocz*";
ptr = fn(E);-if (ptr == NULL) { ... }+ptr = fn(E);
migration: Accept 'cont' only after successful incoming migration
When a 'cont' is issued on a VM that's just waiting for an incomingmigration, the VM reboots and boots into the guest, possibly corruptingits storage since it could be shared with another VM running elsewhere....
remove pointless if from vl.c
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_work
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>...
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
savevm: Migrate RAM based on name/offset
Synchronize RAM blocks with the target and migrate using name/offsetpairs. This ensures both source and target have the same view ofRAM and that we get the right bits into the right slot.
Exit if incoming migration fails
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.
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....
virtio-9p: Introduces an option to specify the security model.
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...
Add exit notifiers.
Hook up any cleanup work which needs to be done here. Advantages overusing 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....
Merge remote branch 'kwolf/for-anthony' into staging
Conflicts: hw/pc.c
Rename qemu-options.h to qemu-options.def
Rename qemu-options.h to qemu-options.def as it is not a header filefor general use and this leaves space for a proper qemu-options.h
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>...
Introduce OS specific cmdline argument handling and move SMB arg to os-posix.c
Introduce OS specific cmdline argument handling by callingos_parse_cmd_args() at the end of switch() statement. Move optionenum to qemu-options.h and have it included from os-posix.c and...
Move runas handling from vl.c to OS specific files.
Move code to handle runas, ie. change of user id of QEMU processto OS specific files and provide dummy stub for Win32.
Move chroot handling 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>
Move daemonize handling to OS specific files
Move daemonize handling from vl.c to OS specific files. Provide dummystubs for Win32.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>Acked-by: Richard Henderson <rth@redhat.com>...
Move line-buffering setup to OS specific files.
Move set_proc_name() to OS specific files.
Move handling to change process name to POSIX specific filesplus add a better error message to cover the case where thefeature isn't supported.
Introduce os-win32.c and move polling functions from vl.c
This introduces os-win32.c. It is meant to carry win32 specificfunctions thata are not relevant for all of QEMU as well as win32versions of various pieces like signal handling etc.
Move win32 polling handler helper functions from vl.c to os-win32.c...
vl.c: Move host_main_loop_wait() to OS specific files.
Move host_main_loop_wait() to OS specific files. Createqemu-os-posix.h and provide empty inline for the POSIX case.
Introduce os-posix.c and create os_setup_signal_handling()
Introcuce os-posix.c and move posix specific signal handlingthere.
Move win32 early signal handling setup to os_setup_signal_handling()
Rename os_setup_signal_handling() to os_setup_early_signal_handling()
Move main signal handler setup to os specificfiles.
Move main signal handler setup to os specific files.
Move find_datadir to OS specific files.
This moves the win32 and POSIX versions of find_datadir() to OSspecific files, and removes some #ifdef clutter from vl.c
vl.c: Remove double include of netinet/in.h for Solaris
vl.c: netinet/in.h is already included once above for the
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Acked-by: Andreas Faerber <afaerber@opensolaris.org>Acked-by: Juan Quintela <quintela@redhat.com>...
main: allocate gui_timer only once.
fix memory leak.there is no need to allocate more than one gui_timer.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
configure: expand ${prefix} in create_config
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
blockdev: Collect block device code in new blockdev.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
Fix error message in drive_init
The real error is the return value of bdrv_open. errno might be overwritten ornot even set to that value in the first place.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
close all the block drivers before the qemu process exits
This patch calls the close handler of the block driver before the qemuprocess exits.
This is necessary because the sheepdog block driver releases the lockof VM images in the close handler.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>...
blockdev: Hide QEMUMachine from drive_init()
To pave the way for moving it out of vl.c.
blockdev: Belatedly remove MAX_DRIVES
Unused since commit 751c6a17.
blockdev: Belatedly remove driveopts
Unused since commit 9dfd7c7a.
usb: Remove unused usb_device_add() parameter is_hotplug
Unused since commit b3e461d3.
drive: allow rerror, werror and readonly for if=none
When creating guest disks the qdev way using ...
-drive if=none,id=$name,args -device $driver,drive=$name
it is not possible to specify rerror, werror and readonly argumentsfor drive as drive_init allows/blocks them based on the interface (if=)...
Make cache=unsafe the default for -snapshot
When using -snapshot we don't care about data integrity of the cow fileat all, so let's disable flushing there and squeeze out the last dropof performance we could possibly get.
Signed-off-by: Alexander Graf <agraf@suse.de>...
Add cache=unsafe parameter to -drive
Usually the guest can tell the host to flush data to disk. In some cases wedon't want to flush though, but try to keep everything in cache.
So let's add a new cache value to -drive that allows us to set the cachepolicy to most aggressive, disabling flushes. We call this mode "unsafe",...
Fix error handling in qemu_read_config_file
We need to close the file even in error case. While at it, make the callerscatch all kind of errors. ENOENT is allowed for default config files, theyare optional.
Reported-by: Luiz Capitulino <lcapitulino@redhat.com>...
Revert "Monitor: Return before exiting with 'quit'"
This reverts commit 0e8d2b5575938b8876a3c4bb66ee13c5d306fb6d.
Next commits will do the same thing in a better way.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
fix chardev_init for win32
chardev_init functions use socket,so socket_init() shoud be placed atthe front of chardev_init on win32.
Signed-off-by: TeLeMan <geleman@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix cpu list("-cpu ?") breakage, spotted by TeLeMan
Fix breakage by 04c9a0cbc2bf496889cef6da2d61bf00ef190a4f.
QMP: Introduce RESUME event
It's emitted when the Virtual Machine resumes execution.
We currently have the STOP event but don't have the matchingRESUME one, this means that clients are notified when the VMis stopped but don't get anything when it resumes....
virtio-9p: Create a syntactic shortcut for the file-system pass-thru
Currently the commandline to create a virtual-filesystem pass-through betweenthe guest and the host is as follows:#qemu -fsdev fstype,id=ID,path=path/to/share \ -device virtio-9p-pci,fsdev=ID,mount_tag=tag \...
virtio-9p: Create a commandline option -fsdev
This patch creates a new command line option named -fsdev to hold any filesystem specific information.
The option will currently hold the following attributes:-fsdev fstype id=id,path=path_to_sharewherefstype: Type of the file system....
Fix boot once option
The boot once options seems to have gotten broken since it originallywent in. We need to wait until the second time restore_boot_devices()gets called before restoring the standard boot order and removing itselffrom the reset list....
fix old typos in help header
1) Qemu is not only a PC emulator.2) "image image" has already been changed to "disk image" in qemu-doc.texi
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
monitor: Cleanup ID assignment for compat switch
Canonicalize the ID assignment when creating monitor devices via thelegacy switch and use less easily colliding names.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor: Reorder intialization to drop initial mux focus
So far a multiplexed monitor started disabled. Restore this property forthe new way of configuring by moving the monitor initialization beforeall devices (the last one to attach to a char-mux will gain the focus)....
Monitor: Return before exiting with 'quit'
The 'quit' Monitor command (implemented by do_quit()) callsexit() directly, this is problematic under QMP because QEMUexits before having a chance to send the ok response.
Clients don't know if QEMU exited because of a problem or...
Replace calls of old bdrv_open
What is known today as bdrv_open2 becomes the new bdrv_open. All remainingcallers of the old function are converted to the new one. In some places theyeven know the right format, so they should have used bdrv_open2 from the...
cleanup block driver option handling in vl.c
Assign directly to the bdrv_flags variable instead of usingmagic numbers before translating to the BDRV_O_* options.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-config: qemu_read_config_file() reads the normal config file
Introduce a new function qemu_read_config_file which reads the VM configurationfrom a config file. Unlike qemu_config_parse it doesn't take a open file but afilename and reduces code duplication as a side effect....
provide a stub version of kvm-all.c if !CONFIG_KVM
This allows limited use of kvm functions (which will return ENOSYS)even in once-compiled modules. The patch also improves a bit the errormessages for KVM initialization.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...