]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
12 years agoDrop qemu-objects.h from modules that don't require it
Luiz Capitulino [Fri, 21 Oct 2011 18:05:43 +0000 (16:05 -0200)]
Drop qemu-objects.h from modules that don't require it

Previous commits dropped most qobjects usage from qemu modules
(now they are a low level interface used by the QAPI). However,
some modules still include the qemu-objects.h header file.

This commit drops qemu-objects.h from some of those modules
and includes qjson.h instead, which is what they actually need.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoMonitor: do_info(): Drop QMP command handling code
Luiz Capitulino [Fri, 21 Oct 2011 18:24:28 +0000 (16:24 -0200)]
Monitor: do_info(): Drop QMP command handling code

Previous commits converted all existing QMP commands to the QAPI,
now each info command does its own QMP call.

Let's then drop all QMP command handling code from do_info().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoQMP: Drop the query commands dispatch table
Luiz Capitulino [Fri, 21 Oct 2011 18:15:31 +0000 (16:15 -0200)]
QMP: Drop the query commands dispatch table

Because QMP development originated in the monitor, it has
inherited the monitor's distinction between query- and
non-query commands.

However, previous commits unified both commands and the
distinction is gone. This commit drops the query commands
dispatch table and does some simplifications along the way.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-pci
Luiz Capitulino [Fri, 21 Oct 2011 16:15:33 +0000 (14:15 -0200)]
qapi: Convert query-pci

This also fixes a bug with the old version: QMP would invert device id
and vendor id. This would look ok on HMP because it was printing
"device:vendor" instead of "vendor:device".

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-balloon
Luiz Capitulino [Fri, 21 Oct 2011 13:41:37 +0000 (11:41 -0200)]
qapi: Convert query-balloon

Please, note that some of the code supporting memory statistics is
still around (eg. virtio_balloon_receive_stats() and reset_stats()).

Also, the qmp_query_balloon() function is synchronous and thus doesn't
make any use of the (not fully working) monitor's asynchronous command
support (the old non-qapi implementation did).

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-spice
Luiz Capitulino [Thu, 20 Oct 2011 19:01:33 +0000 (17:01 -0200)]
qapi: Convert query-spice

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-vnc
Luiz Capitulino [Mon, 17 Oct 2011 18:41:22 +0000 (16:41 -0200)]
qapi: Convert query-vnc

There are three important remarks in relation to the non-qapi command:

 1. This commit also fixes the behavior of the 'query-vnc' and 'info vnc'
    commands to return an error when qemu is built without VNC support
    (ie. --disable-vnc). The non-qapi command would return the OK
    response in QMP and no response in HMP

 2. The qapi version explicitly marks the fields 'host', 'family',
    'service' and 'auth' as optional. Their are not documented as optional
    in the non-qapi command doc, but they would not be returned if
    vnc support is disabled. The qapi version maintains the same
    semantics, but documents those fields correctly

 3. The 'clients' field, which is a list, is marked as optional but is
    always returned. If there are no clients connected an empty list
    is returned. This is not the Right Way to this in the qapi but it's
    how the non-qapi command used to work

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqerror: Add a user string for QERR_FEATURE_DISABLED
Luiz Capitulino [Wed, 19 Oct 2011 17:15:57 +0000 (15:15 -0200)]
qerror: Add a user string for QERR_FEATURE_DISABLED

Missing from commit 821601ea5b.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-blockstats
Luiz Capitulino [Thu, 22 Sep 2011 18:56:36 +0000 (15:56 -0300)]
qapi: Convert query-blockstats

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-block
Luiz Capitulino [Wed, 21 Sep 2011 20:16:47 +0000 (17:16 -0300)]
qapi: Convert query-block

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: Rename the BlockIOStatus enum values
Luiz Capitulino [Fri, 14 Oct 2011 20:22:24 +0000 (17:22 -0300)]
block: Rename the BlockIOStatus enum values

The biggest change is to rename its prefix from BDRV_IOS to
BLOCK_DEVICE_IO_STATUS.

