qmp: don't make -qmp disable the default monitor
Instead, we introduce a default_qmp flag. We don't use it yet, but will in thenext patch.
This has a user-visible impact as specifying just -qmp will now also show amonitor on the 'vc'.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Rewrite mouse handlers to use QTAILQ and to have an activation function
And convert usb-hid to use it (to avoid regression with bisection)
Right now, when we do info mice and we've added a usb tablet, we don't see ituntil the guest starts using the tablet. We implement this behavior in order...
Add kbd_mouse_has_absolute()
kbd_mouse_is_absolute tells us whether the current mouse handler is an absolutedevice. kbd_mouse_has_absolute tells us whether we have any device that iscapable of absolute input.
This lets us tell a user that they have configured an absolute device but that...
Add notifier for mouse mode changes
Right now, DisplayState clients rely on polling the mouse mode to determinewhen the device is changed to an absolute device. Use a notification list toadd an explicit notification.
Expose whether a mouse is an absolute device via QMP and the human monitor.
For QMP, we just add an attribute which is backwards compatible. For the humanmonitor, we add (absolute) to the end of the line.
input: make vnc use mouse mode notifiers
When we switch to absolute mode, we send out a notification (if the clientsupports it). Today, we only send this notification when the client sends usa mouse event and we're in the wrong mode.
sdl: use mouse mode notifier
Today we poll the mouse mode whenever there is a mouse movement. There is asubtle usability problem with this though.
If we're in relative mode and grab is enabled, when we change to absolute mode,we break grab. This gives a user a seamless transition when the new pointer...
Add exit notifiers
Like atexit() but with state
Convert atexit users to exit_notifier
All of these users have global state so we really don't see a benefit fromexit_notifier. However, using exit_notifier means that there's one lessjustification for having global state in the first place.
tap: invoke downscript when we exit abnormally
Right now, downscript is not invoked reliably. If you execute 'quit' from themonitor, it won't be invoked.
This fixes that by converting tap to use an exit_notifier to execute thedownscript. In this case, allowing an exit notifier to include state is...
Add support for generic notifier lists
Notifiers are data-less callbacks and a notifier list is a list of registerednotifiers that all are interested in a particular event.
We'll use this in a few patches to implement mouse change notification.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
CODING_STYLE: Reserve qemu_ prefix for library wrappers
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Convert io handlers to QLIST
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
remove useless cast
values are already pointers, no need to cast them to void *
rename IOCanRWHandler to IOCanReadHandler
It was always only used for reads
bt: remove bt_host_read_poll()
It allways returned true, that is the equivalent of not having thecallback.
Handle deleted IOHandlers in a single buffer
Revert "usb-linux: remove unreachable default in switch statement"
This reverts commit 3c9c706c3b66d838942aba53c0d3fdcdf06c7423.
This breaks build (gcc 4.3.2): CC usb-linux.o cc1: warnings being treated as errors /src/qemu/usb-linux.c: In function 'usb_linux_update_endp_table':...
Fix OpenBSD linker warning
qemu-option.o(.text+0x20f8): In function `qemu_opts_from_qdict_1':/src/qemu/qemu-option.c:813: warning: strcpy() is almost always misused, please use strlcpy()
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Replace assert(0) with abort() or cpu_abort()
When building with -DNDEBUG, assert(0) will not stop executionso it must not be used for abnormal termination.
Use cpu_abort() when in CPU context, abort() otherwise.
Fix manpage errors
Split long unbreakable lines to smaller sections.
Spotted by Debian Lintian tool:http://lintian.debian.org/full/pkg-qemu-devel@lists.alioth.debian.org.html#qemu
scsi-disk: fix buffer overflow
In case s->version is shorter than 4 bytes we overflow the memcpy srcbuffer. Fix it by clearing the target buffer, then copy only theamount of bytes we actually have.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/usb-msd: fix some usb requests
The usb-msd device emulation needs some small tweaks in the requestsemulations. For instance, the reset/maxlun requests are class/interfacespecific so requests for them with the type class and recipient interfacebits sets have to be handled....
vnc: add no-lock-key-sync option
Add an option to disable the heuristics which try to keepcapslock and numlock state for guest and host in sync.
split out qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
read-only: minor cleanup
Really use read-only flags for opening the file when asked for read-only
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
read-only: Another minor cleanup
Don't rely on CDROM hint for read_only attribute
migration: Clear fd also in error cases
Not clearing the fd and closing the file makes qemu spin using 100%CPUafter incoming migration error.
See for instance bug:https://bugzilla.redhat.com/show_bug.cgi?id=518032
Signed-off-by: Juan Quintela <quintela@redhat.com>...
migration: unix migration should obey autostart are the other ones
This was the only incoming migration without autostart check
place together more #ifdef CONFIG_IOTHREAD blocks
disentangle tcg and deadline calculation
Just tell main_loop_wait whether to be blocking or nonblocking, so thatthere is no need to call qemu_cpus_have_work from the timer subsystem.Instead, tcg_cpu_exec can say "we want the main loop not to block because...
only one flag is needed for alarm_timer
The ALARM_FLAG_DYNTICKS can be testing simply by checking if there isa rearm function.
more alarm timer cleanup
The timer_alarm_pending variable is related to the alarm timer but notplaced in the struct. Also, in qemu_mod_timer the wrong flag was beingtested: the timer is rearmed in the alarm timer "bottom half", so theright flag to test there is the "pending" flag....
do not use qemu_event_increment outside qemu_notify_event
qemu_notify_event in the non-iothread case is only stopping the currentCPU. However, if the CPU is idle and the main loop is in the selectcall then a call to qemu_event_increment is needed too (as done in...
tweak qemu_notify_event
Instead of testing specially next_cpu in host_alarm_handler, just dothat in qemu_notify_event. The idea is, if we are not running (ornot yet running) target CPU code, prepare things so that the executionloop is exited asap; just make that clear....
remove qemu_rearm_alarm_timer from main loop
Make the timer subsystem register its own callback instead.
extract timer handling out of main_loop_wait
change qemu_run_timers interface
introduce and use qemu_clock_enable
By adding the possibility to turn on/off a clock, yet anotherincestuous relationship between timers and CPUs can be disentangled.
centralize handling of -icount
A simple patch to place together all handling of -icount.
add qemu_icount_round
add qemu_alarm_pending
new function qemu_icount_delta
Tweaking the rounding in qemu_next_deadline ensures that there'sno change whatsoever.
move vmstate registration of vmstate_timers earlier
avoid dubiously clever code in win32_start_timer
The code is initializing an unsigned int to UINT_MAX using "-1", so thatthe following always-true comparison seems to be always-false at afirst look. Since alarm timer initializations are never nested, it is...
fix error in win32_rearm_timer
The TIME_ONESHOT and TIME_PERIODIC flags are mutually exclusive.The code after the patch matches the flags used in win32_start_timer.
balloon: Do not save VM state wrt asynchronous virtio operations
When working with the VM state (for loadvm/savevm and migration), it is notvalid to load and store pointers since the validity of those pointers cannot beassured in the new qemu address space. Therefore, virtio_balloon_save() and...
block: add logical_block_size property
Add a logical block size attribute as various guest side tools onlyincrease the filesystem sector size based on it, not the advisoryphysical block size.
For scsi we already have support for a different logical block size...
Avoid crash on '-usbdevice <device>' without parameters
Many usbdevice_init implementors assume params is non-NULL.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix SIGFPE for vnc display of width/height = 1
During boot, the screen gets resized to height 1 and a mouse click at thispoint will cause a division by zero when calculating the absolute pointerposition from the pixel (x, y). Return a click in the middle of the screen...
usb-linux: remove unreachable default in switch statement
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Wrong error message in block_passwd command
Signed-off-by: Shahar Havivi <shaharh@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
sdl: improve error message on fatal error
The SDL_SetVideoMode() error condition is easily triggered by a user bysimply configure a guest with a host unsupported display resolutionand attempting to enable fullscreen. Since the error is fatal, addinga bit of debugging help can't harm....
QError: New QERR_DEVICE_NOT_ENCRYPTED
Merge remote branch 'markus/qerror' into staging
Merge remote branch 'mst/pci' into staging
Large page TLB flush
QEMU uses a fixed page size for the CPU TLB. If the guest uses largepages then we effectively split these into multiple smaller pages, andpopulate the corresponding TLB entries on demand.
When the guest invalidates the TLB by virtual address we must invalidate...
qemu-option: Rename find_list() to qemu_find_opts() & external linkage
Next commit wants to use it.
monitor: New argument type 'O'
In the human monitor, it declares a single optional argument to beparsed according to the QemuOptsList given by its name.
In QMP, it declares an optional argument for each member of theQemuOptsList.
Restriction: only lists with empty desc are supported for now. Good...
monitor: Use argument type 'O' for device_add
While there, improve the params help text.
monitor: convert do_device_add() to QObject
qdev: Relax parsing of bus option
Treat multiple successive slashes as a one slash. Ignore trailingslashes. This is how POSIX pathnames work.
error: New QERR_BUS_NOT_FOUND
error: New QERR_DEVICE_MULTIPLE_BUSSES
error: New QERR_DEVICE_NO_BUS
qdev: Convert qbus_find() to QError
error: New error_printf_unless_qmp()
error: New QERR_BAD_BUS_FOR_DEVICE
error: New QERR_BUS_NO_HOTPLUG
error: New QERR_DEVICE_INIT_FAILED
error: New QERR_NO_BUS_FOR_DEVICE
Revert "qdev: Use QError for 'device not found' error"
This reverts commit 3ced9f7a36189aed94d8bf86f3f5087a53012455.
The next commit will convert all of qdev_device_add() to QError, andit'll be clearer with this partial conversion reverted.
error: Convert do_device_add() to QError
Conversion to QObject is still missing.
qemu-option: Functions to convert to/from QDict
The functions are somewhat restricted. Good enough for the job athand. We'll extend them when we need more.
qemu-option: Move the implied first name into QemuOptsList
We sometimes permit omitting the first option name, for example-device foo is short for -device driver=foo. The name to use("driver" in the example) is passed as argument to qemu_opts_parse()....
error: New QERR_PROPERTY_VALUE_IN_USE
error: New QERR_PROPERTY_VALUE_NOT_FOUND
qdev: convert setting device properties to QError
qdev: Hide "ptr" properties from users
Users can't set them, so qdev_device_help() shouldn't list them. Fixthat. Also make qdev_prop_parse() hide them instead of printing ameaningless "has no parser" error message.
Their value means nothing to users, so qdev_print_props() shouldn't...
monitor: New monitor_cur_is_qmp()
error: Let converted handlers print in human monitor
While fully converted handlers are not supposed to print anything whenrunning in a QMP monitor, they are free to print in a human monitor.For instance, device_add (not yet converted) prints help, and will...
error: Polish human-readable error descriptions
Also put error definitions in alphabetical order
error: New QERR_PROPERTY_NOT_FOUND
error: New QERR_PROPERTY_VALUE_BAD
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
error: Rename qemu_error_new() to qerror_report()
error: Infrastructure to track locations for error reporting
New struct Location holds a location. So far, the only location isLOC_NONE, so this doesn't do anything useful yet.
Passing the current location all over the place would be toocumbersome. Hide it away in static cur_loc instead, and provide...
error: Include the program name in error messages to stderr
error: Track locations in configuration files
New LOC_FILE. Use it for tracking file name and line number inqemu_config_parse(). We now report errors like
qemu:foo.conf:42: Did not find I2C bus for smbus-eeprom
In particular, gems like this message:...
QemuOpts: Fix qemu_config_parse() to catch file read errors
error: Track locations on command line
New LOC_CMDLINE. Use it for tracking option with argument inlookup_opt(). We now report errors like this
qemu: -device smbus-eeprom: Did not find I2C bus for smbus-eeprom
qdev: Fix -device and device_add to handle unsuitable bus gracefully
"device_add isa-serial,bus=pci.0" kills QEMU. Not good.
qdev: Factor qdev_create_from_info() out of qdev_create()
To make it obvious that -device and device_add can't die inhw_error().
qdev: Hide "no_user" devices from users
Users can't create them, so qdev_device_help() shouldn't list them.Fix that.
Also make qdev_device_add() pretend they don't exist. Before, itrejected them with a "can't be added via command line" message, which...
error: Don't abuse qemu_error() for non-error in scsi_hot_add()
Commit 30d335d6 converted an informational message frommonitor_printf() to qemu_error(), probably because the latter doesn'tneed a mon argument. A later commit will make qemu_error() print...
error: Simplify error sink setup
qemu_error_sink can either point to a monitor or a file. In practice,it always points to the current monitor if we have one, else tostderr. Simply route errors to the current monitor or else to stderr,and remove qemu_error_sink along with the functions to control it....
error: Move qemu_error & friends into their own header
error: New error_printf() and error_vprintf()
error: Don't abuse qemu_error() for non-error in qdev_device_help()
qdev_device_help() prints device information with qemu_error(). Alater commit will make qemu_error() print additional stuff that isonly appropriate for proper errors, and then this will break. Use...
error: Don't abuse qemu_error() for non-error in qbus_find()
qbus_find() adds an informational line to error messages, and printsboth lines with one qemu_error(). Use error_printf() for theinformational line instead.
While there, simplify: instead of printing buffers filled by...