OSDN Git Service

qmiga/qemu.git
14 years agoFix harmless if statement with empty body, spotted by clang
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>
14 years agoMerge remote branch 'origin/master' into staging
Anthony Liguori [Fri, 23 Apr 2010 18:48:33 +0000 (13:48 -0500)]
Merge remote branch 'origin/master' into staging

14 years agotarget-sparc: Fix address masking in ldqf and stqf.
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>
14 years agoblock: Free iovec arrays allocated by multiwrite_merge()
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>
14 years agoqcow2: Use QLIST_FOREACH_SAFE macro
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>
14 years agolinux-aio: Fix typo in read() EINTR check
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>
14 years agoqemu-img: Fix BRDV_O_FLAGS typo
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>
14 years agoqemu-img: Eliminate bdrv_new_open() code duplication
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>
14 years agoblock: Convert first_drv to QLIST
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>
14 years agoblock.h: bdrv_create2 doesn't exist any more
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>
14 years agoRemove un-needed code
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>
14 years agoblock: Convert bdrv_first to QTAILQ
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>
14 years agoblock: Do not export bdrv_first
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>
14 years agocleanup block driver option handling in vl.c
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>
14 years agoqcow2: Return 0/-errno in l2_allocate
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>
14 years agoqcow2: Return 0/-errno in write_l1_entry
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>
14 years agoqcow2: Fix error return code in qcow2_alloc_cluster_link_l2
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>
14 years agoqcow2: Return 0/-errno in write_l2_entries
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>
14 years agoblock: split raw_getlength
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>
14 years agoblock: get rid of the BDRV_O_FILE flag
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>
14 years agoReplace calls of old bdrv_open
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>
14 years agoqcow2: Fix creation of large images
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>
14 years agoqcow2: Trigger blkdebug events
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>
14 years agoblkdebug: Add events and rules
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>
14 years agoMake qemu-config available for tools
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>
14 years agoblkdebug: Inject errors
Kevin Wolf [Fri, 19 Feb 2010 15:24:35 +0000 (16:24 +0100)]
blkdebug: Inject errors

Add a mechanism to inject errors instead of passing requests on. With no
further patches applied, you can use it by setting inject_errno in gdb.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblkdebug: Basic request passthrough
Kevin Wolf [Thu, 18 Feb 2010 16:48:12 +0000 (17:48 +0100)]
blkdebug: Basic request passthrough

This isn't doing anything interesting. It creates the blkdebug block driver as
a protocol which just passes everything through to raw.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqemu-config: Make qemu_config_parse more generic
Kevin Wolf [Fri, 5 Mar 2010 17:21:56 +0000 (18:21 +0100)]
qemu-config: Make qemu_config_parse more generic

qemu_config_parse gets the option groups as a parameter now instead of
hardcoding the VM configuration groups. This way it can be used for other
configurations, too.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqemu-config: qemu_read_config_file() reads the normal config file
Kevin Wolf [Fri, 5 Mar 2010 16:25:55 +0000 (17:25 +0100)]
qemu-config: qemu_read_config_file() reads the normal config file

Introduce a new function qemu_read_config_file which reads the VM configuration
from a config file. Unlike qemu_config_parse it doesn't take a open file but a
filename and reduces code duplication as a side effect.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoaudio/sdlaudio: remove unused variable
Serge Ziryukin [Thu, 22 Apr 2010 11:14:24 +0000 (14:14 +0300)]
audio/sdlaudio: remove unused variable

Remove unused 'shift' variable spotted by clang.
Also clean up aud_to_sdlfmt which used to get the value
of shift.

Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
14 years agobt-sdp: Fix an excessive ; and assignment of the wrong variable
Andrzej Zaborowski [Thu, 22 Apr 2010 01:55:46 +0000 (03:55 +0200)]
bt-sdp: Fix an excessive ; and assignment of the wrong variable

Problem-spotted-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andrew Zaborowski <balrogg@gmail.com>
14 years agobt-l2cap: fix if statement with empty body, spotted by clang
Blue Swirl [Thu, 22 Apr 2010 01:41:24 +0000 (03:41 +0200)]
bt-l2cap: fix if statement with empty body, spotted by clang

Fix clang error:
  CC    bt-l2cap.o