Next commit will convert the query-block command to the QAPI
and that's how the enumeration is going to be generated.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: iostatus: Drop BDRV_IOS_INVAL
Luiz Capitulino [Fri, 14 Oct 2011 20:11:23 +0000 (17:11 -0300)]
block: iostatus: Drop BDRV_IOS_INVAL

A future commit will convert bdrv_info() to the QAPI and it won't
provide IOS_INVAL.

Luckily all we have to do is to add a new 'iostatus_enabled'
member to BlockDriverState and use it instead.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-cpus
Luiz Capitulino [Wed, 21 Sep 2011 19:38:35 +0000 (16:38 -0300)]
qapi: Convert query-cpus

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert the cpu command
Luiz Capitulino [Thu, 6 Oct 2011 17:31:39 +0000 (14:31 -0300)]
qapi: Convert the cpu command

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoMonitor: Introduce monitor_get_cpu_index()
Luiz Capitulino [Mon, 24 Oct 2011 12:53:44 +0000 (10:53 -0200)]
Monitor: Introduce monitor_get_cpu_index()

Returns 'cur_mons's CPU index. A future commit will use it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoMonitor: Make mon_set_cpu() public
Luiz Capitulino [Thu, 6 Oct 2011 17:02:57 +0000 (14:02 -0300)]
Monitor: Make mon_set_cpu() public

Also rename it to monitor_set_cpu().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-migrate
Luiz Capitulino [Tue, 13 Sep 2011 20:37:16 +0000 (17:37 -0300)]
qapi: Convert query-migrate

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Convert query-mice
Luiz Capitulino [Wed, 21 Sep 2011 18:29:55 +0000 (15:29 -0300)]
qapi: Convert query-mice

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi-commands.py: Don't call the output marshal on error
Luiz Capitulino [Wed, 19 Oct 2011 16:51:14 +0000 (14:51 -0200)]
qapi-commands.py: Don't call the output marshal on error

Today we generate something like this:

    int qmp_marshal_input_query_foo(...)

        ...

        retval = qmp_query_foo(errp);
        qmp_marshal_output_query_foo(retval, ret, errp);

        ...

However, if qmp_query_foo() fails 'retval' will probably be NULL,
which can cause a segfault as not all visitors check if 'retval'
is valid.

This commit fixes that by changing the code generator to only
call the output marshal if qmp_query_foo() succeeds, like this:

    retval = qmp_query_foo(errp);
    if (!error_is_set(errp)) {
        qmp_marshal_output_query_foo(retval, ret, errp);
    }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoMerge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Andrzej Zaborowski [Wed, 26 Oct 2011 23:02:46 +0000 (01:02 +0200)]
Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

12 years agoSparc: split load and store op helpers
Blue Swirl [Mon, 1 Aug 2011 10:15:51 +0000 (10:15 +0000)]
Sparc: split load and store op helpers

Move load and store op helpers top ldst_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: convert win_helper to trace framework
Blue Swirl [Sun, 11 Sep 2011 15:53:35 +0000 (15:53 +0000)]
Sparc: convert win_helper to trace framework

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: convert interrupt helpers to trace framework
Blue Swirl [Sun, 11 Sep 2011 15:05:41 +0000 (15:05 +0000)]
Sparc: convert interrupt helpers to trace framework

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: convert mmu_helper to trace framework
Blue Swirl [Sun, 11 Sep 2011 14:51:24 +0000 (14:51 +0000)]
Sparc: convert mmu_helper to trace framework

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split MMU helpers
Blue Swirl [Sun, 11 Sep 2011 11:30:01 +0000 (11:30 +0000)]
Sparc: split MMU helpers

Move MMU helpers to mmu_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: fix coding style in helper.c
Blue Swirl [Sun, 11 Sep 2011 12:03:08 +0000 (12:03 +0000)]
Sparc: fix coding style in helper.c

Before the next patch, fix coding style of the areas affected.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for division op helpers
Blue Swirl [Mon, 4 Jul 2011 18:15:42 +0000 (18:15 +0000)]
Sparc: avoid AREG0 for division op helpers

