sdk/emulator/qemu.git
14 years agoerror: New QERR_BUS_NO_HOTPLUG
Markus Armbruster [Fri, 19 Feb 2010 18:53:36 +0000 (19:53 +0100)]
error: New QERR_BUS_NO_HOTPLUG

14 years agoerror: New QERR_BAD_BUS_FOR_DEVICE
Markus Armbruster [Fri, 19 Feb 2010 18:52:45 +0000 (19:52 +0100)]
error: New QERR_BAD_BUS_FOR_DEVICE

14 years agoerror: New error_printf_unless_qmp()
Markus Armbruster [Fri, 19 Feb 2010 09:30:05 +0000 (10:30 +0100)]
error: New error_printf_unless_qmp()

14 years agoqdev: Convert qbus_find() to QError
Markus Armbruster [Fri, 19 Feb 2010 17:09:33 +0000 (18:09 +0100)]
qdev: Convert qbus_find() to QError

14 years agoerror: New QERR_DEVICE_NO_BUS
Markus Armbruster [Fri, 19 Feb 2010 17:06:18 +0000 (18:06 +0100)]
error: New QERR_DEVICE_NO_BUS

14 years agoerror: New QERR_DEVICE_MULTIPLE_BUSSES
Markus Armbruster [Fri, 19 Feb 2010 17:05:59 +0000 (18:05 +0100)]
error: New QERR_DEVICE_MULTIPLE_BUSSES

14 years agoerror: New QERR_BUS_NOT_FOUND
Markus Armbruster [Fri, 19 Feb 2010 17:05:39 +0000 (18:05 +0100)]
error: New QERR_BUS_NOT_FOUND

14 years agoqdev: Relax parsing of bus option
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.

14 years agoqdev: convert setting device properties to QError
Markus Armbruster [Fri, 19 Feb 2010 12:20:23 +0000 (13:20 +0100)]
qdev: convert setting device properties to QError

14 years agoerror: New QERR_PROPERTY_VALUE_NOT_FOUND
Markus Armbruster [Tue, 16 Mar 2010 16:44:38 +0000 (17:44 +0100)]
error: New QERR_PROPERTY_VALUE_NOT_FOUND

14 years agoerror: New QERR_PROPERTY_VALUE_IN_USE
Markus Armbruster [Tue, 16 Mar 2010 16:40:48 +0000 (17:40 +0100)]
error: New QERR_PROPERTY_VALUE_IN_USE

14 years agoerror: New QERR_PROPERTY_VALUE_BAD
Markus Armbruster [Fri, 19 Feb 2010 12:17:58 +0000 (13:17 +0100)]
error: New QERR_PROPERTY_VALUE_BAD

14 years agoerror: New QERR_PROPERTY_NOT_FOUND
Markus Armbruster [Fri, 19 Feb 2010 12:11:41 +0000 (13:11 +0100)]
error: New QERR_PROPERTY_NOT_FOUND

14 years agoerror: Polish human-readable error descriptions
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

14 years agoerror: Let converted handlers print in human monitor
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.

14 years agomonitor: New monitor_cur_is_qmp()
Markus Armbruster [Thu, 11 Feb 2010 16:05:43 +0000 (17:05 +0100)]
monitor: New monitor_cur_is_qmp()

14 years agoqdev: Hide "ptr" properties from users
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.

14 years agoqdev: Hide "no_user" devices from users
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.

14 years agoqdev: Factor qdev_create_from_info() out of qdev_create()
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().

14 years agoqdev: Fix -device and device_add to handle unsuitable bus gracefully
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.

14 years agoerror: Track locations on command line
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

14 years agoQemuOpts: Fix qemu_config_parse() to catch file read errors
Markus Armbruster [Thu, 18 Feb 2010 18:56:01 +0000 (19:56 +0100)]
QemuOpts: Fix qemu_config_parse() to catch file read errors

14 years agoerror: Track locations in configuration files
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:)

14 years agoerror: Include the program name in error messages to stderr
Markus Armbruster [Wed, 24 Feb 2010 13:37:14 +0000 (14:37 +0100)]
error: Include the program name in error messages to stderr