/src/qemu/hw/bt-l2cap.c:1000:41: error: if statement has empty body
[-Wempty-body]
            /* TODO: Signal an error? */;

This means that l2cap_sframe_in() may now get called.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andrew Zaborowski <balrogg@gmail.com>
14 years agoaudio/alsa: Avoid snd_pcm_format_t vs audfmt_e mixup
malc [Wed, 21 Apr 2010 11:40:23 +0000 (15:40 +0400)]
audio/alsa: Avoid snd_pcm_format_t vs audfmt_e mixup

Spotted by Serge Ziryukin and based on his patch, thanks.

Signed-off-by: malc <av1474@comtv.ru>
14 years agopci: fix pci_find_bus().
Isaku Yamahata [Mon, 12 Apr 2010 02:58:59 +0000 (11:58 +0900)]
pci: fix pci_find_bus().

When looking down child bus, it should look parent bridge's
bus number, not child bus's.
Optimized tail recursion and style fix.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoslirp: fix structure initialization in tcp_listen()
Juha Riihimäki [Tue, 13 Apr 2010 06:16:55 +0000 (09:16 +0300)]
slirp: fix structure initialization in tcp_listen()

A data structure of type sockaddr_in is allocated from stack but not
properly initialized. This may lead to a failure in the bind() call
later on. Fixed by filling the contents of the structure with zeroes
before using it.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile event_notifier only once
Blue Swirl [Mon, 19 Apr 2010 19:47:49 +0000 (19:47 +0000)]
Compile event_notifier only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile vl.c once
Blue Swirl [Mon, 19 Apr 2010 19:46:13 +0000 (19:46 +0000)]
Compile vl.c once

Since kvm.h can be used in files compiled once,
we can partially revert
b33612d03540fda7fa67485f1c20395beb7a2bf0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoprovide a stub version of kvm-all.c if !CONFIG_KVM
Paolo Bonzini [Mon, 19 Apr 2010 18:59:30 +0000 (18:59 +0000)]
provide a stub version of kvm-all.c if !CONFIG_KVM

This allows limited use of kvm functions (which will return ENOSYS)
even in once-compiled modules.  The patch also improves a bit the error
messages for KVM initialization.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[blauwirbel@gmail.com: fixed Win32 build]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg/arm: don't try to load constants using pc
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: don't try to load constants using pc

There is statistically almost 0 chances to use this code, so
remove it.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: optimize register allocation order
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: optimize register allocation order

The beginning of the register allocation order list on the TCG arm
target matches the list of clobbered registers. This means that when an
helper is called, there is almost always clobbered registers that have
to be spilled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: fix argument alignment in qemu_st64
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: fix argument alignment in qemu_st64

64-bit arguments should be aligned on an even register as specified
by the "Procedure Call Standard for the ARM Architecture".

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: remove useless register tests in qemu_ld/st
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: remove useless register tests in qemu_ld/st

addr_reg, data_reg and data_reg2 can't be register r0 or r1 du to the
constraints. Don't check if they equals these registers.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: bswap arguments in qemu_ld/st if needed
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: bswap arguments in qemu_ld/st if needed

On big endian targets, data arguments of qemu_ld/st ops have to be
byte swapped. Two temporary registers are needed for qemu_st to do
the bswap. r0 and r1 are used in system mode, do the same in user
mode, which implies reworking the constraints.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: use ext* ops in qemu_ld
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: use ext* ops in qemu_ld

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: remove conditional argument for qemu_ld/st
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: remove conditional argument for qemu_ld/st

While it make sense to pass a conditional argument to tcg_out_*()
functions as the ARM architecture allows that, it doesn't make sense
for qemu_ld/st functions. These functions use comparison instructions
and conditional execution already, so it is not possible to use a
second level of conditional execution.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: add bswap ops
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: add bswap ops

Add an bswap16 and bswap32 ops, either using the rev and rev16
instructions on ARMv6+ or shifts and logical operations on previous
ARM versions. In both cases the result use less instructions than
the pure TCG version.

These ops are also needed by the qemu_ld/st functions.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: add ext16u op
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: add ext16u op

Add an ext16u op, either using the uxth instruction on ARMv6+ or two
shifts on previous ARM versions. In both cases the result use the same
number or less instructions than the pure TCG version.