Make [su]div{,cc} helpers take a parameter for CPUState instead
of relying on global env. Move the functions to helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for softint op helpers and Leon cache control
Blue Swirl [Mon, 1 Aug 2011 09:20:58 +0000 (09:20 +0000)]
Sparc: avoid AREG0 for softint op helpers and Leon cache control

Make softint op helpers and Leon cache irq manager take a parameter
for CPUState instead of relying on global env. Move the functions
to int{32,64}_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for CWP and PSTATE helpers
Blue Swirl [Sun, 3 Jul 2011 21:01:59 +0000 (21:01 +0000)]
Sparc: avoid AREG0 for CWP and PSTATE helpers

Make CWP and PSTATE helpers take a parameter for CPUState instead
of relying on global env. Remove wrapper functions.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Wed, 26 Oct 2011 15:29:24 +0000 (10:29 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

12 years agomain-loop: Add missing include file
Stefan Weil [Tue, 25 Oct 2011 20:23:17 +0000 (22:23 +0200)]
main-loop: Add missing include file

stdint.h defines the POSIX data types and is needed
for MinGW-w64 (and maybe other hosts).

v2: Instead of adding stdint.h directly, qemu-common.h is now
included and duplicate include statements were removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-sparc: Fix use of g_new0 / g_free
Stefan Weil [Tue, 25 Oct 2011 05:16:25 +0000 (07:16 +0200)]
target-sparc: Fix use of g_new0 / g_free

g_malloc0 needs g_free instead of free.
While fixing this, I also replaced g_malloc0 by g_new0
as was suggested by Stuart Brady.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Fix order of function parameters
Stefan Weil [Mon, 24 Oct 2011 20:29:48 +0000 (22:29 +0200)]
target-sparc: Fix order of function parameters

The MinGW-w64 gcc complains about wrong parameters for
gen_helper_fpadd16_s and three other functions.

gen_helper_fpadd16_s is declared like this (hidden in lots of macros):

static inline void
 gen_helper_fpadd16s(TCGv_i32 retval, TCGv_ptr arg1,
                     TCGv_i32 arg2, TCGv_i32 arg3);

So it looks like cpu_env should be the 2nd parameter.

Please review this patch as I have no environment to test it
(maybe the 1st parameter should be cpu_dst?).

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohda: do not mix output and input stream states, RHBZ #740493
Marc-André Lureau [Tue, 25 Oct 2011 14:53:01 +0000 (16:53 +0200)]
hda: do not mix output and input stream states, RHBZ #740493

Windows 7 may use the same stream number for input and output.
Current code will confuse streams.

Changes since v1:
- keep running_compat[] for migration version 1
- add running_real[] for migration version 2

Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agohda: do not mix output and input streams, RHBZ #740493
Marc-André Lureau [Tue, 25 Oct 2011 14:53:00 +0000 (16:53 +0200)]
hda: do not mix output and input streams, RHBZ #740493

Windows 7 may use the same stream number for input and output.
That will result in lot of garbage on playback.

The hardcoded value of 4 needs to be in sync with GCAP streams
description and IN/OUT registers.

Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoMerge remote-tracking branch 'bonzini/split-main-loop-for-anthony' into staging
Anthony Liguori [Mon, 24 Oct 2011 15:51:12 +0000 (10:51 -0500)]
Merge remote-tracking branch 'bonzini/split-main-loop-for-anthony' into staging

12 years agoAdd stdio char device on windows
Fabien Chouteau [Thu, 6 Oct 2011 14:37:51 +0000 (16:37 +0200)]
Add stdio char device on windows

Simple implementation of an stdio char device on Windows.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split CWP and PSTATE op helpers
Blue Swirl [Mon, 1 Aug 2011 09:03:20 +0000 (09:03 +0000)]
Sparc: split CWP and PSTATE op helpers

Move CWP and PSTATE op helpers to win_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for lazy condition code helpers
Blue Swirl [Sun, 3 Jul 2011 16:01:57 +0000 (16:01 +0000)]
Sparc: avoid AREG0 for lazy condition code helpers

Make lazy condition code helpers take a parameter for CPUState instead
of relying on global env.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split lazy condition code handling op helpers
Blue Swirl [Mon, 1 Aug 2011 08:37:36 +0000 (08:37 +0000)]
Sparc: split lazy condition code handling op helpers

Move lazy condition code handling op helpers to cc_helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for float and VIS ops
Blue Swirl [Sun, 3 Jul 2011 10:42:23 +0000 (10:42 +0000)]
Sparc: avoid AREG0 for float and VIS ops

Make floating point and VIS ops take a parameter for CPUState instead
of relying on global env.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split FPU and VIS op helpers
Blue Swirl [Mon, 1 Aug 2011 07:37:45 +0000 (07:37 +0000)]
Sparc: split FPU and VIS op helpers

Move FPU op helpers to fop_helper.c. Move VIS op helpers to vis_helper.c,
compile it only for Sparc64.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: fix coding style
Blue Swirl [Sun, 3 Jul 2011 15:22:03 +0000 (15:22 +0000)]
Sparc: fix coding style

Before the next patches, fix coding style of the areas affected.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: avoid AREG0 for raise_exception and helper_debug
Blue Swirl [Sun, 3 Jul 2011 08:19:42 +0000 (08:19 +0000)]
Sparc: avoid AREG0 for raise_exception and helper_debug

Make raise_exception() and helper_debug() take a parameter for
CPUState instead of relying on global env. Move the functions
to helper.c.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: move trivial functions from op_helper.c
Blue Swirl [Sun, 3 Jul 2011 07:05:50 +0000 (07:05 +0000)]
Sparc: move trivial functions from op_helper.c

These functions don't need access to CPUState or already pass it,
so relocating them from op_helper.c to helper.c and int64_helper.c
is trivial.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: split helper.c
Blue Swirl [Sun, 11 Sep 2011 09:33:40 +0000 (09:33 +0000)]
Sparc: split helper.c

Move CPU init to cpu_init.c and interrupt handling to int32_helper.c
for Sparc32 and int64_helper.c for Sparc64.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: fix coding style
Blue Swirl [Sun, 11 Sep 2011 09:42:13 +0000 (09:42 +0000)]
Sparc: fix coding style

Before the next patch, fix coding style of the areas affected.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agom48t59: fix write access
Blue Swirl [Sat, 15 Oct 2011 08:05:18 +0000 (08:05 +0000)]
m48t59: fix write access

Fix incorrect order of arguments, letting writes to NVRAM succeed.

It looks like guests never write to the device, only read from it, since the bug
originates back to 819385c58b319d9f80d676cefaed0610118f03ac.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agom48t59: drop obsolete address base arithmetic
Blue Swirl [Sat, 15 Oct 2011 07:57:49 +0000 (07:57 +0000)]
m48t59: drop obsolete address base arithmetic

Remove now incorrect address base arithmetic, missed by
9936d6e42392f1440505dfa9df065eabd251cadf. Fixes Sparc64 boot.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agopci_bridge: fix typo
Blue Swirl [Sun, 16 Oct 2011 14:43:00 +0000 (14:43 +0000)]
pci_bridge: fix typo

Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosimplify main loop functions
Paolo Bonzini [Mon, 12 Sep 2011 12:03:13 +0000 (14:03 +0200)]
simplify main loop functions

Provide a clean example of how to use the main loop in the tools.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoRevert to a hand-made select loop
Paolo Bonzini [Mon, 12 Sep 2011 12:59:42 +0000 (14:59 +0200)]
Revert to a hand-made select loop

This reverts commit c82dc29a9112f34e0a51cad9a412cf6d9d05dfb2
and 4d88a2ac8643265108ef1fb47ceee5d7b28e19f2.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomain-loop: create main-loop.c
Paolo Bonzini [Tue, 13 Sep 2011 08:30:52 +0000 (10:30 +0200)]
main-loop: create main-loop.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomain-loop: create main-loop.h
Paolo Bonzini [Mon, 12 Sep 2011 14:44:30 +0000 (16:44 +0200)]
main-loop: create main-loop.h

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: do not use RunState change handlers
Paolo Bonzini [Tue, 27 Sep 2011 16:23:14 +0000 (18:23 +0200)]
qemu-timer: do not use RunState change handlers

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: move more stuff out of qemu-timer.c
Paolo Bonzini [Mon, 12 Sep 2011 14:21:44 +0000 (16:21 +0200)]
qemu-timer: move more stuff out of qemu-timer.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: use atexit for quit_timers
Paolo Bonzini [Mon, 19 Sep 2011 08:18:51 +0000 (10:18 +0200)]
qemu-timer: use atexit for quit_timers

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: do not refer to runstate_is_running()
Paolo Bonzini [Mon, 12 Sep 2011 12:40:36 +0000 (14:40 +0200)]
qemu-timer: do not refer to runstate_is_running()

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: move icount to cpus.c
Paolo Bonzini [Mon, 12 Sep 2011 11:57:37 +0000 (13:57 +0200)]
qemu-timer: move icount to cpus.c

None of this is needed by tools, and most of it can even be made static
inside cpus.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: more clock functions
Paolo Bonzini [Mon, 12 Sep 2011 13:50:16 +0000 (15:50 +0200)]
qemu-timer: more clock functions

These will be used when moving icount accounting to cpus.c.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: move common code to qemu_rearm_alarm_timer
Paolo Bonzini [Mon, 14 Mar 2011 08:45:38 +0000 (09:45 +0100)]
qemu-timer: move common code to qemu_rearm_alarm_timer

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-timer: remove active_timers array
Paolo Bonzini [Tue, 13 Sep 2011 09:42:26 +0000 (11:42 +0200)]
qemu-timer: remove active_timers array

Embed the list in the QEMUClock instead.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoremove unused function
Paolo Bonzini [Mon, 12 Sep 2011 13:17:57 +0000 (15:17 +0200)]
remove unused function

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agocompatfd.c: Don't pass NULL pointer to SYS_signalfd
Peter Maydell [Thu, 13 Oct 2011 17:45:37 +0000 (18:45 +0100)]
compatfd.c: Don't pass NULL pointer to SYS_signalfd

Don't pass a NULL pointer in to SYS_signalfd in qemu_signalfd_available():
this isn't valid and Valgrind complains about it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agolinux-user: Fix broken "-version" option
Peter Maydell [Thu, 29 Sep 2011 14:48:12 +0000 (15:48 +0100)]
linux-user: Fix broken "-version" option

Fix the "-version" option, which was accidentally broken in commit
fc9c541:
 * exit after printing version information rather than proceeding
   blithely onward (and likely printing the full usage message)
 * correct the cut-n-paste error in the usage message for it
 * don't insist on the presence of a following argument for
   options which don't take an argument (this was preventing
   'qemu-arm -version' from working)
 * remove a spurious argc check from the beginning of main() which
   meant 'QEMU_VERSION=1 qemu-arm' didn't work.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoblock: change discard to co_discard
