Commit Graph

223 Commits

Author SHA1 Message Date
Luiz Capitulino fb46660e98 monitor: Update supported types documentation
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:33 -05:00
Luiz Capitulino 675ebef9e2 monitor: fail when 'i' type is greater than 32-bit
The 'i' argument type is for 32-bit only and most handlers
will use an 'int' to store its value.

It's better to fail gracefully when the user enters a value
greater than 32-bit than to get subtle casting bugs.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:33 -05:00
Luiz Capitulino 53773581b8 monitor: Drop args[] handling code
This commit drops all the code used to handle the 'args[]' array,
as now we use a dictionary to pass arguments.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:32 -05:00
Luiz Capitulino 590fb3b78b monitor: Drop str_allocated[]
It's not used anymore, as QDict is now used to handle string
memory allocation/deallocation.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:32 -05:00
Luiz Capitulino 439bcb61c5 monitor: Drop unused macros
GET_TLONG() and GET_TPHYSADDR() are not needed anymore, QInt can
handle such conversions.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:32 -05:00
Luiz Capitulino 55f81d963b monitor: Split monitor_handle_command()
In order to help the integration with unit-tests and having a better
design, this commit splits monitor_handle_command() into two parts.

The parsing code is moved to a function called monitor_parse_command(),
while allocating memory and calling the handler is still done by
monitor_handle_command().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:32 -05:00
Luiz Capitulino 37b7ad484d monitor: Port handler_10 to use QDict
This commit ports command handlers that receive ten arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:32 -05:00
Luiz Capitulino 6d1cac3b01 monitor: Drop handler_8 and handler_9
Commit 79c4f6b080 added handler_8 and
handler_9 handling, but there isn't any command handler with those
number of arguments.

Just drop them.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:32 -05:00
Luiz Capitulino c192548474 monitor: Port handler_7 to use QDict
This commit ports command handlers that receive seven arguments to
use the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino aa93e39ca4 monitor: Port handler_6 to use QDict
This commit ports command handlers that receive six arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino 1bd1442e40 monitor: Port handler_5 to use QDict
This commit ports command handlers that receive five arguments to use
the new monitor's dictionary.

Note that GET_TLONG() and GET_TPHYSADDR() macros are not used anymore.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino afe67ef295 monitor: Port handler_4 to use QDict
This commit ports command handlers that receive four arguments to use
the new monitor's dictionary.

Note that GET_TLONG() and GET_TPHYSADDR() macros are not used anymore.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino 1d4daa91ff monitor: Port handler_3 to use QDict
This commit ports command handlers that receive three arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino f18c16de4a monitor: Port handler_2 to use QDict
This commit ports command handlers that receive two arguments to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino d54908a55b monitor: Port handler_1 to use QDict
This commit ports command handlers that receive one argument to use
the new monitor's dictionary.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:31 -05:00
Luiz Capitulino f96fc8a0f1 monitor: Port handler_0 to use QDict
This commit ports command handlers that receive no arguments to use
the new monitor's dictionary.

It might seem no sense to do this, as the handlers have no arguments,
but at the end of this porting work all handlers will have the same
structure.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:30 -05:00
Luiz Capitulino f7188bbea7 monitor: Setup a QDict with arguments to handlers
With this commit monitor_handle_command() will be able to setup a
QDict with arguments to command handlers.

However, the current 'args[]' method is still being used, next
changes will port commands to get their arguments from the dictionary.

Two changes are worth noting:

1. The '/' argument type always adds the following standard keys in the
dictionary: 'count', 'format' and 'size'. This way, the argument
name used in the 'args_type' string doesn't matter

2. The optional argument type '?' doesn't need to pass the additional
'has_arg' argument, hanlders can do the same check with qdict_haskey()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:30 -05:00
Luiz Capitulino 4d76d2ba9d monitor: New format for handlers argument types
Current handlers argument types, as defined in qemu-monitor.hx file,
are a sequence of chars where each one represents one argument type
of the command handler. The number of chars is also used to know how
many arguments a given handler accepts.

This commit defines a new format, which makes mandatory the use of
a name for each argument.

For example, do_eject() command handler is currently defined as:

{ "eject", "-fB", do_eject, ... }

With the new format it becomes:

{ "eject", "force:-f,filename:B", do_eject, ... }

This way the Monitor will be capable of setting up a dictionary, using
each argument's name as the key and the argument itself as the value.

This commit also adds two new functions: key_get_info() and
next_arg_type(), both are used to parse the new format.