14 years agoerror: Infrastructure to track locations for error reporting
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.

14 years agoerror: Rename qemu_error_new() to qerror_report()
Markus Armbruster [Tue, 2 Mar 2010 17:15:09 +0000 (18:15 +0100)]
error: Rename qemu_error_new() to qerror_report()

14 years agoerror: Replace qemu_error() by error_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.

14 years agoerror: Don't abuse qemu_error() for non-error in scsi_hot_add()
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.

14 years agoerror: Don't abuse qemu_error() for non-error in qbus_find()
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.

14 years agoerror: Don't abuse qemu_error() for non-error in qdev_device_help()
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.

14 years agoerror: New error_printf() and error_vprintf()
Markus Armbruster [Thu, 18 Feb 2010 16:14:17 +0000 (17:14 +0100)]
error: New error_printf() and error_vprintf()

14 years agoerror: Move qemu_error & friends into their own header
Markus Armbruster [Thu, 18 Feb 2010 15:24:31 +0000 (16:24 +0100)]
error: Move qemu_error & friends into their own header

14 years agoerror: Simplify error sink setup
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.

14 years agoerror: Move qemu_error() & friends from monitor.c to own file
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.

14 years agomonitor: Factor monitor_set_error() out of qemu_error_internal()
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.

14 years agoblock: Simplify usb_msd_initfn() test for "can read bdrv key"
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.

14 years agomonitor: Separate "default monitor" and "current monitor" cleanly
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.

14 years agotools: Remove unused cur_mon from qemu-tool.c
Markus Armbruster [Thu, 18 Feb 2010 09:21:36 +0000 (10:21 +0100)]
tools: Remove unused cur_mon from qemu-tool.c

14 years agopc: Factor common code out of pc_boot_set() and cmos_init()
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.

14 years agopc: Fix error reporting for -boot once
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().

14 years agosavevm: Fix -loadvm to report errors to stderr, not the monitor
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.

14 years agousb: Remove disabled monitor_printf() in usb_read_file()
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.

14 years agotarget-ppc: fix evsrwu and evsrws (second try)
Aurelien Jarno [Thu, 11 Mar 2010 20:29:42 +0000 (21:29 +0100)]
target-ppc: fix evsrwu and evsrws (second try)

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: fix evsrwu and evsrws
Aurelien Jarno [Thu, 11 Mar 2010 20:22:35 +0000 (21:22 +0100)]
target-ppc: fix evsrwu and evsrws

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: fix evslw instruction
Aurelien Jarno [Thu, 11 Mar 2010 20:14:47 +0000 (21:14 +0100)]
target-ppc: fix evslw instruction

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoaudio: fix comment
malc [Thu, 11 Mar 2010 15:28:38 +0000 (18:28 +0300)]
audio: fix comment

Signed-off-by: malc <av1474@comtv.ru>
14 years agoQMP: Really move the RESET event to qemu_system_reset()
Luiz Capitulino [Wed, 10 Mar 2010 15:06:34 +0000 (09:06 -0600)]
QMP: Really move the RESET event to qemu_system_reset()

Something bad has happened in the merge of commit 0ee44250, as
the log message says it's supposed to be in qemu_system_reset()
but it is do_vm_stop().

Possibly, it was a problem with the conflict resolution with
ea375f9a (which has been merged first).

This commit moves (again) the RESET event into qemu_system_reset().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotarget-i386: fix SIB decoding with index = 4
Aurelien Jarno [Sat, 6 Mar 2010 17:02:31 +0000 (18:02 +0100)]
target-i386: fix SIB decoding with index = 4

A SIB byte with an index of 4 means "no scaled index", even if the scale
value is not 0. In 64-bit mode, if REX.X is used, an index of 4 selects
%r12. This is correctly handled by the computation of the index variable,
which includes the index bits, and also the REX.X prefix:

    index = ((code >> 3) & 7) | REX_X(s);