Paolo Bonzini [Thu, 20 Oct 2011 11:16:25 +0000 (13:16 +0200)]
block: change discard to co_discard

Since coroutine operation is now mandatory, convert both bdrv_discard
implementations to coroutines.  For qcow2, this means taking the lock
around the operation.  raw-posix remains synchronous.

The bdrv_discard callback is then unused and can be eliminated.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: change flush to co_flush
Paolo Bonzini [Thu, 20 Oct 2011 11:16:24 +0000 (13:16 +0200)]
block: change flush to co_flush

Since coroutine operation is now mandatory, convert all bdrv_flush
implementations to coroutines.  For qcow2, this means taking the lock.
Other implementations are simpler and just forward bdrv_flush to the
underlying protocol, so they can avoid the lock.

The bdrv_flush callback is then unused and can be eliminated.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: take lock around bdrv_write implementations
Paolo Bonzini [Thu, 20 Oct 2011 11:16:23 +0000 (13:16 +0200)]
block: take lock around bdrv_write implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_write implementations to take the mutex.

Drivers that implement bdrv_write rather than bdrv_co_writev can
then benefit from asynchronous operation (at least if the underlying
protocol supports it, which is not the case for raw-win32), even
though they still operate with a bounce buffer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: take lock around bdrv_read implementations
Paolo Bonzini [Thu, 20 Oct 2011 11:16:22 +0000 (13:16 +0200)]
block: take lock around bdrv_read implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_read implementations to take the mutex.