Also move all sign extension code to separate functions, so that they
can be reused in other parts of the code.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: add rotation ops
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: add rotation ops

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: use the blx instruction when possible
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: use the blx instruction when possible

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: sxtb and sxth are available starting with ARMv6
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: sxtb and sxth are available starting with ARMv6

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: add variables to define the allowed instructions set
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: add variables to define the allowed instructions set

Use a set of variables to define the allowed ARM instructions, depending
on the __ARM_ARCH_*__ GCC defines.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: align 64-bit arguments in function calls
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: align 64-bit arguments in function calls

As specified by the "Procedure Call Standard for the ARM Architecture".

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: replace integer values by registers enum
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: replace integer values by registers enum

The TCG ARM backends uses integer values to refer to both immediate
values and register number. This makes the code difficult to read.

The patch below replaces all (if I haven't miss any ;-) integer values
representing register number by TCG_REG_* enum values.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: remove store signed functions
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: remove store signed functions

Store signed functions doesn't make sense, and are not used. Remove
them.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: explicitely list clobbered/reserved regs
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: explicitely list clobbered/reserved regs

Instead of writing very compact code, declare all registers that are
clobbered or reserved one by one. This makes the code easier to read.

Also declare all the 16 registers to TCG, and mark pc as reserved.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: remove SAVE_LR code
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: remove SAVE_LR code

There is no need to save the LR register (r14) before a call to a
subroutine. According to the "Procedure Call Standard for the ARM
Architecture", it is the job of the callee to save this register.
Moreover, this register is already saved in the prologue/epilogue.

This patch removes the disabled SAVE_LR code, as there is no need to
reenable later.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoCheck for invalid initrd file
M. Mohan Kumar [Mon, 12 Apr 2010 04:31:33 +0000 (10:01 +0530)]
Check for invalid initrd file

When qemu is invoked with an invalid initrd file, it crashes. Following
patch prints a error message and exits if an invalid initrd is
specified. Includes changes suggested by JV.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoMonitor: Convert do_screen_dump() to QObject
Luiz Capitulino [Wed, 31 Mar 2010 18:21:49 +0000 (15:21 -0300)]
Monitor: Convert do_screen_dump() to QObject

Trivial, as it never fails, doesn't have output nor return
any data.

Note that it's also available under QMP, as kvm-autotest
needs this.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoQMP: Improve RTC_CHANGE event description
Luiz Capitulino [Wed, 24 Mar 2010 20:24:37 +0000 (17:24 -0300)]
QMP: Improve RTC_CHANGE event description

Some people might think that this event is emitted whenever the
time changes, be more specific.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agovirtio-blk: Fix use after free in error case
Kevin Wolf [Wed, 31 Mar 2010 15:46:59 +0000 (17:46 +0200)]
virtio-blk: Fix use after free in error case

virtio_blk_req_complete frees the request, so we can't access it any more when
calling bdrv_mon_event. Use the pointer that was copied earlier.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Convert do_set_link() to QObject, QError
Markus Armbruster [Fri, 26 Mar 2010 08:07:11 +0000 (09:07 +0100)]
monitor: Convert do_set_link() to QObject, QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Use argument type 'b' for set_link
Markus Armbruster [Fri, 26 Mar 2010 08:07:10 +0000 (09:07 +0100)]
monitor: Use argument type 'b' for set_link

Second argument is now "on" or "off" instead of "up" or "down".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: New argument type 'b'
Markus Armbruster [Fri, 26 Mar 2010 08:07:09 +0000 (09:07 +0100)]
monitor: New argument type 'b'

This is a boolean value.  Human monitor accepts "on" or "off".
Consistent with option parsing (see parse_option_bool()).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Rename argument type 'b' to 'f'
Markus Armbruster [Fri, 26 Mar 2010 08:07:08 +0000 (09:07 +0100)]
monitor: Rename argument type 'b' to 'f'

To make 'b' available for boolean argument.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: New commands netdev_add, netdev_del
Markus Armbruster [Thu, 25 Mar 2010 16:22:40 +0000 (17:22 +0100)]
monitor: New commands netdev_add, netdev_del

Monitor commands to go with -netdev.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: New QERR_DEVICE_IN_USE
Markus Armbruster [Thu, 25 Mar 2010 16:22:39 +0000 (17:22 +0100)]
error: New QERR_DEVICE_IN_USE

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert net_client_init() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:38 +0000 (17:22 +0100)]
error: Convert net_client_init() to QError