Currently key_get_info() consumes the 'key' part of the new format and
discards it, this way the current parsing code is not affected by this
change.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:29 -05:00
Luiz Capitulino 3818318682 Add wrappers to functions used by the Monitor
Some functions exported to be used by the Monitor as command
handlers are also called in other places as regular functions.

When those functions got ported to use the Monitor dictionary
to pass argments, the callers will have to setup a dictionary
to be able to call them.

To avoid this problem, this commit add wrappers to those functions,
so that we change the wrapper to accept the dictionary, letting
the current functions as is.

The following wrappers are being added:

- do_help_cmd()
- do_pci_device_hot_remove()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-04 09:37:29 -05:00
Blue Swirl 528e93a978 Fix breakage due to __thread
Thread-local storage is not supported on all hosts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-08-31 15:14:40 +00:00
Gerd Hoffmann ac7531ecdc add qemu_error() + friends
This patch adds some functions for error reporting to address the
problem that error messages should be routed to different destinations
depending on the context of the caller, i.e. monitor command errors
should go to the monitor, command line errors to stderr.

qemu_error() is a printf-like function to report errors.

qemu_errors_to_file() and qemu_errors_to_mon() switch the destination
for the error message to the specified file or monitor.  When setting a
new destination the old one will be kept.  One can switch back using
qemu_errors_to_previous().  i.e. it works like a stack.

main() calls qemu_errors_to_file(stderr), so errors go to stderr by
default.  monitor callbacks are wrapped into qemu_errors_to_mon() +
qemu_errors_to_previous(), so any errors triggered by monitor commands
will go to the monitor.

Each thread has its own error message destination.  qemu-kvm probably
should add a qemu_errors_to_file(stderr) call to the i/o-thread
initialization code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:43:33 -05:00
Avi Kivity 4c0960c0c4 kvm: Simplify cpu_synchronize_state()
cpu_synchronize_state() is a little unreadable since the 'modified'
argument isn't self-explanatory.  Simplify it by making it always
synchronize the kernel state into qemu, and automatically flush the
registers back to the kernel if they've been synchronized on this
exit.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:35:30 -05:00
Juan Quintela 05f2401eb2 make load_vmstate() return errors
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:30:20 -05:00
Juan Quintela c8d41b2c29 move do_loadvm() to monitor.c
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27 20:30:20 -05:00
Anthony Liguori 4a1418e07b Unbreak large mem support by removing kqemu
kqemu introduces a number of restrictions on the i386 target.  The worst is that
it prevents large memory from working in the default build.

Furthermore, kqemu is fundamentally flawed in a number of ways.  It relies on
the TSC as a time source which will not be reliable on a multiple processor
system in userspace.  Since most modern processors are multicore, this severely
limits the utility of kqemu.

kvm is a viable alternative for people looking to accelerate qemu and has the
benefit of being supported by the upstream Linux kernel.  If someone can
implement work arounds to remove the restrictions introduced by kqemu, I'm
happy to avoid and/or revert this patch.

N.B. kqemu will still function in the 0.11 series but this patch removes it from
the 0.12 series.

Paul, please Ack or Nack this patch.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-24 08:02:55 -05:00
Blue Swirl 2a1704a71d Fix device name completion for 'eject'
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-08-23 20:10:28 +00:00
Gerd Hoffmann f6c64e0eea rename "info qdrv" to "info qdm"
As requested by avi: driver != device model.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:
2009-08-10 13:11:27 -05:00
Luiz Capitulino 73006d2a9a Fix do_commit() behavior
Commit 751c6a1704 changed the monitor's
'commit' command to this behavior:

1. Any string you type as argument will cause do_commit() to
call bdrv_commit() to all devices

2. If you enter a device name, it will be the only one ignored
by do_commit() :)

The fix is to call bdrv_commit() to the specified device only and
ignore the others (when 'all' is not specified).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:
2009-08-10 13:05:48 -05:00
Blue Swirl 660f11be54 Fix Sparse warnings: "Using plain integer as NULL pointer"
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-31 21:16:51 +00:00
Gerd Hoffmann 9316d30fbb qdev/core: add monitor command to list all drivers
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-30 09:50:37 -05:00
Gerd Hoffmann 751c6a1704 kill drives_table
First step cleaning up the drives handling.  This one does nothing but
removing drives_table[], still it became seriously big.

drive_get_index() is gone and is replaced by drives_get() which hands
out DriveInfo pointers instead of a table index.  This needs adaption in
*tons* of places all over.