Drivers that implement bdrv_read rather than bdrv_co_readv can
then benefit from asynchronous operation (at least if the underlying
protocol supports it, which is not the case for raw-win32), even
though they still operate with a bounce buffer.

raw-win32 does not need the lock, because it cannot yield.
nbd also doesn't probably, but better be safe.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: add a CoMutex to synchronous read drivers
Paolo Bonzini [Thu, 20 Oct 2011 11:16:21 +0000 (13:16 +0200)]
block: add a CoMutex to synchronous read drivers

The big conversion of bdrv_read/write to coroutines caused the two
homonymous callbacks in BlockDriver to become reentrant.  It goes
like this:

1) bdrv_read is now called in a coroutine, and calls bdrv_read or
bdrv_pread.

2) the nested bdrv_read goes through the fast path in bdrv_rw_co_entry;

3) in the common case when the protocol is file, bdrv_co_do_readv calls
bdrv_co_readv_em (and from here goes to bdrv_co_io_em), which yields
until the AIO operation is complete;

4) if bdrv_read had been called from a bottom half, the main loop
is free to iterate again: a device model or another bottom half
can then come and call bdrv_read again.

This applies to all four of read/write/flush/discard.  It would also
apply to is_allocated, but it is not used from within coroutines:
besides qemu-img.c and qemu-io.c, which operate synchronously, the
only user is the monitor.  Copy-on-read will introduce a use in the
block layer, and will require converting it.