The conversion is shallow: client type init() methods aren't
converted.  Converting them is a big job for relatively little
practical benefit, so leave it for later.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert qemu_opts_validate() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:37 +0000 (17:22 +0100)]
error: Convert qemu_opts_validate() to QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Use QERR_INVALID_PARAMETER_VALUE instead of QERR_INVALID_PARAMETER
Markus Armbruster [Thu, 25 Mar 2010 16:22:36 +0000 (17:22 +0100)]
error: Use QERR_INVALID_PARAMETER_VALUE instead of QERR_INVALID_PARAMETER

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Drop extra messages after qemu_opts_set() and qemu_opts_parse()
Markus Armbruster [Thu, 25 Mar 2010 16:22:35 +0000 (17:22 +0100)]
error: Drop extra messages after qemu_opts_set() and qemu_opts_parse()

Both functions report errors nicely enough now, no need for additional
messages.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert qemu_opts_set() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:34 +0000 (17:22 +0100)]
error: Convert qemu_opts_set() to QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: New QERR_INVALID_PARAMETER_VALUE
Markus Armbruster [Thu, 25 Mar 2010 16:22:33 +0000 (17:22 +0100)]
error: New QERR_INVALID_PARAMETER_VALUE

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert qemu_opts_create() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:32 +0000 (17:22 +0100)]
error: Convert qemu_opts_create() to QError

Fixes device_add to report duplicate ID properly in QMP, as
DuplicateId instead of UndefinedError.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: New QERR_DUPLICATE_ID
Markus Armbruster [Thu, 25 Mar 2010 16:22:31 +0000 (17:22 +0100)]
error: New QERR_DUPLICATE_ID

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Put error definitions back in alphabetical order
Markus Armbruster [Thu, 25 Mar 2010 16:22:30 +0000 (17:22 +0100)]
error: Put error definitions back in alphabetical order

Add suitable comments to help keerp them in order.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: convert do_device_del() to QObject, QError
Markus Armbruster [Mon, 22 Mar 2010 10:38:14 +0000 (11:38 +0100)]
monitor: convert do_device_del() to QObject, QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoqdev: Convert qdev_unplug() to QError
Markus Armbruster [Mon, 22 Mar 2010 10:38:13 +0000 (11:38 +0100)]
qdev: Convert qdev_unplug() to QError

Note: our device unplug methods don't need conversion work, because
they can't currently fail.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoAdd qerror message if the 'change' target filename can't be opened
Ryan Harper [Thu, 25 Mar 2010 14:32:58 +0000 (09:32 -0500)]
Add qerror message if the 'change' target filename can't be opened

Currently when using the change command to switch the file in the cd drive
the command doesn't complain if the file doesn't exit or can't be opened
and the drive keeps the existing image.  This patch adds a qerror_report
call to print a message out indicating the failure.  This error message
can be used to catch failures.

Current behavior:

QEMU 0.12.50 monitor - type 'help' for more information
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /home/rharper/work/isos/Fedora-9-i386-DVD.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0
file=/home/rharper/work/isos/Fedora-9-i386-DVD.iso ro=0 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /tmp/non_existent_file.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu)

With patch:
QEMU 0.12.50 monitor - type 'help' for more information
(qemu) change ide1-cd0 /tmp/non_existent_file.iso
Could not open '/tmp/non_existent_file.iso'
(qemu)

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoslirp: fix unused return value, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:27:46 +0000 (14:27 +0000)]
slirp: fix unused return value, spotted by clang

Fix clang errors like:
  CC    slirp/cksum.o
/src/qemu/slirp/cksum.c:78:3: error: expression result unused [-Wunused-value]
                REDUCE;
/src/qemu/slirp/cksum.c:45:66: note: instantiated from:

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoi386-dis: Fix unused return value, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:27:44 +0000 (14:27 +0000)]
i386-dis: Fix unused return value, spotted by clang