The drives are now maintained as linked list.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27 14:08:23 -05:00
Mark McLoughlin 7768e04c34 Add monitor_get_fd() command for fetching named fds
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27 08:39:28 -05:00
Mark McLoughlin f07918fdff Add getfd and closefd monitor commands
Add monitor commands to support passing file descriptors via
SCM_RIGHTS.

getfd assigns the passed file descriptor a name for use with other
monitor commands.

closefd allows passed file descriptors to be closed. If a monitor
command actually uses a named file descriptor, closefd will not be
required.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27 08:39:28 -05:00
Jan Kiszka f114784f69 monitor: Add port write command
Useful for testing hardware emulations or manipulating its state to
stress guest drivers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16 17:28:51 -05:00
Jan Kiszka 76e30d0f13 Move boot_set callback backend
Move registration function for the boot_set callback handler and provide
qemu_boot_set so that it can also be used outside the monitor code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16 08:28:12 -05:00
Isaku Yamahata d56dd6cf03 use constant IOPORTS_MASK instead of 0xffff.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-09 16:06:39 -05:00
Huang Ying 79c4f6b080 QEMU: MCE: Add MCE simulation to qemu/tcg
- MCE features are initialized when VCPU is intialized according to CPUID.
- A monitor command "mce" is added to inject a MCE.
- A new interrupt mask: CPU_INTERRUPT_MCE is added to inject the MCE.

aliguori: fix build for linux-user

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-09 16:04:53 -05:00
Jan Kiszka 15dfcd454c monitor: Refactor acl commnds
Refactor the ACL monitor interface to make full use of the monitor
command dispatcher. This also gives proper help formatting and command
completion. Note that 'acl allow' and 'acl deny' were combined to
'acl_add aclname match allow|deny [index]' for consistency reasons.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 14:18:08 -05:00
Jan Kiszka f3353c6bc3 monitor: Add completion for help command
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 14:18:08 -05:00
Jan Kiszka 0fe6a7f284 slirp: Drop statistic code
As agreed on the mailing list, there is no interest in keeping the
usually disabled slirp statistics in the tree. So this patch removes
them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Jan Kiszka 6dbe553fe9 slirp: Add info usernet for dumping connection states
Break out sockstats from the slirp statistics and present them under the
new info category "usernet". This patch also improves the current output
/wrt proper reporting connection source and destination.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
Luiz Capitulino 4590fd80b8 monitor: Introduce get_command_name()
Move code to extract command name into a function of its own, this
clearifies the code and let us remove two variables from
monitor_handle_command().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2009-06-10 19:46:49 +03:00
Luiz Capitulino 7869001b8f monitor: Remove unused variable
The local pointer 'q' is not used by monitor_handle_command().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2009-06-10 19:46:11 +03:00
Luiz Capitulino a84b785e93 monitor: Remove uneeded 'return' statement
The 'return' statement at the of monitor_handle_command() is not
needed and can be removed.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2009-06-10 19:46:08 +03:00
Luiz Capitulino d91d9bf617 monitor: Remove uneeded goto
The 'found' goto in monitor_handle_command() can be dropped if we check
for 'cmd->name' after looking up for the command to execute.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2009-06-10 19:45:49 +03:00
Blue Swirl 2313086add Use hxtool to generate monitor documentation and C structures
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-06 08:22:04 +00:00
Gerd Hoffmann cae4956e5e qdev: add monitor command to dump the tree.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-05 15:53:17 +01:00
Alexander Graf 1c6ed9f337 User networking: Show active connections
In case you're wondering what connections exactly you have open
or maybe redir'ed in the past, you can't really find out from qemu
right now.

This patch enables you to see all current connections the host
only networking holds open, so you can kill them using the previous
patch.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-28 02:14:56 -05:00
Alexander Graf c1261d8d16 User Networking: Enable removal of redirections
Using the new host_net_redir command you can easily create redirections
on the fly while your VM is running.

While that's great, it's missing the removal of redirections, in case you
want to have a port closed again at a later point in time.

This patch adds support for removal of redirections.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-27 09:46:12 -05:00
Jan Kiszka 322f9d0153 Drop CONFIG_GDBSTUB
This is no user-flippable switch, and no arch makes use of disabling
gdbstub support. So it's pointless to keep the related #ifdefs and
configure hunks around - and risking breakages like 711c410fdd again.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2009-05-08 13:24:12 +01:00