The solution is "simply" to convert all drivers to coroutines!  We
just need to add a CoMutex that is taken around affected operations.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovmdk: clean up open
Paolo Bonzini [Thu, 20 Oct 2011 11:16:20 +0000 (13:16 +0200)]
vmdk: clean up open

Move vmdk_parent_open to vmdk_open.  There's another path how
vmdk_parent_open can be reached:

  vmdk_parse_extents() ->  vmdk_open_sparse() ->  vmdk_open_vmdk4() ->
  vmdk_open_desc_file().

If that can happen, however, the code is bogus.  vmdk_parent_open
reads from bs->file:

    if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {

but it is always called with s->desc_offset == 0 and with the same
bs->file.  So the data that vmdk_parent_open reads comes always from the
same place, and anyway there is only one place where it can write it,
namely bs->backing_file.

So, if it cannot happen, the patched code is okay.

It is also possible that the recursive call can happen, but only once.  In
that case there would still be a bug in vmdk_open_desc_file setting
s->desc_offset = 0, but the patched code is okay.

Finally, in the case where multiple recursive calls can happen the code
would need to be rewritten anyway.  It is likely that this would anyway
involve adding several parameters to vmdk_parent_open, and calling it from
vmdk_open_vmdk4.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovmdk: fix return values of vmdk_parent_open
Paolo Bonzini [Thu, 20 Oct 2011 11:16:19 +0000 (13:16 +0200)]
vmdk: fix return values of vmdk_parent_open

While vmdk_open_desc_file (touched by the patch) correctly changed -1
to -EINVAL, vmdk_open did not.  Fix it directly in vmdk_parent_open.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agopc: Fix floppy drives with if=none
Kevin Wolf [Thu, 20 Oct 2011 14:37:26 +0000 (16:37 +0200)]
pc: Fix floppy drives with if=none

Commit 63ffb564 broke floppy devices specified on the command line like
-drive file=...,if=none,id=floppy -global isa-fdc.driveA=floppy because it
relies on drive_get() which works only with -fda/-drive if=floppy.

This patch resembles what we're already doing for IDE, i.e. remember the floppy
device that was created and use that to extract the BlockDriverStates where
needed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
12 years agoqcow2: Fix bdrv_write_compressed error handling
Kevin Wolf [Tue, 18 Oct 2011 15:12:44 +0000 (17:12 +0200)]
qcow2: Fix bdrv_write_compressed error handling

If during allocation of compressed clusters the cluster was already allocated
uncompressed, fail and properly release the l2_table (the latter avoids a
failed assertion).

While at it, make it return some real error numbers instead of -1.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
12 years agoqemu-img: Don't allow preallocation and compression at the same time
Kevin Wolf [Tue, 18 Oct 2011 14:19:42 +0000 (16:19 +0200)]
qemu-img: Don't allow preallocation and compression at the same time

Only qcow and qcow2 can do compression at all, and they require unallocated
clusters when writing the compressed data.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agofdc: Fix floppy port I/O
Kevin Wolf [Tue, 18 Oct 2011 14:41:45 +0000 (16:41 +0200)]
fdc: Fix floppy port I/O

The floppy device was broken by commit 212ec7ba (fdc: Convert to
isa_register_portio_list). While the old interface provided the port number
relative to the floppy drive's io_base, the new one provides the real port
number, so we need to apply a bitmask now to get the register number.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: add bdrv_co_discard and bdrv_aio_discard support
Paolo Bonzini [Mon, 17 Oct 2011 10:32:14 +0000 (12:32 +0200)]
block: add bdrv_co_discard and bdrv_aio_discard support

This similarly adds support for coroutine and asynchronous discard.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: drop redundant bdrv_flush implementation
Stefan Hajnoczi [Mon, 17 Oct 2011 10:32:13 +0000 (12:32 +0200)]
block: drop redundant bdrv_flush implementation

Block drivers now only need to provide either of .bdrv_co_flush,
.bdrv_aio_flush() or for legacy drivers .bdrv_flush().  Remove
the redundant .bdrv_flush() implementations.

[Paolo Bonzini: change raw driver to bdrv_co_flush]

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: unify flush implementations
Paolo Bonzini [Mon, 17 Oct 2011 10:32:12 +0000 (12:32 +0200)]
block: unify flush implementations

Add coroutine support for flush and apply the same emulation that
we already do for read/write.  bdrv_aio_flush is simplified to always
go through a coroutine.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoxen_disk: Always set feature-barrier = 1
Kevin Wolf [Fri, 21 Oct 2011 10:16:44 +0000 (12:16 +0200)]
xen_disk: Always set feature-barrier = 1

The synchronous .bdrv_flush callback doesn't exist any more and a device really
shouldn't poke into the block layer internals anyway. All drivers are supposed
to have a correctly working bdrv_flush, so let's just hard-code this.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofix memory leak in aio_write_f
Alex Jia [Wed, 28 Sep 2011 06:57:01 +0000 (14:57 +0800)]
fix memory leak in aio_write_f

Haven't released memory of 'ctx' before return.

Signed-off-by: Alex Jia <ajia@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: rename bdrv_co_rw_bh
Paolo Bonzini [Fri, 14 Oct 2011 08:41:29 +0000 (10:41 +0200)]
block: rename bdrv_co_rw_bh

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoadd socket_set_block
Paolo Bonzini [Wed, 5 Oct 2011 07:17:32 +0000 (09:17 +0200)]
add socket_set_block

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: add coroutine_fn markers
Paolo Bonzini [Wed, 5 Oct 2011 07:17:31 +0000 (09:17 +0200)]
sheepdog: add coroutine_fn markers

This makes the following patch easier to review.

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohw/arm_gic.c: Fix save/load of irq_target array
Dmitry Koshelev [Thu, 20 Oct 2011 10:48:35 +0000 (14:48 +0400)]
hw/arm_gic.c: Fix save/load of irq_target array

irq_target array saving/loading is in the wrong loop.
Version bump.

Signed-off-by: Dmitry Koshelev <karaghiozis@gmail.com>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/omap2: Wire up the IRQ for the 2430's fifth GPIO module
Peter Maydell [Tue, 18 Oct 2011 15:12:54 +0000 (16:12 +0100)]
hw/omap2: Wire up the IRQ for the 2430's fifth GPIO module

The OMAP2430 version of the omap-gpio device has five GPIO modules,
not four like the other OMAP2 versions; wire up the fifth module's
IRQ line correctly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/9pfs: Fix broken compilation caused by wrong trace events
Stefan Weil [Thu, 20 Oct 2011 19:55:58 +0000 (21:55 +0200)]
hw/9pfs: Fix broken compilation caused by wrong trace events

Commit c572f23a3e7180dbeab5e86583e43ea2afed6271 added trace events
with mismatching format string and arguments.

gcc reports these errors:

In file included from trace.c:2:0:
trace.h: In function ‘trace_v9fs_attach’:
trace.h:2850:9: error: too many arguments for format [-Werror=format-extra-args]
trace.h: In function ‘trace_v9fs_wstat’:
trace.h:3039:9: error: too many arguments for format [-Werror=format-extra-args]
trace.h: In function ‘trace_v9fs_mkdir’:
trace.h:3088:9: error: too many arguments for format [-Werror=format-extra-args]
trace.h: In function ‘trace_v9fs_mkdir_return’:
trace.h:3095:9: error: too many arguments for format [-Werror=format-extra-args]

Fix the format strings and also use %u instead of %d for unsigned values
in the changed strings. There are more minor errors of this kind
which I did not fix because that would make the review more difficult.

v2: Fixed position of } for v9fs_mkdir_return.