Fix clang erros like:
  CC    libdis/i386-dis.o
/src/qemu/i386-dis.c:3323:7: error: expression result unused [-Wunused-value]
      FETCH_DATA (the_info, codep + 1);
/src/qemu/i386-dis.c:285:6: note: instantiated from:
   ? 1 : fetch_data ((info), (addr)))

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoPPC: avoid function pointer type mismatch, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:26:51 +0000 (14:26 +0000)]
PPC: avoid function pointer type mismatch, spotted by clang

Fixes clang errors:
  CC    ppc-softmmu/translate.o
/src/qemu/target-ppc/translate.c:3748:13: error: comparison of distinct pointer types ('void (*)(void *, int, int)' and 'void *')
        if (likely(read_cb != SPR_NOACCESS)) {
/src/qemu/target-ppc/translate.c:3748:28: note: instantiated from:
        if (likely(read_cb != SPR_NOACCESS)) {
/src/qemu/target-ppc/translate.c:3903:13: error: comparison of distinct pointer types ('void (*)(void *, int, int)' and 'void *')
        if (likely(write_cb != SPR_NOACCESS)) {
/src/qemu/target-ppc/translate.c:3903:29: note: instantiated from:
        if (likely(write_cb != SPR_NOACCESS)) {

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agokvm: avoid collision with dprintf macro in stdio.h, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:22:14 +0000 (14:22 +0000)]
kvm: avoid collision with dprintf macro in stdio.h, spotted by clang

Fixes clang errors:
  CC    i386-softmmu/kvm.o
/src/qemu/target-i386/kvm.c:40:9: error: 'dprintf' macro redefined
In file included from /src/qemu/target-i386/kvm.c:21:
In file included from /src/qemu/qemu-common.h:27:
In file included from /usr/include/stdio.h:910:
/usr/include/bits/stdio2.h:189:12: note: previous definition is here
  CC    i386-softmmu/kvm-all.o
/src/qemu/kvm-all.c:39:9: error: 'dprintf' macro redefined
In file included from /src/qemu/kvm-all.c:23:
In file included from /src/qemu/qemu-common.h:27:
In file included from /usr/include/stdio.h:910:
/usr/include/bits/stdio2.h:189:12: note: previous definition is here

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix harmless if statements with empty body, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:22:14 +0000 (14:22 +0000)]
Fix harmless if statements with empty body, spotted by clang

These clang errors are harmless but worth fixing:
  CC    ppc-softmmu/usb-ohci.o
/src/qemu/hw/usb-ohci.c:1104:59: error: if statement has empty body [-Wempty-body]
                          ohci->ctrl_head, ohci->ctrl_cur);
/src/qemu/hw/usb-ohci.c:1371:57: error: if statement has empty body [-Wempty-body]
        DPRINTF("usb-ohci: port %d: SUSPEND\n", portnum);
  CC    sparc64-softmmu/translate.o
/src/qemu/target-sparc/translate.c:3173:37: error: if statement has empty body [-Wempty-body]
                                    ; // XXX

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc32 use empty_slot for missing RAM v1
Artyom Tarasenko [Sat, 17 Apr 2010 22:34:03 +0000 (00:34 +0200)]
sparc32 use empty_slot for missing RAM v1

use empty_slot device for the RAM which is not installed

Models without ECC don't trap when missing ram is accessed.

v0->v1 compile only once and fix indentation

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agocreate empty_slot device
Artyom Tarasenko [Fri, 16 Apr 2010 23:10:04 +0000 (01:10 +0200)]
create empty_slot device

The empty_slot device emulates known to a bus but not connected devices.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix harmless if statements with empty body, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 08:45:03 +0000 (08:45 +0000)]
Fix harmless if statements with empty body, spotted by clang

These clang errors are harmless but worth fixing:
  CC    libhw64/fdc.o
/src/qemu/hw/fdc.c:998:74: error: if statement has empty body [-Wempty-body]
        FLOPPY_DPRINTF("Floppy digital input register: 0x%02x\n", retval);
  CC    libhw64/cuda.o
