Juan Quintela [Thu, 11 Mar 2010 16:55:37 +0000 (17:55 +0100)]
Convert io handlers to QLIST
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Avi Kivity [Thu, 11 Mar 2010 14:48:43 +0000 (16:48 +0200)]
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>
Blue Swirl [Thu, 18 Mar 2010 20:48:19 +0000 (20:48 +0000)]
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>
Blue Swirl [Thu, 18 Mar 2010 18:41:57 +0000 (18:41 +0000)]
Replace assert(0) with abort() or cpu_abort()
When building with -DNDEBUG, assert(0) will not stop execution
so it must not be used for abnormal termination.
Use cpu_abort() when in CPU context, abort() otherwise.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Thu, 18 Mar 2010 18:41:49 +0000 (18:41 +0000)]
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
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Arnaud Patard (Rtp) [Wed, 10 Mar 2010 09:45:12 +0000 (10:45 +0100)]
hw/usb-msd: fix some usb requests
The usb-msd device emulation needs some small tweaks in the requests
emulations. For instance, the reset/maxlun requests are class/interface
specific so requests for them with the type class and recipient interface
bits sets have to be handled.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Gerd Hoffmann [Wed, 10 Mar 2010 16:47:17 +0000 (17:47 +0100)]
scsi-disk: fix buffer overflow
In case s->version is shorter than 4 bytes we overflow the memcpy src
buffer. Fix it by clearing the target buffer, then copy only the
amount of bytes we actually have.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Gerd Hoffmann [Wed, 10 Mar 2010 16:12:02 +0000 (17:12 +0100)]
vnc: add no-lock-key-sync option
Add an option to disable the heuristics which try to keep
capslock and numlock state for guest and host in sync.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Tue, 9 Mar 2010 23:10:36 +0000 (00:10 +0100)]
migration: unix migration should obey autostart are the other ones
This was the only incoming migration without autostart check
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Tue, 9 Mar 2010 23:10:35 +0000 (00:10 +0100)]
migration: Clear fd also in error cases
Not clearing the fd and closing the file makes qemu spin using 100%CPU
after incoming migration error.
See for instance bug:
https://bugzilla.redhat.com/show_bug.cgi?id=518032
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Naphtali Sprei [Thu, 11 Mar 2010 14:44:34 +0000 (16:44 +0200)]
read-only: Another minor cleanup
Don't rely on CDROM hint for read_only attribute
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Naphtali Sprei [Sun, 14 Mar 2010 13:19:57 +0000 (15:19 +0200)]
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>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:55 +0000 (11:38 +0100)]
split out qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:54 +0000 (11:38 +0100)]
disentangle tcg and deadline calculation
Just tell main_loop_wait whether to be blocking or nonblocking, so that
there 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
we have stuff to do".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:53 +0000 (11:38 +0100)]
place together more #ifdef CONFIG_IOTHREAD blocks
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:52 +0000 (11:38 +0100)]
move vmstate registration of vmstate_timers earlier
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:51 +0000 (11:38 +0100)]
new function qemu_icount_delta
Tweaking the rounding in qemu_next_deadline ensures that there's
no change whatsoever.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:50 +0000 (11:38 +0100)]
add qemu_alarm_pending
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:49 +0000 (11:38 +0100)]
add qemu_icount_round
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:48 +0000 (11:38 +0100)]
centralize handling of -icount
A simple patch to place together all handling of -icount.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:47 +0000 (11:38 +0100)]
introduce and use qemu_clock_enable
By adding the possibility to turn on/off a clock, yet another
incestuous relationship between timers and CPUs can be disentangled.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:46 +0000 (11:38 +0100)]
change qemu_run_timers interface
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:45 +0000 (11:38 +0100)]
extract timer handling out of main_loop_wait
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:44 +0000 (11:38 +0100)]
remove qemu_rearm_alarm_timer from main loop
Make the timer subsystem register its own callback instead.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:43 +0000 (11:38 +0100)]
tweak qemu_notify_event
Instead of testing specially next_cpu in host_alarm_handler, just do
that in qemu_notify_event. The idea is, if we are not running (or
not yet running) target CPU code, prepare things so that the execution
loop is exited asap; just make that clear.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:42 +0000 (11:38 +0100)]
do not use qemu_event_increment outside qemu_notify_event
qemu_notify_event in the non-iothread case is only stopping the current
CPU. However, if the CPU is idle and the main loop is in the select
call then a call to qemu_event_increment is needed too (as done in
host_alarm_handler). Since in general one doesn't know whether the CPU
is executing or not, it is a safe bet to always do qemu_event_increment.
Another way to see it: after this patch qemu_event_increment is the
"common part" of qemu_notify_event for both the CONFIG_IOTHREAD and
!CONFIG_IOTHREAD cases, which makes sense.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:41 +0000 (11:38 +0100)]
more alarm timer cleanup
The timer_alarm_pending variable is related to the alarm timer but not
placed in the struct. Also, in qemu_mod_timer the wrong flag was being
tested: the timer is rearmed in the alarm timer "bottom half", so the
right flag to test there is the "pending" flag.
Finally, I hoisted the NULL checks from alarm_has_dynticks to
host_alarm_handler.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:40 +0000 (11:38 +0100)]
only one flag is needed for alarm_timer
The ALARM_FLAG_DYNTICKS can be testing simply by checking if there is
a rearm function.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:39 +0000 (11:38 +0100)]
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.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Wed, 10 Mar 2010 10:38:38 +0000 (11:38 +0100)]
avoid dubiously clever code in win32_start_timer
The code is initializing an unsigned int to UINT_MAX using "-1", so that
the following always-true comparison seems to be always-false at a
first look. Since alarm timer initializations are never nested, it is
simpler to unconditionally store the result of timeGetDevCaps into
data->period.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Adam Litke [Tue, 9 Mar 2010 18:54:09 +0000 (12:54 -0600)]
balloon: Do not save VM state wrt asynchronous virtio operations
When working with the VM state (for loadvm/savevm and migration), it is not
valid to load and store pointers since the validity of those pointers cannot be
assured in the new qemu address space. Therefore, virtio_balloon_save() and
virtio_balloon_load() must not handle the stats-related fields in struct
VirtIOBalloon.
If a memory stats request is in-flight at the time of a migration or savevm,
the request will not complete and should be resubmitted once migration or
loadvm completes. Note that this extremely small race window can only be
triggered using QMP so it is not possible to hang the user monitor.
Signed-off-by: Adam Litke <agl@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Christoph Hellwig [Thu, 4 Mar 2010 13:20:17 +0000 (14:20 +0100)]
block: add logical_block_size property
Add a logical block size attribute as various guest side tools only
increase the filesystem sector size based on it, not the advisory
physical block size.
For scsi we already have support for a different logical block size
in place for CDROMs that we can built upon. Only my recent block
device characteristics VPD page needs some fixups. Note that we
leave the logial block size for CDROMs hardcoded as the 2k value
is expected for it in general.
For virtio-blk we already have a feature flag claiming to support
a variable logical block size that was added for the s390 kuli
hypervisor. Interestingly it does not actually change the units
in which the protocol works, which is still fixed at 512 bytes,
but only communicates a different minimum I/O granularity. So
all we need to do in virtio is to add a trap for unaligned I/O
and round down the device size to the next multiple of the logical
block size.
IDE does not support any other logical block size than 512 bytes.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sun, 7 Mar 2010 11:17:08 +0000 (12:17 +0100)]
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>
Chris Webb [Mon, 8 Mar 2010 14:34:49 +0000 (14:34 +0000)]
Fix SIGFPE for vnc display of width/height = 1
During boot, the screen gets resized to height 1 and a mouse click at this
point will cause a division by zero when calculating the absolute pointer
position from the pixel (x, y). Return a click in the middle of the screen
instead in this case.
Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paul Bolle [Mon, 8 Mar 2010 12:58:35 +0000 (13:58 +0100)]
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>
Bjørn Mork [Mon, 8 Mar 2010 12:07:14 +0000 (13:07 +0100)]
sdl: improve error message on fatal error
The SDL_SetVideoMode() error condition is easily triggered by a user by
simply configure a guest with a host unsupported display resolution
and attempting to enable fullscreen. Since the error is fatal, adding
a bit of debugging help can't harm.
Sample output with this change:
(qemu) Could not open SDL display (1280x1024x32): No video mode large enough for 1280x1024
The width x height might seem redundant as SDL also provides it in
SDL_GetError(), but I believe there are situations where it is
useful. I.e. if there is some other SDL error. Anyway, redundant
information in fatal error messages has never harmed a single gerbil.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Shahar Havivi [Fri, 5 Mar 2010 22:26:13 +0000 (00:26 +0200)]
Wrong error message in block_passwd command
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Shahar Havivi [Fri, 5 Mar 2010 22:25:35 +0000 (00:25 +0200)]
QError: New QERR_DEVICE_NOT_ENCRYPTED
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Wed, 17 Mar 2010 14:44:37 +0000 (09:44 -0500)]
Merge remote branch 'markus/qerror' into staging
Anthony Liguori [Wed, 17 Mar 2010 14:42:58 +0000 (09:42 -0500)]
Merge remote branch 'mst/pci' into staging
Paul Brook [Wed, 17 Mar 2010 02:14:28 +0000 (02:14 +0000)]
Large page TLB flush
QEMU uses a fixed page size for the CPU TLB. If the guest uses large
pages then we effectively split these into multiple smaller pages, and
populate the corresponding TLB entries on demand.
When the guest invalidates the TLB by virtual address we must invalidate
all entries covered by the large page. However the address used to
invalidate the entry may not be present in the QEMU TLB, so we do not
know which regions to clear.
Implementing a full vaiable size TLB is hard and slow, so just keep a
simple address/mask pair to record which addresses may have been mapped by
large pages. If the guest invalidates this region then flush the
whole TLB.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Markus Armbruster [Wed, 10 Feb 2010 19:52:01 +0000 (20:52 +0100)]
monitor: convert do_device_add() to QObject
Markus Armbruster [Wed, 10 Feb 2010 19:47:28 +0000 (20:47 +0100)]
monitor: Use argument type 'O' for device_add
While there, improve the params help text.
Markus Armbruster [Wed, 10 Feb 2010 19:24:35 +0000 (20:24 +0100)]
monitor: New argument type 'O'
In the human monitor, it declares a single optional argument to be
parsed according to the QemuOptsList given by its name.
In QMP, it declares an optional argument for each member of the
QemuOptsList.
Restriction: only lists with empty desc are supported for now. Good
enough for the job at hand. We'll lift the restriction when we need
that.
Markus Armbruster [Wed, 10 Feb 2010 19:09:14 +0000 (20:09 +0100)]
qemu-option: Rename find_list() to qemu_find_opts() & external linkage
Next commit wants to use it.
Markus Armbruster [Wed, 10 Feb 2010 18:52:18 +0000 (19:52 +0100)]
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().
For each QemuOptsList, we use at most one such name.
Move the name into QemuOptsList, and pass whether to permit the
abbreviation. This ensures continued consistency, and simplifies the
commit after next in this series.
Markus Armbruster [Wed, 10 Feb 2010 19:15:29 +0000 (20:15 +0100)]
qemu-option: Functions to convert to/from QDict
The functions are somewhat restricted. Good enough for the job at
hand. We'll extend them when we need more.
Markus Armbruster [Fri, 19 Feb 2010 13:17:34 +0000 (14:17 +0100)]
error: Convert do_device_add() to QError
Conversion to QObject is still missing.
Markus Armbruster [Fri, 19 Feb 2010 09:03:13 +0000 (10:03 +0100)]
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, and
it'll be clearer with this partial conversion reverted.
Markus Armbruster [Fri, 19 Feb 2010 18:54:06 +0000 (19:54 +0100)]
error: New QERR_NO_BUS_FOR_DEVICE
Markus Armbruster [Fri, 19 Feb 2010 18:53:54 +0000 (19:53 +0100)]
error: New QERR_DEVICE_INIT_FAILED
Markus Armbruster [Fri, 19 Feb 2010 18:53:36 +0000 (19:53 +0100)]
error: New QERR_BUS_NO_HOTPLUG
Markus Armbruster [Fri, 19 Feb 2010 18:52:45 +0000 (19:52 +0100)]
error: New QERR_BAD_BUS_FOR_DEVICE
Markus Armbruster [Fri, 19 Feb 2010 09:30:05 +0000 (10:30 +0100)]
error: New error_printf_unless_qmp()
Markus Armbruster [Fri, 19 Feb 2010 17:09:33 +0000 (18:09 +0100)]
qdev: Convert qbus_find() to QError
Markus Armbruster [Fri, 19 Feb 2010 17:06:18 +0000 (18:06 +0100)]
error: New QERR_DEVICE_NO_BUS
Markus Armbruster [Fri, 19 Feb 2010 17:05:59 +0000 (18:05 +0100)]
error: New QERR_DEVICE_MULTIPLE_BUSSES
Markus Armbruster [Fri, 19 Feb 2010 17:05:39 +0000 (18:05 +0100)]
error: New QERR_BUS_NOT_FOUND
Markus Armbruster [Fri, 19 Feb 2010 15:09:25 +0000 (16:09 +0100)]
qdev: Relax parsing of bus option
Treat multiple successive slashes as a one slash. Ignore trailing
slashes. This is how POSIX pathnames work.
Markus Armbruster [Fri, 19 Feb 2010 12:20:23 +0000 (13:20 +0100)]
qdev: convert setting device properties to QError
Markus Armbruster [Tue, 16 Mar 2010 16:44:38 +0000 (17:44 +0100)]
error: New QERR_PROPERTY_VALUE_NOT_FOUND
Markus Armbruster [Tue, 16 Mar 2010 16:40:48 +0000 (17:40 +0100)]
error: New QERR_PROPERTY_VALUE_IN_USE
Markus Armbruster [Fri, 19 Feb 2010 12:17:58 +0000 (13:17 +0100)]
error: New QERR_PROPERTY_VALUE_BAD
Markus Armbruster [Fri, 19 Feb 2010 12:11:41 +0000 (13:11 +0100)]
error: New QERR_PROPERTY_NOT_FOUND
Markus Armbruster [Fri, 19 Feb 2010 16:42:46 +0000 (17:42 +0100)]
error: Polish human-readable error descriptions
Also put error definitions in alphabetical order
Markus Armbruster [Tue, 2 Mar 2010 13:56:34 +0000 (14:56 +0100)]
error: Let converted handlers print in human monitor
While fully converted handlers are not supposed to print anything when
running in a QMP monitor, they are free to print in a human monitor.
For instance, device_add (not yet converted) prints help, and will
continue to do so after conversion.
Moreover, utility functions converted to QError should remain usable
from unconverted handlers.
Two problems:
* handler_audit() complains when a converted handler prints. Limit
that to QMP monitors.
* With QMP, handlers need to pass the error object by way of
monitor_set_error(). However, we do that both for QMP and for the
human monitor. The human monitor prints the error object after the
handler returns. If the handler prints anything else, that output
"overtakes" the error message.
Limit use of monitor_set_error() to QMP monitors. Update
handler_audit() accordingly.
Markus Armbruster [Thu, 11 Feb 2010 16:05:43 +0000 (17:05 +0100)]
monitor: New monitor_cur_is_qmp()
Markus Armbruster [Fri, 19 Feb 2010 10:47:06 +0000 (11:47 +0100)]
qdev: Hide "ptr" properties from users
Users can't set them, so qdev_device_help() shouldn't list them. Fix
that. Also make qdev_prop_parse() hide them instead of printing a
meaningless "has no parser" error message.
Their value means nothing to users, so qdev_print_props() shouldn't
print it. Fix by removing their print method.
Their only use is dirty hacks. Document that.
Markus Armbruster [Fri, 19 Feb 2010 12:31:49 +0000 (13:31 +0100)]
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, it
rejected them with a "can't be added via command line" message, which
wasn't quite right for monitor command device_add.
Markus Armbruster [Fri, 19 Feb 2010 18:12:18 +0000 (19:12 +0100)]
qdev: Factor qdev_create_from_info() out of qdev_create()
To make it obvious that -device and device_add can't die in
hw_error().
Markus Armbruster [Fri, 19 Feb 2010 18:08:45 +0000 (19:08 +0100)]
qdev: Fix -device and device_add to handle unsuitable bus gracefully
"device_add isa-serial,bus=pci.0" kills QEMU. Not good.
Markus Armbruster [Thu, 18 Feb 2010 19:13:51 +0000 (20:13 +0100)]
error: Track locations on command line
New LOC_CMDLINE. Use it for tracking option with argument in
lookup_opt(). We now report errors like this
qemu: -device smbus-eeprom: Did not find I2C bus for smbus-eeprom
Markus Armbruster [Thu, 18 Feb 2010 18:56:01 +0000 (19:56 +0100)]
QemuOpts: Fix qemu_config_parse() to catch file read errors
Markus Armbruster [Thu, 18 Feb 2010 18:48:33 +0000 (19:48 +0100)]
error: Track locations in configuration files
New LOC_FILE. Use it for tracking file name and line number in
qemu_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:
-device: no driver specified
become almost nice now:
qemu:foo.conf:44: -device: no driver specified
(A later commit will get rid of the bogus -device:)
Markus Armbruster [Wed, 24 Feb 2010 13:37:14 +0000 (14:37 +0100)]
error: Include the program name in error messages to stderr
Markus Armbruster [Thu, 18 Feb 2010 18:46:49 +0000 (19:46 +0100)]
error: Infrastructure to track locations for error reporting
New struct Location holds a location. So far, the only location is
LOC_NONE, so this doesn't do anything useful yet.
Passing the current location all over the place would be too
cumbersome. Hide it away in static cur_loc instead, and provide
accessors. Print it in error_report().
Store it in QError, and print it in qerror_print().
Store it in QemuOpt, for use by qemu_opts_foreach(). This makes
error_report() do the right thing when it runs within
qemu_opts_foreach().
We may still have to store it in other data structures holding user
input for better error messages. Left for another day.
Markus Armbruster [Tue, 2 Mar 2010 17:15:09 +0000 (18:15 +0100)]
error: Rename qemu_error_new() to qerror_report()
Markus Armbruster [Thu, 18 Feb 2010 16:25:24 +0000 (17:25 +0100)]
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it it
from its arguments.
This fixes a few error messages lacking a newline:
net_handle_fd_param()'s "No file descriptor named %s found", and
tap_open()'s "vnet_hdr=1 requested, but no kernel support for
IFF_VNET_HDR available" (all three versions).
There's one place that passes arguments without newlines
intentionally: load_vmstate(). Fix it up.
Markus Armbruster [Thu, 18 Feb 2010 17:41:52 +0000 (18:41 +0100)]
error: Don't abuse qemu_error() for non-error in scsi_hot_add()
Commit
30d335d6 converted an informational message from
monitor_printf() to qemu_error(), probably because the latter doesn't
need a mon argument. A later commit will make qemu_error() print
additional stuff that is only appropriate for proper errors, and then
this will break. Clean it up.
Markus Armbruster [Thu, 18 Feb 2010 17:55:59 +0000 (18:55 +0100)]
error: Don't abuse qemu_error() for non-error in qbus_find()
qbus_find() adds an informational line to error messages, and prints
both lines with one qemu_error(). Use error_printf() for the
informational line instead.
While there, simplify: instead of printing buffers filled by
qbus_list_bus() and qbus_list_dev() in one go, make them print it.
Markus Armbruster [Thu, 18 Feb 2010 17:44:15 +0000 (18:44 +0100)]
error: Don't abuse qemu_error() for non-error in qdev_device_help()
qdev_device_help() prints device information with qemu_error(). A
later commit will make qemu_error() print additional stuff that is
only appropriate for proper errors, and then this will break. Use
error_printf() instead.
While there, simplify: instead of printing a buffer filled by
qdev_print_devinfo() in one go, make qdev_print_devinfo() print it.
Markus Armbruster [Thu, 18 Feb 2010 16:14:17 +0000 (17:14 +0100)]
error: New error_printf() and error_vprintf()
Markus Armbruster [Thu, 18 Feb 2010 15:24:31 +0000 (16:24 +0100)]
error: Move qemu_error & friends into their own header
Markus Armbruster [Thu, 18 Feb 2010 12:16:02 +0000 (13:16 +0100)]
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 to
stderr. Simply route errors to the current monitor or else to stderr,
and remove qemu_error_sink along with the functions to control it.
Actually, the old code switches the sink slightly later, in
handle_user_command() and handle_qmp_command(), than it gets switched
now, implicitly, by setting the current monitor in monitor_read() and
monitor_control_read(). Likewise, it switches back slightly earlier
(same places). Doesn't make a difference, because there are no calls
of qemu_error() in between.
Markus Armbruster [Wed, 17 Feb 2010 09:55:46 +0000 (10:55 +0100)]
error: Move qemu_error() & friends from monitor.c to own file
They're about reporting errors, not about the monitor.
Markus Armbruster [Wed, 17 Feb 2010 09:52:26 +0000 (10:52 +0100)]
monitor: Factor monitor_set_error() out of qemu_error_internal()
This separates the monitor part from the QError part.
Markus Armbruster [Thu, 18 Feb 2010 10:49:42 +0000 (11:49 +0100)]
block: Simplify usb_msd_initfn() test for "can read bdrv key"
The old test assumes that "hotplugged" implies "we have a current
monitor for reading the key". This is in fact true, but it's not
obviously true.
Aside: if it were false, we could pass a null pointer to
monitor_read_bdrv_key_start(), which would then crash.
The previous commit permits us to check for "we have a current
monitor" directly, so do that.
Markus Armbruster [Thu, 18 Feb 2010 10:41:55 +0000 (11:41 +0100)]
monitor: Separate "default monitor" and "current monitor" cleanly
Commits
376253ec..
731b0364 introduced global variable cur_mon, which
points to the "default monitor" (if any), except during execution of
monitor_read() or monitor_control_read() it points to the monitor from
which we're reading instead (the "current monitor"). Monitor command
handlers run within monitor_read() or monitor_control_read().
Default monitor and current monitor are really separate things, and
squashing them together is confusing and error-prone.
For instance, usb_host_scan() can run both in "info usbhost" and
periodically via usb_host_auto_check(). It prints to cur_mon, which
is what we want in the former case: the monitor executing "info
usbhost". But since that's the default monitor in the latter case, it
periodically spams the default monitor there.
A few places use cur_mon to log stuff to the default monitor. If we
ever log something while cur_mon points to current monitor instead of
default monitor, the log temporarily "jumps" to another monitor.
Whether that can or cannot happen isn't always obvious.
Maybe logging to the default monitor (which may not even exist) is a
bad idea, and we should log to stderr or a logfile instead. But
that's outside the scope of this commit.
Change cur_mon to point to the current monitor. Create new
default_mon to point to the default monitor. Update users of cur_mon
accordingly.
This fixes the periodical spamming of the default monitor by
usb_host_scan(). It also stops "log jumping", should that problem
exist.
Markus Armbruster [Thu, 18 Feb 2010 09:21:36 +0000 (10:21 +0100)]
tools: Remove unused cur_mon from qemu-tool.c
Markus Armbruster [Wed, 17 Feb 2010 17:07:48 +0000 (18:07 +0100)]
pc: Factor common code out of pc_boot_set() and cmos_init()
Code duplicated in commit
0ecdffbb. The two versions are similar, but
not identical:
* cmos_init() reports errors to stderr, pc_boot_set() via
qemu_error(). The latter is fine for both, so pick that for the
common code.
* cmos_init() obeys fd_bootchk, pc_boot_set() ignores it. Make it a
parameter of the common code.
Markus Armbruster [Wed, 17 Feb 2010 17:05:26 +0000 (18:05 +0100)]
pc: Fix error reporting for -boot once
Commit
0ecdffbb created pc_boot_set() for use from monitor command
"boot_set", via qemu_boot_set(). pc_boot_set() reports errors to
cur_mon, which works fine for monitor code.
Commit
e0f084bf reused the function int reset handler
restore_boot_devices(). Use of cur_mon is problematic in that
context. For instance, the "Too many boot devices for PC" error for
"-boot order=abcdefgh,once=c" goes to the monitor instead of stderr.
The monitor may not even exist.
Fix by switching to qemu_error().
Markus Armbruster [Wed, 17 Feb 2010 15:24:10 +0000 (16:24 +0100)]
savevm: Fix -loadvm to report errors to stderr, not the monitor
A monitor may not even exist.
Change load_vmstate() to use qemu_error() instead of monitor_printf().
Parameter mon is now unused, remove it.
Markus Armbruster [Wed, 17 Feb 2010 13:34:57 +0000 (14:34 +0100)]
usb: Remove disabled monitor_printf() in usb_read_file()
The monitor_printf() reports failure. Printing is wrong, because the
caller tries various arguments, and expects the function to fail for
some or all.
Disabled since commit
26a9e82a. Remove it.
Aurelien Jarno [Sun, 14 Mar 2010 20:20:59 +0000 (21:20 +0100)]
load_elf: replace the address addend by a translation function
A few machines need to translate the ELF header addresses into physical
addresses. Currently the only possibility is to add a value to the
addresses.
This patch replaces the addend argument by and a translation function
and an opaque passed to the function. A NULL function does not translate
the address.
The patch also convert all machines that have an addend, simplify the
PowerPC kernel loading and fix the MIPS kernel loading using this new
feature. Other machines may benefit from this feature.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Michael S. Tsirkin [Mon, 15 Mar 2010 11:34:16 +0000 (13:34 +0200)]
pcnet: make subsystem vendor id match hardware
Real pcnet device (AT2450) apparently has subsystem
device and vendor id set to 0, this is out of spec
(which requires that vendor id is obtained from PCI SIG)
but windows xp driver seems to need this in order
to associate.
qemu sets pci subsystem id to qumranet/qemu
since
d350d97d196a632b6c7493acf07a061017fc6f7d,
debian does not yet have this patch.
https://bugzilla.redhat.com/show_bug.cgi?id=521247
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Michael S. Tsirkin [Wed, 3 Mar 2010 12:00:21 +0000 (14:00 +0200)]
eepro100: address pci todo's, use pci_set_xx
eepro100 uses macros which rely on a specific
local variable name (pci_conf) which is scary.
Some of the uses are wrong or unnecessary,
remove them. The rest are small in number, open-code
them using pci_set_xx functions.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Kevin Wolf [Fri, 12 Mar 2010 13:03:49 +0000 (14:03 +0100)]
qemu-img rebase: Document -f option
The option was implemented in
e53dbee0, but I forgot documenting it.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Aurelien Jarno [Sun, 14 Mar 2010 22:30:19 +0000 (23:30 +0100)]
mips: add header to mips_int.c and mips_timer.c
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Aurelien Jarno [Sun, 14 Mar 2010 22:01:01 +0000 (23:01 +0100)]
tcg: declare internal helpers as const and pure
TCG internal helpers only access to the values passed in arguments, and
do not modify the CPU internal state. Thus they can be declared as
const and pure.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Jan Kiszka [Sun, 7 Mar 2010 10:28:48 +0000 (11:28 +0100)]
Fix corner case in chardev udp: parameter
The missing '@' broke 'udp::<port>@:<port>' parsing.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>