Thanks to Avi Kivity, Jamie Lokier and Malc for the analysis of the
problem and the initial patch.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agodocumentation: qemu_write_full don't work with non-blocking fd's
Juan Quintela [Thu, 4 Mar 2010 09:00:39 +0000 (10:00 +0100)]
documentation: qemu_write_full don't work with non-blocking fd's

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoblock: print errno on error
Juan Quintela [Thu, 4 Mar 2010 09:00:38 +0000 (10:00 +0100)]
block: print errno on error

Now that we changed all create calls to return errno, just print it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmdk: share cleanup code
Juan Quintela [Thu, 4 Mar 2010 09:00:37 +0000 (10:00 +0100)]
vmdk: share cleanup code

cleanup code is identical for error/success cases.  Only difference
are goto labels.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmdk: fix double free
Juan Quintela [Thu, 4 Mar 2010 09:00:36 +0000 (10:00 +0100)]
vmdk: fix double free

fail_gd error case would also free rgd_buf that was already freed

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmdk: make vmdk_snapshot_create return -errno
Juan Quintela [Thu, 4 Mar 2010 09:00:35 +0000 (10:00 +0100)]
vmdk: make vmdk_snapshot_create return -errno

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmdk: return errno instead of -1
Juan Quintela [Thu, 4 Mar 2010 09:00:34 +0000 (10:00 +0100)]
vmdk: return errno instead of -1

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow: return errno instead of -1
Juan Quintela [Thu, 4 Mar 2010 09:00:33 +0000 (10:00 +0100)]
qcow: return errno instead of -1

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: return errno instead of -1
Juan Quintela [Thu, 4 Mar 2010 09:00:32 +0000 (10:00 +0100)]
qcow2: return errno instead of -1

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoslirp: check system() success
Juan Quintela [Thu, 4 Mar 2010 09:00:31 +0000 (10:00 +0100)]
slirp: check system() success

we shouldn't call W*() macros until we check that fork worked.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agocow: return errno instead of -1
Juan Quintela [Thu, 4 Mar 2010 09:00:30 +0000 (10:00 +0100)]
cow: return errno instead of -1

Remove not needed ret = 0 assignment.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-img rebase: Add -f option
Kevin Wolf [Tue, 2 Mar 2010 11:14:31 +0000 (12:14 +0100)]
qemu-img rebase: Add -f option

Allow the user to specify the format of the image to rebase.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoconfigure: Fix code which creates config.mak files
Stefan Weil [Mon, 1 Mar 2010 21:20:29 +0000 (22:20 +0100)]
configure: Fix code which creates config.mak files

These files are created by configure and grow
unnecessarily at each new call of configure:

roms/seabios/config.mak
roms/vgabios/config.mak
libhw32/config.mak
libhw64/config.mak

libhw32/config.mak and libhw64/config.mak set
compiler options, and the wrong old code results
in very long command lines.

The new code always writes a new config.mak
instead of appending to an existing one.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoconfigure: Fix wrong stderr redirection
Stefan Weil [Mon, 1 Mar 2010 21:10:46 +0000 (22:10 +0100)]
configure: Fix wrong stderr redirection

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce WATCHDOG event
Luiz Capitulino [Thu, 25 Feb 2010 15:13:04 +0000 (12:13 -0300)]
QMP: Introduce WATCHDOG event

It's emitted whenever the watchdog device's timer expires. The action
taken is provided in the 'data' member.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRestore terminal attributes for tty based monitor
Shahar Havivi [Fri, 26 Feb 2010 09:34:59 +0000 (11:34 +0200)]
Restore terminal attributes for tty based monitor

Patch http://permalink.gmane.org/gmane.comp.emulators.qemu/63472 handle
close when using tty devices (like /dev/ttyS0),
yet tty based monitor are not restoring terminal attributes (as done
with stdio based monitor), when closing qemu after that command:
$ qemu -monitor /dev/tty
the terminal is not responding until you write reset (blindly),
this patch fix it

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokbd keds: vnc
Gerd Hoffmann [Fri, 26 Feb 2010 16:17:39 +0000 (17:17 +0100)]
kbd keds: vnc

Use led status notification support in vnc.

The qemu vnc server keeps track of the capslock and numlock states based
on the key presses it receives from the vnc client.  But this fails in
case the guests idea of the capslock and numlock state changes for other
reasons.  One case is guest reboot (+ keyboard reset).  Another case are
more recent windows versions which reset capslock state before
presenting the login screen.