/src/qemu/hw/cuda.c:320:66: error: if statement has empty body [-Wempty-body]
        CUDA_DPRINTF("read: reg=0x%x val=%02x\n", (int)addr, val);

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg/ppc: Remove redundant comparison from brcond2
malc [Sun, 18 Apr 2010 04:46:29 +0000 (08:46 +0400)]
tcg/ppc: Remove redundant comparison from brcond2

Signed-off-by: malc <av1474@comtv.ru>
14 years agoFix --enable-profiler compilation.
Richard Henderson [Sat, 17 Apr 2010 16:25:10 +0000 (16:25 +0000)]
Fix --enable-profiler compilation.

There's a header file inclusion ordering problem between cpu-all.h
and qemu-timer.h, such that cpu_get_real_ticks is not defined when
we attempt to use it in profile_getclock.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotarget-sparc: Free instruction temporaries.
Richard Henderson [Sat, 17 Apr 2010 16:25:08 +0000 (16:25 +0000)]
target-sparc: Free instruction temporaries.

Rather than creating new temporaries for constants, use the
ones created in disas_sparc_insn.  Remember the temps created
there so that they can be freed at the end of the function.

Profile data collected by TCG while booting sparc-test kernel:

-avg temps/TB    70.61 max=421
+avg temps/TB    62.75 max=66

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotarget-sparc: Fix TARGET_{PHYS,VIRT}_ADDR_SPACE_BITS.
Richard Henderson [Sat, 17 Apr 2010 16:25:06 +0000 (16:25 +0000)]
target-sparc: Fix TARGET_{PHYS,VIRT}_ADDR_SPACE_BITS.

The 32 and 64-bit definitions were swapped in the ifdef.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSparc: fix PC/NPC during FPU traps
Blue Swirl [Sat, 17 Apr 2010 16:25:04 +0000 (16:25 +0000)]
Sparc: fix PC/NPC during FPU traps

All FPU instructions can trap, so save PC/NPC state before
executing them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: Add missing static qualifier
malc [Sat, 17 Apr 2010 03:59:26 +0000 (07:59 +0400)]
tcg: Add missing static qualifier

Build breaks otherwise when USE_LIVENESS_ANALYSIS is not defined.

Signed-off-by: malc <av1474@comtv.ru>
14 years agotcg/ppc: Fix signed versions of brcond2
malc [Sat, 17 Apr 2010 03:58:08 +0000 (07:58 +0400)]
tcg/ppc: Fix signed versions of brcond2

Thanks to: Alexander Graff, Thomas Gleixner and Andreas Faerber.

Signed-off-by: malc <av1474@comtv.ru>
14 years agoFix format strings
Arnaud Lacombe [Wed, 14 Apr 2010 01:25:25 +0000 (21:25 -0400)]
Fix format strings

This fix the following build failure:

  CC    libdis-user/microblaze-dis.o
cc1: warnings being treated as errors
microblaze-dis.c: In function 'print_insn_microblaze':
microblaze-dis.c:829: warning: format '%04x' expects type 'unsigned int',
but argument 4 has type 'long unsigned int'
microblaze-dis.c:962: warning: format '%04x' expects type 'unsigned int',
but argument 4 has type 'long unsigned int'

Reported-at: http://www.monstr.eu/wiki/doku.php?id=log:2010-04-13_12_10_00

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Wed, 14 Apr 2010 01:59:12 +0000 (20:59 -0500)]
Merge remote branch 'mst/for_anthony' into staging

14 years agosparc: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:53 +0000 (22:49 +0200)]
sparc: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosh4: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:52 +0000 (22:49 +0200)]
sh4: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agom68k: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:51 +0000 (22:49 +0200)]
m68k: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.
It also removes a type cast which is not needed.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoarm: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:50 +0000 (22:49 +0200)]
arm: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcp/mips: Change TCG_AREG0 (fp -> s0)
Stefan Weil [Fri, 9 Apr 2010 15:28:40 +0000 (17:28 +0200)]
tcp/mips: Change TCG_AREG0 (fp -> s0)

Register fp (frame pointer) is a bad choice for compilations
without optimisation, because the compiler makes heavy use
of this register (so the resulting code crashes).

Register s0 had been used for TCG_AREG1 in earlier releases,
but was no longer used and is now free for TCG_AREG0.

The resulting code works for compilations without
optimisation (tested with qemu mips in qemu mips
on x86 host).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>