Commit Graph

11245 Commits

Author SHA1 Message Date
Markus Armbruster fc98eb430e qdev: Relax parsing of bus option
Treat multiple successive slashes as a one slash.  Ignore trailing
slashes.  This is how POSIX pathnames work.
2010-03-16 17:45:34 +01:00
Markus Armbruster fdcfa190ab qdev: convert setting device properties to QError 2010-03-16 17:45:26 +01:00
Markus Armbruster 84745d68e7 error: New QERR_PROPERTY_VALUE_NOT_FOUND 2010-03-16 17:45:26 +01:00
Markus Armbruster 9c5eff958d error: New QERR_PROPERTY_VALUE_IN_USE 2010-03-16 17:45:26 +01:00
Markus Armbruster 06b4a703e0 error: New QERR_PROPERTY_VALUE_BAD 2010-03-16 17:01:08 +01:00
Markus Armbruster c58a35f8e3 error: New QERR_PROPERTY_NOT_FOUND 2010-03-16 17:01:08 +01:00
Markus Armbruster fc5469d87b error: Polish human-readable error descriptions
Also put error definitions in alphabetical order
2010-03-16 17:01:08 +01:00
Markus Armbruster cde0fc7544 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.
2010-03-16 17:01:08 +01:00
Markus Armbruster 6620d3ce9e monitor: New monitor_cur_is_qmp() 2010-03-16 17:01:08 +01:00
Markus Armbruster 036f7166c7 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.
2010-03-16 17:01:08 +01:00
Markus Armbruster c64eafaf0c 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.
2010-03-16 16:58:32 +01:00
Markus Armbruster 0c17542d90 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().
2010-03-16 16:58:32 +01:00
Markus Armbruster 327867b62a qdev: Fix -device and device_add to handle unsuitable bus gracefully
"device_add isa-serial,bus=pci.0" kills QEMU.  Not good.
2010-03-16 16:58:32 +01:00
Markus Armbruster 0f0bc3f1d5 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
2010-03-16 16:58:32 +01:00
Markus Armbruster ef82516d8f QemuOpts: Fix qemu_config_parse() to catch file read errors 2010-03-16 16:58:32 +01:00
Markus Armbruster cf5a65aaaf 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:)
2010-03-16 16:58:32 +01:00
Markus Armbruster 65abca0a34 error: Include the program name in error messages to stderr 2010-03-16 16:58:32 +01:00
Markus Armbruster 827b08139c 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.
2010-03-16 16:58:32 +01:00
Markus Armbruster ab5b027ee6 error: Rename qemu_error_new() to qerror_report() 2010-03-16 16:58:32 +01:00
Markus Armbruster 1ecda02b24 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.
2010-03-16 16:58:32 +01:00
Markus Armbruster 6fdb03d58c 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.
2010-03-16 16:55:06 +01:00
Markus Armbruster 53db16b5b0 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.
2010-03-16 16:55:05 +01:00
Markus Armbruster 8a9662ca67 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.
2010-03-16 16:55:05 +01:00
Markus Armbruster ba0fe87acd error: New error_printf() and error_vprintf() 2010-03-16 16:55:05 +01:00
Markus Armbruster 2f7920166d error: Move qemu_error & friends into their own header 2010-03-16 16:55:05 +01:00
Markus Armbruster 6e4f984cb9 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.
2010-03-16 16:55:05 +01:00
Markus Armbruster b4a51f7f5d error: Move qemu_error() & friends from monitor.c to own file
They're about reporting errors, not about the monitor.
2010-03-16 16:55:05 +01:00
Markus Armbruster d6f468337a monitor: Factor monitor_set_error() out of qemu_error_internal()
This separates the monitor part from the QError part.
2010-03-16 16:55:05 +01:00
Markus Armbruster a44264880e 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.
2010-03-16 16:55:05 +01:00
Markus Armbruster 8631b6084a 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.
2010-03-16 16:55:05 +01:00
Markus Armbruster 070a2f819a tools: Remove unused cur_mon from qemu-tool.c 2010-03-16 16:55:05 +01:00
Markus Armbruster d9346e81de 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.
2010-03-16 16:55:05 +01:00
Markus Armbruster 8ad00f8425 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().
2010-03-16 16:55:05 +01:00
Markus Armbruster 03cd4655cb 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.
2010-03-16 16:55:05 +01:00
Markus Armbruster 4491e0f398 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.
2010-03-16 16:55:04 +01:00
Aurelien Jarno 409dbce54b 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>
2010-03-16 08:38:05 +01:00
Michael S. Tsirkin 7a7e5db993 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 d350d97d19,
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>
2010-03-15 13:52:06 +02:00
Michael S. Tsirkin 15e89f5916 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>
2010-03-15 13:52:05 +02:00
Kevin Wolf cb66ffcf9e 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>
2010-03-14 23:56:47 +01:00
Aurelien Jarno 7b9cbadb2b mips: add header to mips_int.c and mips_timer.c
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-14 23:30:44 +01:00
Aurelien Jarno dbfff4deb5 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>
2010-03-14 23:01:01 +01:00
Jan Kiszka 39324ca488 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>
2010-03-14 22:43:37 +01:00
Jan Kiszka 18141ed67f Don't set default monitor when there is a mux'ed one
This fixes eg. "-nographic -serial mon:stdio [-serial ...]".

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-14 22:43:35 +01:00
Aurelien Jarno 2b71cd72d3 tcg/arm: use helpers for divu/remu
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-14 22:04:54 +01:00
Aurelien Jarno 31d6655100 tcg: add div/rem 32-bit helpers
Some targets like ARM would benefit to use 32-bit helpers for
div/rem/divu/remu.

Create a #define for div2 so that targets can select between
div, div2 and helper implementation. Use the helper version if none
of the #define are present.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-14 22:04:50 +01:00
Paul Brook 7296abaccc Fix pagetable code
The multi-level pagetable code fails to iterate ove all entries because
of the L2_BITS v.s. L2_SIZE thinko.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-03-14 14:58:46 +00:00
Vagrant Cascadian 66c80e7575 spelling typo (compatibilty) in hw/fw_cfg.c
here's a trivial patch to fix the spelling of "compatibility":

Signed-off-by: Vagrant Cascadian <vagrant@freegeek.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-14 08:52:55 +00:00
Aurelien Jarno 2f7a21c4a5 x86/cpuid: fix indentation
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-13 16:50:54 +01:00
Aurelien Jarno 8560efed6a x86/cpuid: Enable all features of real CPU
Enable all features of real CPU, unsupported features will be
trimmed depending on TCG or KVM capabilities.

Move the list of unsupported TCG features near the TCG capabilities
masks.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-13 16:50:54 +01:00
Andre Przywara 58012d66dc x86/cpuid: fix CPUID levels
Bump up the xlevel number for qemu32 to allow parsing of the processor
name string for this model.
Similiarly the 486 processor should have at least the feature bit
leaf enabled.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-13 16:50:54 +01:00