Usually guests use the keyboard leds to signal the capslock and numlock
state to the user, so we can use this to better keep track of capslock
and numlock state in the qemu vnc server.

Also toggle the numlock and capslock states on keydown events (instead
of keyup).  Guests do the same.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokbd leds: usb kbd
Gerd Hoffmann [Fri, 26 Feb 2010 16:17:38 +0000 (17:17 +0100)]
kbd leds: usb kbd

Add led status notification support to the usb kbd driver.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokbd leds: ps/2 kbd
Gerd Hoffmann [Fri, 26 Feb 2010 16:17:37 +0000 (17:17 +0100)]
kbd leds: ps/2 kbd

Add led status notification support to the ps/2 kbd driver.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokbd leds: infrastructure
Gerd Hoffmann [Fri, 26 Feb 2010 16:17:36 +0000 (17:17 +0100)]
kbd leds: infrastructure

Adds infrastructure for keyboard led status tracking to qemu.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: Make device scsi-disk reject /dev/sg*
Markus Armbruster [Thu, 25 Feb 2010 10:23:52 +0000 (11:23 +0100)]
scsi: Make device scsi-disk reject /dev/sg*

You're supposed to use scsi-generic for that.  Which rejects anything
but /dev/sg*.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Catch attempt to attach more than one device to a netdev
Markus Armbruster [Fri, 26 Feb 2010 14:50:51 +0000 (15:50 +0100)]
qdev: Catch attempt to attach more than one device to a netdev

Guest device and host netdev are peers, i.e. it's a 1:1 relation.
However, we fail to enforce that:

    $ qemu -nodefaults --nographic -netdev user,id=net0 -device e1000,netdev=net0 -device virtio-net-pci,netdev=net0 -monitor stdio
    QEMU 0.12.50 monitor - type 'help' for more information
    (qemu) info network
    Devices not on any VLAN:
      net0: net=10.0.2.0, restricted=n peer=virtio-net-pci.0
      e1000.0: model=e1000,macaddr=52:54:00:12:34:56 peer=net0
      virtio-net-pci.0: model=virtio-net-pci,macaddr=52:54:00:12:34:57 peer=net0

It's all downhill from there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Improve diagnostics for bad property values
Markus Armbruster [Fri, 26 Feb 2010 14:50:50 +0000 (15:50 +0100)]
qdev: Improve diagnostics for bad property values

Property "vlan" reports "failed to parse" even when the value parses
just fine, but the result doesn't name an existing VLAN.

Similarly, properties "drive", "chr" and "netdev" misleadingly report
"failed to parse" when the value doesn't name an existing host device.

Change PropertyInfo method parse to return an error code, so that
qdev_prop_parse() can report the error more accurately.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial
Amit Shah [Thu, 25 Feb 2010 11:54:44 +0000 (17:24 +0530)]
virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial

Use the named constant instead of -1.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
Amit Shah [Thu, 25 Feb 2010 11:54:43 +0000 (17:24 +0530)]
qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors

net.c used a constant to signify no MSI vectors were specified. Extend
that to all qdev devices.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopcnet APROMWE bit location (retry)
Chris Kilgour [Wed, 24 Feb 2010 06:32:14 +0000 (22:32 -0800)]
pcnet APROMWE bit location (retry)

According to AMD document 21485D pp.141, APROMWE is bit 8 of BCR2.

Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomove x509 file name defines to qemu-x509.h
Gerd Hoffmann [Thu, 25 Feb 2010 08:41:36 +0000 (09:41 +0100)]
move x509 file name defines to qemu-x509.h

Want share them with vnc and spice.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoadding helper pci functions
Izik Eidus [Thu, 25 Feb 2010 08:41:25 +0000 (09:41 +0100)]
adding helper pci functions

Signed-off-by: Izik Eidus <ieidus@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce RTC_CHANGE event
Luiz Capitulino [Thu, 25 Feb 2010 15:11:44 +0000 (12:11 -0300)]
QMP: Introduce RTC_CHANGE event