Cc: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-arm: Fix use of free() in cpu_arm_close()
Andreas Färber [Mon, 10 Oct 2011 02:52:28 +0000 (02:52 +0000)]
target-arm: Fix use of free() in cpu_arm_close()

env is allocated in cpu_arm_init() with g_malloc0(), so free with g_free().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoMerge remote-tracking branch 'quintela/migration-pull' into staging
Anthony Liguori [Thu, 20 Oct 2011 13:46:55 +0000 (08:46 -0500)]
Merge remote-tracking branch 'quintela/migration-pull' into staging

12 years agoMerge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging
Anthony Liguori [Thu, 20 Oct 2011 13:43:00 +0000 (08:43 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging

12 years agoMerge remote-tracking branch 'aneesh/for-upstream-6' into staging
Anthony Liguori [Thu, 20 Oct 2011 13:42:08 +0000 (08:42 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream-6' into staging

Conflicts:
trace-events

12 years agomigration: make migration-{tcp,unix} consistent
Juan Quintela [Wed, 23 Feb 2011 19:44:29 +0000 (20:44 +0100)]
migration: make migration-{tcp,unix} consistent

Files are almost identical in functionality, just remove the
differences that make no sense.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: propagate error correctly
Juan Quintela [Wed, 23 Feb 2011 18:56:52 +0000 (19:56 +0100)]
migration: propagate error correctly

unix and tcp outgoing migration have error values, but didn't returned
it.  Make them return the error.  Notice that EINPROGRESS & EWOULDBLOCK
are not considered errors as call will be retry later.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: Don't use callback on file defining it
Juan Quintela [Wed, 23 Feb 2011 10:52:12 +0000 (11:52 +0100)]
migration: Don't use callback on file defining it

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: Make state definitions local
Juan Quintela [Tue, 22 Feb 2011 23:48:46 +0000 (00:48 +0100)]
migration: Make state definitions local

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: Export a function that tells if the migration has finished correctly
Juan Quintela [Tue, 22 Feb 2011 23:43:59 +0000 (00:43 +0100)]
migration: Export a function that tells if the migration has finished correctly

This will allow us to hide the state values.

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: Pass MigrationState in migration notifiers
Juan Quintela [Wed, 5 Oct 2011 12:27:52 +0000 (14:27 +0200)]
migration: Pass MigrationState in migration notifiers

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: Use bandwidth_limit directly
Juan Quintela [Tue, 22 Feb 2011 23:33:19 +0000 (00:33 +0100)]
migration: Use bandwidth_limit directly

Now that current_migration always exist, there is no reason for
max_throotle variable.

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: create accessor for current_migration
Juan Quintela [Wed, 5 Oct 2011 11:50:43 +0000 (13:50 +0200)]
migration: create accessor for current_migration

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: Move exported functions to the end of the file
Juan Quintela [Tue, 22 Feb 2011 22:54:21 +0000 (23:54 +0100)]
migration: Move exported functions to the end of the file

This means we can remove the two forward declarations.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>