Kevin Wolf [Wed, 14 Apr 2010 13:24:50 +0000 (15:24 +0200)]
block: Avoid forward declaration of bdrv_open_common
Move bdrv_open_common so it's defined before its callers and remove the forward
declaration.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Mon, 12 Apr 2010 14:37:13 +0000 (16:37 +0200)]
block: Split bdrv_open
bdrv_open contains quite some code that is only useful for opening images (as
opposed to opening files by a protocol), for example snapshots.
This patch splits the code so that we have bdrv_open_file() for files (uses
protocols), bdrv_open() for images (uses format drivers) and bdrv_open_common()
for the code common for opening both images and files.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Christoph Hellwig [Wed, 7 Apr 2010 20:30:24 +0000 (22:30 +0200)]
block: separate raw images from the file protocol
We're running into various problems because the "raw" file access, which
is used internally by the various image formats is entangled with the
"raw" image format, which maps the VM view 1:1 to a file system.
This patch renames the raw file backends to the file protocol which
is treated like other protocols (e.g. nbd and http) and adds a new
"raw" image format which is just a wrapper around calls to the underlying
protocol.
The patch is surprisingly simple, besides changing the probing logical
in block.c to only look for image formats when using bdrv_open and
renaming of the old raw protocols to file there's almost nothing in there.
For creating images, a new bdrv_create_file is introduced which guesses the
protocol to use. This allows using qemu-img create -f raw (or just using the
default) for both files and host devices. Converting the other format drivers
to use this function to create their images is left for later patches.
The only issues still open are in the handling of the host devices.
Firstly in current qemu we can specifiy the host* format names
on various command line acceping images, but the new code can't
do that without adding some translation. Second the layering breaks
the no_zero_init flag in the BlockDriver used by qemu-img. I'm not
happy how this is done per-driver instead of per-state so I'll
prepare a separate patch to clean this up.
There's some more cleanup opportunity after this patch, e.g. using
separate lists and registration functions for image formats vs
protocols and maybe even host drivers, but this can be done at a
later stage.
Also there's a check for protocol in bdrv_open for the BDRV_O_SNAPSHOT
case that I don't quite understand, but which I fear won't work as
expected - possibly even before this patch.
Note that this patch requires various recent block patches from Kevin
and me, which should all be in his block queue.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Blue Swirl [Sun, 2 May 2010 18:38:10 +0000 (18:38 +0000)]
Fix missing '|' in '|=', spotted by clang analyzer
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Thomas Monjalon [Wed, 28 Apr 2010 12:42:01 +0000 (14:42 +0200)]
fix old typos in help header
1) Qemu is not only a PC emulator.
2) "image image" has already been changed to "disk image" in qemu-doc.texi
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Stuart Brady [Tue, 27 Apr 2010 21:23:35 +0000 (22:23 +0100)]
Clean up definition of MAX_OPC_PARAM
MAX_OPC_PARAM is intended to refer to the maximum number of entries used
in gen_opparam_buf[] for any single helper call. It is currently defined
as 10, but for 32-bit archs, the correct value (with a maximum for four
helper arguments) is 14, and for 64-bit archs, only 9 entries are needed.
tcg_gen_callN() fills four entries with the function address, flags,
number of args, etc. and on 32-bit archs uses a further two entries per
argument (with a maximum of four helper arguments), plus two more for the
return value. On 64-bit archs, only half as many entries are used for the
args and the return value.
In reality, TBs tend not to consist purely of helper calls exceeding the
stated 10 gen_opparam_buf[] entries, so this would never actually be a
problem on 32-bit archs, but the definition is still rather confusing.
Signed-off-by: Stuart Brady <sdb@zubnet.me.uk>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Igor V. Kovalenko [Thu, 22 Apr 2010 21:54:50 +0000 (01:54 +0400)]
cmd646: fix abort due to changed opaque pointer for ioport read
We cannot install different opaque pointer for read and write
of the same i/o address.
- handle zero address in bmdma_writeb_common and install
the same opaque pointer for both read and write access.
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Igor V. Kovalenko [Thu, 22 Apr 2010 21:54:45 +0000 (01:54 +0400)]
cmd646: pass pci_dev as it needs it
Instead of doing tricks to get the pci_dev, just pass it in the 1st
place. Patch is a bit longer that reverting the pci_dev field, but it
states more clearly (IMHO) what we are doing.
It also fixes the bm test, now that you told me that ->unit is not
always valid.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Amit Shah [Tue, 27 Apr 2010 12:34:11 +0000 (18:04 +0530)]
virtio-serial: Implement flow control for individual ports
Individual ports can now signal to the virtio-serial core to stop
sending data if the ports cannot immediately handle new data. When a
port later unthrottles, any data queued up in the virtqueue are sent to
the port.
Disable throttling once a port is closed (and we discard all the
unconsumed buffers in the vq).
The guest kernel can reclaim the buffers when it receives the port close
event or when a port is being removed. Ensure we free up the buffers
before we send out any events to the guest.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:10 +0000 (18:04 +0530)]
virtio-serial: Discard data that guest sends us when ports aren't connected
Before the earlier patch, we relied on incorrect virtio api usage to
signal to the guest that a particular buffer wasn't consumed by the
host.
After fixing that, we now just discard the data the guest sends us while
a host port is disconnected or doesn't have a handler registered for
consuming data.
This commit really doesn't change anything from the current behaviour,
just makes the code slightly better by spinning off data handling to
ports in another function.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:09 +0000 (18:04 +0530)]
virtio-serial: Apps should consume all data that guest sends out / Fix virtio api abuse
We cannot indicate to the guest how much data was consumed by an app for
out_bufs. So we just have to assume the apps will consume all the data
that are handed over to them.
Fix the virtio api abuse in control_out() and handle_output().
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:08 +0000 (18:04 +0530)]
virtio-serial: Handle scatter/gather input from the guest
Current guests don't send more than one iov but it can change later.
Ensure we handle that case.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:07 +0000 (18:04 +0530)]
virtio-serial: Handle scatter-gather buffers for control messages
Current control messages are small enough to not be split into multiple
buffers but we could run into such a situation in the future or a
malicious guest could cause such a situation.
So handle the entire iov request for control messages.
Also ensure the size of the control request is >= what we expect
otherwise we risk accessing memory that we don't own.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Avi Kivity <avi@redhat.com>
Reported-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:06 +0000 (18:04 +0530)]
iov: Add iov_to_buf and iov_size helpers
iov_to_buf() puts the buffer contents in the iov in a linearized buffer.
iov_size() gets the length of the contents in the iov.
The iov_to_buf() function is the memcpy_to_iovec() function that was
used in virtio-ballon.c.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:05 +0000 (18:04 +0530)]
iov: Introduce a new file for helpers around iovs, add iov_from_buf()
The virtio-net code uses iov_fill() which fills an iov from a linear
buffer. The virtio-serial-bus code does something similar in an
open-coded function.
Create a new iov.c file that has iov_from_buf().
Convert virtio-net and virtio-serial-bus over to use this functionality.
virtio-net used ints to hold sizes, the new function is going to use
size_t types.
Later commits will add the opposite functionality -- going from an iov
to a linear buffer.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:04 +0000 (18:04 +0530)]
virtio-serial: Send out guest data to ports only if port is opened
Data should be written only when ports are open.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:03 +0000 (18:04 +0530)]
virtio-serial: Propagate errors in initialising ports / devices in guest
If adding of ports or devices in the guest fails we can send out a QMP
event so that management software can deal with it.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:02 +0000 (18:04 +0530)]
virtio-serial: Update copyright year to 2010
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:01 +0000 (18:04 +0530)]
virtio-serial: Remove redundant check for 0-sized write request
The check for a 0-sized write request to a guest port is not necessary;
the while loop below won't be executed in this case and all will be
fine.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:34:00 +0000 (18:04 +0530)]
virtio-serial: whitespace: match surrounding code
The virtio-serial code doesn't mix declarations and definitions, so
separate them out on different lines.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:33:59 +0000 (18:03 +0530)]
virtio-serial: Use control messages to notify guest of new ports
Allow the port 'id's to be set by a user on the command line. This is
needed by management apps that will want a stable port numbering scheme
for hot-plug/unplug and migration.
Since the port numbers are shared with the guest (to identify ports in
control messages), we just send a control message to the guest
indicating addition of new ports (hot-plug) or notifying the guest of
the available ports when the guest sends us a DEVICE_READY control
message.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:33:58 +0000 (18:03 +0530)]
virtio-serial: save/load: Send target host connection status if different
If the host connection to a port is closed on the destination machine
after migration, whereas the connection was open on the source, the
guest has to be informed of that.
Similar for a host connection open on the destination.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:33:57 +0000 (18:03 +0530)]
virtio-serial: save/load: Ensure we have hot-plugged ports instantiated
If some ports that were hot-plugged on the source are not available on
the destination, fail migration instead of trying to deref a NULL
pointer.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:33:56 +0000 (18:03 +0530)]
virtio-serial: save/load: Ensure nr_ports on src and dest are same.
The number of ports on the source as well as the destination machines
should match. If they don't, it means some ports that got hotplugged on
the source aren't instantiated on the destination. Or that ports that
were hot-unplugged on the source are created on the destination.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Tue, 27 Apr 2010 12:33:55 +0000 (18:03 +0530)]
virtio-serial: save/load: Ensure target has enough ports
The target could be started with max_nr_ports for a virtio-serial device
lesser than what was available on the source machine. Fail the migration
in such a case.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Thomas Monjalon [Tue, 27 Apr 2010 13:27:09 +0000 (15:27 +0200)]
microblaze: fix custom fprintf
Using GCC-4.2.4-1ubuntu4, there is a warning:
microblaze-dis.c:792: warning: unused variable 'fprintf'
Indeed, fprintf() is shadowed by a custom redefinition but is not used because
of FORTIFY_SOURCE option which replace calls to fprintf() by fprintf_chk().
So, fprintf refers to the libc implementation instead of the qemu one.
It's a bug.
It is fixed by renaming the variable to something different of "fprintf".
It prevents from hazardous shadowing.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Mon, 12 Apr 2010 23:19:26 +0000 (16:19 -0700)]
Implement cpu_get_real_ticks for Alpha.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Mon, 12 Apr 2010 23:18:43 +0000 (16:18 -0700)]
target-alpha: Implement RPCC.
A minimal implementation that more or less corresponds to the
user-level version used by target-i386. More hoops will want
to be jumped through when alpha gets system-level emulation.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Wed, 7 Apr 2010 22:42:26 +0000 (15:42 -0700)]
target-alpha: Fix load-locked/store-conditional.
Use an exception plus start_exclusive to implement the compare-and-swap.
This follows the example set by the MIPS and PPC ports.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Wed, 7 Apr 2010 20:32:50 +0000 (13:32 -0700)]
target-alpha: Indicate NORETURN status when raising exception.
When (indirectly) calling raise_exception, don't emit cleanup
code at the end of the TB, as it is unused.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Mon, 12 Apr 2010 23:17:22 +0000 (16:17 -0700)]
target-alpha: Enable NPTL.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Mon, 29 Mar 2010 17:48:14 +0000 (10:48 -0700)]
target-alpha: Update commentary for opcode 0x1A.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Tue, 16 Mar 2010 22:10:49 +0000 (15:10 -0700)]
target-alpha: Emit goto_tb opcodes.
Use an ExitStatus enumeration instead of magic numbers as the return
value from translate_one. Emit goto_tb opcodes when ending a TB via
a direct branch.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Wed, 7 Apr 2010 17:17:24 +0000 (10:17 -0700)]
target-alpha: Implement cvtlq inline.
It's a simple shift and mask sequence.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Mon, 12 Apr 2010 23:14:54 +0000 (16:14 -0700)]
target-alpha: Implement rs/rc properly.
This is a per-cpu flag; there's no need for a spinlock of any kind.
We were also failing to manipulate the flag with $31 as a target reg
and failing to clear the flag on execution of a return-from-interrupt
instruction.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Mon, 12 Apr 2010 23:12:20 +0000 (16:12 -0700)]
target-alpha: Implement cpys{, n, e} inline.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Anthony Liguori [Mon, 26 Apr 2010 20:10:14 +0000 (15:10 -0500)]
Merge remote branch 'qmp/for-anthony' into staging
Paolo Bonzini [Fri, 16 Apr 2010 15:25:23 +0000 (17:25 +0200)]
stash away SCM_RIGHTS fd until a getfd command arrives
If there is already a fd in s->msgfd before recvmsg it is
closed by parts that this patch does not touch. So, only
one descriptor can be "leaked" by attaching it to a command
other than getfd.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Jan Kiszka [Tue, 6 Apr 2010 14:55:54 +0000 (16:55 +0200)]
chardev: Document mux option
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Jan Kiszka [Tue, 6 Apr 2010 14:55:53 +0000 (16:55 +0200)]
monitor: Reorder intialization to drop initial mux focus
So far a multiplexed monitor started disabled. Restore this property for
the new way of configuring by moving the monitor initialization before
all devices (the last one to attach to a char-mux will gain the focus).
Once we have a real use case for that, we may also consider assigning
the initial focus explicitly.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Jan Kiszka [Tue, 6 Apr 2010 14:55:52 +0000 (16:55 +0200)]
monitor: Cleanup ID assignment for compat switch
Canonicalize the ID assignment when creating monitor devices via the
legacy switch and use less easily colliding names.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Luiz Capitulino [Tue, 6 Apr 2010 21:55:54 +0000 (18:55 -0300)]
Monitor: Return before exiting with 'quit'
The 'quit' Monitor command (implemented by do_quit()) calls
exit() directly, this is problematic under QMP because QEMU
exits before having a chance to send the ok response.
Clients don't know if QEMU exited because of a problem or
because the 'quit' command has been executed.
This commit fixes that by moving the exit() call to the main
loop, so that do_quit() requests the system to quit, instead
of calling exit() directly.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Richard Henderson [Sat, 10 Apr 2010 20:22:28 +0000 (22:22 +0200)]
tcg-hppa: Remove automatically implemented opcodes.
Remove neg, ext8u, ext16u, as requested.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Fri, 9 Apr 2010 19:49:00 +0000 (21:49 +0200)]
tcg-hppa: Fix branch offset during retranslation.
Branch offsets should only be overwritten during relocation,
to support partial retranslation.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Fri, 9 Apr 2010 17:49:10 +0000 (10:49 -0700)]
tcg-hppa: Schedule the address masking after the TLB load.
Issue the tlb load as early as possible and perform the address
masking while the load is completing.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Fri, 9 Apr 2010 17:48:02 +0000 (10:48 -0700)]
tcg-hppa: Fix softmmu loads and stores.
Along the tlb hit path, we were modifying the variables holding the input
register numbers, which lead to incorrect expansion of the tlb miss path.
Fix this by extracting the tlb hit path to separate functions with their
own local variables. This also makes the difference between softmmu and
user-only easier to read.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Fri, 9 Apr 2010 17:46:40 +0000 (10:46 -0700)]
tcg-hppa: Fix GUEST_BASE initialization in prologue.
Load from the guest_base variable rather than embed a constant.
Always reserve TCG_GUEST_BASE_REG if guest base support enabled.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Fri, 9 Apr 2010 17:45:49 +0000 (10:45 -0700)]
tcg-hppa: Constrain immediate inputs to and_i32, or_i32, andc_i32.
Define "M" constraint for and_mask_p and "O" constraint for or_mask_p.
Assume that inputs are correct in tcg_out_ori and tcg_out_andi.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Richard Henderson [Mon, 26 Apr 2010 17:27:22 +0000 (10:27 -0700)]
linux-user: Fix sparc32plus stat64 syscalls.
Check TARGET_ABI_BITS, not TARGET_LONG_BITS, when deciding
whether or not the guest needs special 64-bit stat translation.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Mon, 26 Apr 2010 17:17:24 +0000 (10:17 -0700)]
target-sparc: Fix -singlestep.
Single-stepping was not properly updating npc, resulting in some
instructions being executed twice. In addition, we were emitting
dead code at the end of the TB.
Fix both by teaching gen_goto_tb to avoid goto_tb for single-step
and removing the special-case code in gen_intermediate_code_internal.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Luiz Capitulino [Tue, 6 Apr 2010 19:39:42 +0000 (16:39 -0300)]
QMP: Check "arguments" member's type
Otherwise the following input crashes QEMU:
{ "execute": "migrate", "arguments": "tcp:0:4446" }
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Luiz Capitulino [Wed, 7 Apr 2010 17:53:49 +0000 (14:53 -0300)]
QError: Improve QERR_QMP_BAD_INPUT_OBJECT desc
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Luiz Capitulino [Wed, 7 Apr 2010 17:49:37 +0000 (14:49 -0300)]
QMP: Use QERR_QMP_BAD_INPUT_OBJECT_MEMBER
The QERR_QMP_BAD_INPUT_OBJECT error is going to be used only
for two problems: the input is not an object or the "execute"
key is missing.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Luiz Capitulino [Wed, 7 Apr 2010 17:46:33 +0000 (14:46 -0300)]
QError: New QERR_QMP_BAD_INPUT_OBJECT_MEMBER
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Blue Swirl [Sun, 25 Apr 2010 20:42:43 +0000 (20:42 +0000)]
sh4: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 20:33:43 +0000 (20:33 +0000)]
ppc: add missing 'break', spotted by clang analyzer
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 20:32:49 +0000 (20:32 +0000)]
ppc: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 20:31:42 +0000 (20:31 +0000)]
alpha: add missing 'break', spotted by clang analyzer
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 20:30:17 +0000 (20:30 +0000)]
alpha: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 20:00:33 +0000 (20:00 +0000)]
microblaze: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 19:50:51 +0000 (19:50 +0000)]
m68k: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 19:46:46 +0000 (19:46 +0000)]
cris: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 19:31:06 +0000 (19:31 +0000)]
arm: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 18:58:25 +0000 (18:58 +0000)]
x86: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 18:35:52 +0000 (18:35 +0000)]
Remove dead assignments in various common files, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 18:23:04 +0000 (18:23 +0000)]
usb: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 18:20:28 +0000 (18:20 +0000)]
bt: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Sun, 25 Apr 2010 18:01:25 +0000 (11:01 -0700)]
linux-user: Fix Sparc64 syscall returns.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sun, 25 Apr 2010 15:27:14 +0000 (15:27 +0000)]
Fix dead initialization, spotted by clang analyzer
Fix clang warnings:
/src/qemu/block/vvfat.c:1102:9: warning: Value stored to 'index3' during its initialization is never read
int index3=index1+1;
/src/qemu/cmd.c:290:15: warning: Value stored to 'p' during its initialization is never read
char *p = result;
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Thu, 22 Apr 2010 23:47:31 +0000 (16:47 -0700)]
Remove IO_MEM_SUBWIDTH.
Greatly simplify the subpage implementation by not supporting
multiple devices at the same address at different widths. We
don't need full copies of mem_read/mem_write/opaque for each
address, only a single index back into the main io_mem_* arrays.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Fri, 23 Apr 2010 00:24:58 +0000 (17:24 -0700)]
linux-user: Remove ELFLOAD32.
The ABI-specific types used by linux_binprm and image_info
are different after forcing TARGET_ABI32 on. Which means
that the parameters that load_elf_binary_multi sees are not
those that loader_exec passed. This is inherently broken
and is more trouble than it's worth fixing.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Aurelien Jarno [Sun, 25 Apr 2010 03:46:22 +0000 (05:46 +0200)]
tcg/arm: fix condition in zero/sign extension functions
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Blue Swirl [Fri, 23 Apr 2010 20:19:47 +0000 (20:19 +0000)]
Fix OpenBSD build
GCC 3.3.5 generates warnings for static forward declarations of data, so
rearrange code to use static forward declarations of functions instead.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Fri, 23 Apr 2010 19:22:22 +0000 (19:22 +0000)]
m68k: fix if statement with empty body, spotted by clang
Fix clang error:
CC m68k-softmmu/helper.o
/src/qemu/target-m68k/helper.c:773:33: error: if statement has empty body [-Wempty-body]
else if (val & (1ull << 47));
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Fri, 23 Apr 2010 19:22:17 +0000 (19:22 +0000)]
m68k-dis: fix unused return value, spotted by clang
Fix clang errors like:
CC libdis/m68k-dis.o
/src/qemu/m68k-dis.c:1796:7: error: expression result unused [-Wunused-value]
FETCH_DATA (info, p);
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Fri, 23 Apr 2010 19:22:12 +0000 (19:22 +0000)]
Fix harmless if statement with empty body, spotted by clang
This clang error is harmless but worth fixing:
CC libhw32/rc4030.o
/src/qemu/hw/rc4030.c:244:66: error: if statement has empty body [-Wempty-body]
DPRINTF("read 0x%02x at " TARGET_FMT_plx "\n", val, addr);
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Anthony Liguori [Fri, 23 Apr 2010 18:48:33 +0000 (13:48 -0500)]
Merge remote branch 'origin/master' into staging
Richard Henderson [Fri, 23 Apr 2010 05:56:42 +0000 (22:56 -0700)]
target-sparc: Fix address masking in ldqf and stqf.
Use address_mask on both addr and addr+8 in both these routines,
rather than explicit masking with 0xffffffff.
Reformulate address_mask to return a result, rather than masking
a pass-by-reference argument.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Stefan Hajnoczi [Wed, 21 Apr 2010 19:35:45 +0000 (20:35 +0100)]
block: Free iovec arrays allocated by multiwrite_merge()
A new iovec array is allocated when creating a merged write request.
This patch ensures that the iovec array is deleted in addition to its
qiov owner.
Reported-by: Leszek Urbanski <tygrys@moo.pl>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Thu, 15 Apr 2010 13:11:35 +0000 (14:11 +0100)]
qcow2: Use QLIST_FOREACH_SAFE macro
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Wed, 14 Apr 2010 11:13:36 +0000 (12:13 +0100)]
linux-aio: Fix typo in read() EINTR check
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Tue, 13 Apr 2010 09:29:35 +0000 (10:29 +0100)]
qemu-img: Fix BRDV_O_FLAGS typo
It should be BDRV_O_FLAGS instead of BRDV_O_FLAGS.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Tue, 13 Apr 2010 09:29:34 +0000 (10:29 +0100)]
qemu-img: Eliminate bdrv_new_open() code duplication
Several commands have code to create a BlockDriverState and open a file.
The bdrv_new_open() function can be used to perform these steps. This
patch converts the qemu-img commands to actually use bdrv_new_open().
Replaced the bdrv_new_open() 'readonly' argument with bdrv_open()-style
flags to support generic flags like BDRV_O_NO_BACKING.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Tue, 13 Apr 2010 09:29:33 +0000 (10:29 +0100)]
block: Convert first_drv to QLIST
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Tue, 13 Apr 2010 10:41:35 +0000 (12:41 +0200)]
block.h: bdrv_create2 doesn't exist any more
The bdrv_create2 implementation has disappeared long ago. Remove its
prototype from the header file, too.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Bruce Rogers [Mon, 12 Apr 2010 12:56:00 +0000 (06:56 -0600)]
Remove un-needed code
The bdrv_set_geometry_hint call below is not needed - it's just setting
what was just read.
Signed-off-by: Bruce Rogers <brogers@novell.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Sat, 10 Apr 2010 06:02:42 +0000 (07:02 +0100)]
block: Convert bdrv_first to QTAILQ
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Fri, 9 Apr 2010 14:22:13 +0000 (15:22 +0100)]
block: Do not export bdrv_first
The bdrv_first linked list of BlockDriverStates is currently extern so
that block migration can iterate the list. However, since there is
already a bdrv_iterate() function there is no need to expose bdrv_first.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Christoph Hellwig [Tue, 6 Apr 2010 17:12:04 +0000 (19:12 +0200)]
cleanup block driver option handling in vl.c
Assign directly to the bdrv_flags variable instead of using
magic numbers before translating to the BDRV_O_* options.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Tue, 23 Mar 2010 16:41:24 +0000 (17:41 +0100)]
qcow2: Return 0/-errno in l2_allocate
Returning NULL on error doesn't allow distinguishing between different errors.
Change the interface to return an integer for -errno.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Tue, 23 Mar 2010 16:28:22 +0000 (17:28 +0100)]
qcow2: Return 0/-errno in write_l1_entry
Change write_l1_entry to return the real error code instead of -1.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Tue, 23 Mar 2010 11:53:47 +0000 (12:53 +0100)]
qcow2: Fix error return code in qcow2_alloc_cluster_link_l2
Fix qcow2_alloc_cluster_link_l2 to return the real error code like it does in
all other error cases.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Tue, 23 Mar 2010 11:49:17 +0000 (12:49 +0100)]
qcow2: Return 0/-errno in write_l2_entries
Change write_l2_entries to return the real error code instead of -1.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Christoph Hellwig [Tue, 6 Apr 2010 17:13:44 +0000 (19:13 +0200)]
block: split raw_getlength
Split up the raw_getlength into separate generic, solaris and BSD
versions to reduce the ifdef maze a bit. The BSD variant still
is a complete maze, but to clean it up properly we'd need some
people using the BSD variants to figure out what code is used
for what variant.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Christoph Hellwig [Mon, 5 Apr 2010 14:53:57 +0000 (16:53 +0200)]
block: get rid of the BDRV_O_FILE flag
BDRV_O_FILE is only used to communicate between bdrv_file_open and bdrv_open.
It affects two things: first bdrv_open only searches for protocols using
find_protocol instead of all image formats and host drivers. We can easily
move that to the caller and pass the found driver to bdrv_open. Second
it is used to not force a read-write open of a snapshot file. But we never
use bdrv_file_open to open snapshots and this behaviour doesn't make sense
to start with.
qemu-io abused the BDRV_O_FILE for it's growable option, switch it to
using bdrv_file_open to make sure we only open files as growable were
we can actually support that.
This patch requires Kevin's "[PATCH] Replace calls of old bdrv_open" to
be applied first.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Wed, 31 Mar 2010 12:40:27 +0000 (14:40 +0200)]
Replace calls of old bdrv_open
What is known today as bdrv_open2 becomes the new bdrv_open. All remaining
callers of the old function are converted to the new one. In some places they
even know the right format, so they should have used bdrv_open2 from the
beginning.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Fri, 26 Mar 2010 16:37:20 +0000 (17:37 +0100)]
qcow2: Fix creation of large images
qcow_create2 assumes that the new image will only need one cluster for its
refcount table initially. Obviously that's not true any more when the image is
big enough (exact value depends on the cluster size).
This patch calculates the refcount table size dynamically.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Mon, 15 Mar 2010 16:38:05 +0000 (17:38 +0100)]
qcow2: Trigger blkdebug events
This adds blkdebug events to qcow2 to allow injecting I/O errors in specific
places.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Mon, 15 Mar 2010 16:27:00 +0000 (17:27 +0100)]
blkdebug: Add events and rules
Block drivers can trigger a blkdebug event whenever they reach a place where it
could be useful to inject an error for testing/debugging purposes.
Rules are read from a blkdebug config file and describe which action is taken
when an event is triggered. For now this is only injecting an error (with a few
options) or changing the state (which is an integer). Rules can be declared to
be active only in a specific state; this way later rules can distiguish on
which path we came to trigger their event.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Mon, 15 Mar 2010 16:01:24 +0000 (17:01 +0100)]
Make qemu-config available for tools
To be able to use config files for blkdebug, we need to make these functions
available in the tools. This involves moving two functions that can only be
built in the context of the emulator.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>