Emitted whenever the RTC time changes.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Revamp the qmp-events.txt file
Luiz Capitulino [Thu, 25 Feb 2010 15:07:02 +0000 (12:07 -0300)]
QMP: Revamp the qmp-events.txt file

Now we can say it's useful, the following changes have been made:

- Put events in alphabetical order
- Add examples to all events
- Document all 'data' members
- Small corrections and cleanups

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Drop DEBUG event
Luiz Capitulino [Thu, 25 Feb 2010 15:07:01 +0000 (12:07 -0300)]
QMP: Drop DEBUG event

This event has been introduced in the first round of QMP commits,
turns out that it's based on the usage of the EXCP_DEBUG macro,
which has discussable semantics when exposed through QMP.

As libvirt doesn't use this, let's just drop it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Move RESET event into qemu_system_reset()
Luiz Capitulino [Thu, 25 Feb 2010 15:07:00 +0000 (12:07 -0300)]
QMP: Move RESET event into qemu_system_reset()

Nothing will change as that function is currently only called by
the main loop code, but it's the right place for the RESET event,
as it's where the reset is actually performed.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Move STOP event into do_vm_stop()
Luiz Capitulino [Thu, 25 Feb 2010 15:06:59 +0000 (12:06 -0300)]
QMP: Move STOP event into do_vm_stop()

I've introduced the STOP event in the main loop, this is wrong
as it will be only emitted if the io thread is enabled.

This fixes that by moving the STOP event to do_vm_stop().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoblock: Emit BLOCK_IO_ERROR before vm_stop() call
Luiz Capitulino [Thu, 25 Feb 2010 15:06:58 +0000 (12:06 -0300)]
block: Emit BLOCK_IO_ERROR before vm_stop() call

The next commit will move the STOP event into do_vm_stop(), to
have the expected event sequence we need to emit the I/O error
event before calling vm_stop().

The expected sequence is:

{ "event": "BLOCK_IO_ERROR" [...] }
{ "event": "STOP" }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix hanging user monitor when using balloon command
Adam Litke [Mon, 22 Feb 2010 16:51:20 +0000 (10:51 -0600)]
Fix hanging user monitor when using balloon command

This patch application failed.  My patch adds a cb() call in
do_balloon(), but the change in git has added the cb() call to
do_info_balloon().  That is causing qemu segfaults.  Applying the
following should correct the damage.  Thanks.

Fix for commit: 5c366a8a3d7ac71beda8499caa815cb3ea95eb58

The cb() call is needed in do_balloon(), not do_info_balloon().

Signed-off-by: Adam Litke <agl@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosdl: improve grab exiting instructions
Anthony Liguori [Mon, 1 Mar 2010 14:47:28 +0000 (08:47 -0600)]
sdl: improve grab exiting instructions

It might not be obvious what "grab" is.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoppc: don't define bamboo-0.13 as the default machine
Aurelien Jarno [Mon, 8 Mar 2010 11:31:27 +0000 (12:31 +0100)]
ppc: don't define bamboo-0.13 as the default machine

It has been broken by commit 977b6b91cee1132f8c7b12d22f4b273091598e44.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoUpdate to a hopefully more future proof FSF address
Blue Swirl [Sun, 7 Mar 2010 15:48:43 +0000 (15:48 +0000)]
Update to a hopefully more future proof FSF address

See also 8167ee883931cb20c6264fc19d040ce2dc6ceaaa,
530e7615ce3c01882e582c84dc6304ab98a3d5c5 and
fad6cb1a565bb73f83fc0e2654489457b489e436.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoi386-dis: remove dead assignments, spotted by clang
Blue Swirl [Sun, 7 Mar 2010 13:56:27 +0000 (13:56 +0000)]
i386-dis: remove dead assignments, spotted by clang

Value stored to 'mask' is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosoftfloat: remove dead assignments, spotted by clang
Blue Swirl [Sun, 7 Mar 2010 13:49:58 +0000 (13:49 +0000)]
softfloat: remove dead assignments, spotted by clang

Value stored to 'bSign' is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoslirp: remove dead nested assignment, spotted by clang
Blue Swirl [Sun, 7 Mar 2010 13:45:38 +0000 (13:45 +0000)]
slirp: remove dead nested assignment, spotted by clang

Although the value stored to 'r' is used in the enclosing expression,
the value is never actually read from 'r'.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoslirp: remove dead initialization, spotted by clang
Blue Swirl [Sun, 7 Mar 2010 13:45:38 +0000 (13:45 +0000)]
slirp: remove dead initialization, spotted by clang

Value stored during initialization is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoslirp: remove dead increments, spotted by clang
Blue Swirl [Sun, 7 Mar 2010 13:45:37 +0000 (13:45 +0000)]
slirp: remove dead increments, spotted by clang

Value stored is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoslirp: remove dead assignments, spotted by clang
Blue Swirl [Sun, 7 Mar 2010 13:13:05 +0000 (13:13 +0000)]
slirp: remove dead assignments, spotted by clang

Value stored is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotarget-arm: Fix missing 'return' in SRS handling.
Adam Lackorzynski [Mon, 1 Mar 2010 16:19:54 +0000 (17:19 +0100)]
target-arm: Fix missing 'return' in SRS handling.

There's a return missing in the srs handling which leads to srs always being
treated an an invalid op.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix curses interaction with keymaps
Samuel Thibault [Sun, 28 Feb 2010 20:03:00 +0000 (21:03 +0100)]
Fix curses interaction with keymaps

The combination of keymap support (-k option) and curses is currently
very broken.  The patch below fixes it by first extending keymap support
to interpret the shift, ctrl, altgr and addupper keywords in keymaps,
and to fix curses into properly using keymaps.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agouse absolute URLs for .gitmodules
Paolo Bonzini [Fri, 5 Mar 2010 08:08:04 +0000 (09:08 +0100)]
use absolute URLs for .gitmodules

The relative URLs do not work when cloning a fork of qemu or when
cloning from the Savannah URL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoDocumentation: Modify rule for html output (better looking output format)
Stefan Weil [Thu, 4 Mar 2010 21:21:02 +0000 (22:21 +0100)]
Documentation: Modify rule for html output (better looking output format)

To create html output from texi input, texi2html was used.
Output from makeinfo looks cleaner, so replace the old rule
and use makeinfo now.

For those who want to use their own variant of html output,
the macros MAKEINFO and MAKEINFOFLAGS allow customisation.
Option "-I ." is not needed (the current directory is
searched by default), so remove it.

Please note that the build requirements changed, too:
makeinfo is required for doc builds.
texi2html is no longer used.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoscsi: update comment on the standards revision
Christoph Hellwig [Thu, 4 Mar 2010 13:45:44 +0000 (14:45 +0100)]
scsi: update comment on the standards revision

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoqemu-nbd: Fix wrong description in qemu-nbd.texi
Ryota Ozaki [Wed, 3 Mar 2010 15:18:43 +0000 (00:18 +0900)]
qemu-nbd: Fix wrong description in qemu-nbd.texi

-c option needs argument <dev> but it's missing now.
This patch fixes it.

Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoBuild usb-ohci for PCs
Kevin Wolf [Wed, 3 Mar 2010 15:02:25 +0000 (16:02 +0100)]
Build usb-ohci for PCs

The OHCI emulation isn't obviously broken and there are people who want to use
it. Let's build it by default so that it can be enabled via -device.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoppc440_bamboo: Disable new virtio-serial features for 0.12 machine type
Amit Shah [Thu, 25 Feb 2010 13:56:12 +0000 (19:26 +0530)]
ppc440_bamboo: Disable new virtio-serial features for 0.12 machine type

Disable the MULTIPORT feature and MSI vectors for the 0.12 machine
types; those features are added only for 0.13 onwards.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoppc440_bamboo: Add 0.12 and 0.13 machine types for backward compat
Amit Shah [Thu, 25 Feb 2010 13:56:11 +0000 (19:26 +0530)]
ppc440_bamboo: Add 0.12 and 0.13 machine types for backward compat

Add a 0.12 machine type for compatibility with older versions. Mark the
default one as 0.13.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>