sdk/emulator/qemu.git
13 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

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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

13 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

13 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

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 years agomigration: Remove migration cancel() callback
Juan Quintela [Tue, 11 May 2010 21:38:23 +0000 (23:38 +0200)]
migration: Remove migration cancel() callback

It is used only in one place

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: Remove get_status() accessor
Juan Quintela [Tue, 11 May 2010 21:28:53 +0000 (23:28 +0200)]
migration: Remove get_status() accessor

It is only used inside migration.c, and fields on that struct are
accessed all around the place on that file.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: Our release callback was just free
Juan Quintela [Tue, 11 May 2010 21:18:34 +0000 (23:18 +0200)]
migration: Our release callback was just free

We called it from a single place, and always with state !=
MIG_STATE_ACTIVE.  Just remove the whole callback.  For users of the
notifier, notice that this is exactly the case where they don't care,
we are just freeing the state from previous failed migration (it can't
be a sucessful one, otherwise we would not be running on that machine
in the first place).

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Introduce migrate_fd_completed() for consistency
Juan Quintela [Tue, 22 Feb 2011 22:32:54 +0000 (23:32 +0100)]
migration: Introduce migrate_fd_completed() for consistency

This function is a bit different of the others that change the state,
in the sense that if migrate_fd_cleanup() returns an error, it set the
status to error, not completed.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: Refactor and simplify error checking in migrate_fd_put_ready
Juan Quintela [Tue, 22 Feb 2011 22:18:20 +0000 (23:18 +0100)]
migration: Refactor and simplify error checking in migrate_fd_put_ready

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Introduce MIG_STATE_SETUP
Juan Quintela [Tue, 11 May 2010 21:01:53 +0000 (23:01 +0200)]
migration: Introduce MIG_STATE_SETUP

Use MIG_STATE_ACTIVE only when migration has really started.  Use this
new state to setup migration parameters.  Change defines for an
anonymous struct.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: move migrate_new to do_migrate
Juan Quintela [Tue, 11 May 2010 20:27:45 +0000 (22:27 +0200)]
migration: move migrate_new to do_migrate

Once there, remove all parameters that don't need to be passed to
*start_outgoing_migration() functions

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Make all posible migration functions static
Juan Quintela [Sun, 11 Sep 2011 18:28:22 +0000 (20:28 +0200)]
migration: Make all posible migration functions static

I have to move two functions postions to avoid forward declarations

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Refactor MigrationState creation
Juan Quintela [Tue, 11 May 2010 14:28:39 +0000 (16:28 +0200)]
migration: Refactor MigrationState creation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Rename FdMigrationState MigrationState
Juan Quintela [Tue, 11 May 2010 13:56:35 +0000 (15:56 +0200)]
migration: Rename FdMigrationState MigrationState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Fold MigrationState into FdMigrationState
Juan Quintela [Tue, 11 May 2010 13:51:36 +0000 (15:51 +0200)]
migration: Fold MigrationState into FdMigrationState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Use FdMigrationState instead of MigrationState when possible
Juan Quintela [Tue, 11 May 2010 13:46:39 +0000 (15:46 +0200)]
migration: Use FdMigrationState instead of MigrationState when possible

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Make *start_outgoing_migration return FdMigrationState
Juan Quintela [Tue, 11 May 2010 13:18:38 +0000 (15:18 +0200)]
migration: Make *start_outgoing_migration return FdMigrationState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: make *save_live return errors
Juan Quintela [Wed, 19 Oct 2011 13:22:18 +0000 (15:22 +0200)]
migration: make *save_live return errors

Make *save_live() return negative values when there is one error, and
updates all callers to check for the error.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: use qemu_file_get_error() return value when possible
Juan Quintela [Tue, 4 Oct 2011 23:14:46 +0000 (01:14 +0200)]
migration: use qemu_file_get_error() return value when possible

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agosavevm: Rename has_error to last_error field
Juan Quintela [Tue, 4 Oct 2011 23:05:21 +0000 (01:05 +0200)]
savevm: Rename has_error to last_error field

Now the field contains the last error name, so rename acordingly.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: rename qemu_file_has_error to qemu_file_get_error
Juan Quintela [Tue, 4 Oct 2011 23:02:52 +0000 (01:02 +0200)]
migration: rename qemu_file_has_error to qemu_file_get_error

Now the function returned errno, so it is better the new name.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: return real error code
Juan Quintela [Thu, 22 Sep 2011 09:02:14 +0000 (11:02 +0200)]
migration: return real error code

make functions propagate errno, instead of just using -EIO.  Add a
comment about what are the return value of qemu_savevm_state_iterate().

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: change has_error to contain errno values
Juan Quintela [Wed, 21 Sep 2011 21:01:54 +0000 (23:01 +0200)]
migration: change has_error to contain errno values

We normally already have an errno value.  When not, abuse EIO.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: set error if select return one error
Juan Quintela [Wed, 21 Sep 2011 20:46:36 +0000 (22:46 +0200)]
migration: set error if select return one error

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: don't "write" when migration is not active
Juan Quintela [Wed, 21 Sep 2011 20:37:29 +0000 (22:37 +0200)]
migration: don't "write" when migration is not active

If migration is not active, just ignore writes.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agobuffered_file: reuse QEMUFile has_error field
Juan Quintela [Wed, 21 Sep 2011 20:32:08 +0000 (22:32 +0200)]
buffered_file: reuse QEMUFile has_error field

Instead of having two has_error fields in QEMUFile & QEMUBufferedFile,
reuse the 1st one.  Notice that the one in buffered_file is only set
after a file operation.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agobuffered_file: Use right "opaque"
Juan Quintela [Wed, 21 Sep 2011 16:12:58 +0000 (18:12 +0200)]
buffered_file: Use right "opaque"

buffered_close 's' variable is of type QEMUFileBuffered, and
wait_for_unfreeze() expect to receive a MigrationState, that
'coincidentaly' is s->opaque.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: If there is one error, it makes no sense to continue
Juan Quintela [Wed, 23 Feb 2011 19:17:45 +0000 (20:17 +0100)]
migration: If there is one error, it makes no sense to continue

Once there, add a comment about what each error mean.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomigration: add error handling to migrate_fd_put_notify().
Yoshiaki Tamura [Tue, 22 Feb 2011 15:01:24 +0000 (00:01 +0900)]
migration: add error handling to migrate_fd_put_notify().

Although migrate_fd_put_buffer() sets MIG_STATE_ERROR if it failed,
since migrate_fd_put_notify() isn't checking error of underlying
QEMUFile, those resources are kept open.  This patch checks it and
calls migrate_fd_error() in case of error.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: Check that migration is active before cancel it
Juan Quintela [Tue, 11 May 2010 20:39:51 +0000 (22:39 +0200)]
migration: Check that migration is active before cancel it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomigration: simplify state assignmente
Juan Quintela [Tue, 13 Sep 2011 13:11:38 +0000 (15:11 +0200)]
migration: simplify state assignmente

Once there, make sure that if we already know that there is one error,
just call migration_fd_cleanup() with the ERROR state.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agods1225y: Use stdio instead of QEMUFile
Juan Quintela [Tue, 13 Sep 2011 12:41:18 +0000 (14:41 +0200)]
ds1225y: Use stdio instead of QEMUFile

QEMUFile * is only intended for migration nowadays.  Using it for
anything else just adds pain and a layer of buffers for no good
reason.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoRevert "savevm: fix corruption in vmstate_subsection_load()."
Juan Quintela [Fri, 30 Sep 2011 17:46:43 +0000 (19:46 +0200)]
Revert "savevm: fix corruption in vmstate_subsection_load()."

This reverts commit eb60260de0b050a5e8ab725e84d377d0b44c43ae.

Conflicts:

savevm.c

We changed qemu_peek_byte() prototype, just fixed the rejects.

Signed-off-by: Juan Quintela<quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosavevm: improve subsections detection on load
Juan Quintela [Tue, 4 Oct 2011 13:28:31 +0000 (15:28 +0200)]
savevm: improve subsections detection on load

We add qemu_peek_buffer, that is identical to qemu_get_buffer, just
that it don't update f->buf_index.

We add a paramenter to qemu_peek_byte() to be able to peek more than
one byte.

Once this is done, to see if we have a subsection we look:
- 1st byte is QEMU_VM_SUBSECTION
- 2nd byte is a length, and is bigger than section name
- 3rd element is a string that starts with section_name

So, we shouldn't have false positives (yes, content could still get us
wrong but probabilities are really low).

v2:
- Alex Williamsom found that we could get negative values on index.
- Rework code to fix that part.
- Rewrite qemu_get_buffer() using qemu_peek_buffer()

v3:
- return "done" on error case

v4:
- fix qemu_file_skip() off by one.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agosavevm: define qemu_get_byte() using qemu_peek_byte()
Juan Quintela [Thu, 6 Oct 2011 12:29:32 +0000 (14:29 +0200)]
savevm: define qemu_get_byte() using qemu_peek_byte()

Signed-off-by: Juan Quintela<quintela@redhat.com>
13 years agosavevm: some coding style cleanups
Juan Quintela [Tue, 4 Oct 2011 11:55:32 +0000 (13:55 +0200)]
savevm: some coding style cleanups

This patch will make moving code on next patches and having checkpatch
happy easier.

Signed-off-by: Juan Quintela<quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosavevm: teach qemu_fill_buffer to do partial refills
Juan Quintela [Fri, 30 Sep 2011 17:28:45 +0000 (19:28 +0200)]
savevm: teach qemu_fill_buffer to do partial refills

We will need on next patch to be able to lookahead on next patch

v2: rename "used" to "pending" (Alex Williams)

Signed-off-by: Juan Quintela<quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agorunstate: Allow user to migrate twice
Luiz Capitulino [Fri, 14 Oct 2011 14:18:09 +0000 (11:18 -0300)]
runstate: Allow user to migrate twice

It should be a matter of allowing the transition POSTMIGRATE ->
FINISH_MIGRATE, but it turns out that the VM won't do the
transition the second time because it's already stopped.

So this commit also adds vm_stop_force_state() which performs
the transition even if the VM is already stopped.

While there also allow other states to migrate.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agosavevm: qemu_savevm_state(): Drop stop VM logic
Luiz Capitulino [Thu, 13 Oct 2011 14:36:40 +0000 (11:36 -0300)]
savevm: qemu_savevm_state(): Drop stop VM logic

qemu_savevm_state() has some logic to stop the VM and to (or not to)
resume it. But this seems to be a big noop, as qemu_savevm_state()
is only called by do_savevm() when the VM is already stopped.

So, let's drop qemu_savevm_state()'s stop VM logic.

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agorunstate: Allow to transition from paused to postmigrate
Luiz Capitulino [Thu, 13 Oct 2011 17:39:59 +0000 (14:39 -0300)]
runstate: Allow to transition from paused to postmigrate

The user may already have paused the VM before starting the
migration process. If s/he does that, then the state will be
'paused' when we finish the migration process. In that case
we want to transition from 'paused' to 'postmigrate' as the
latter is now the real reason why the VM is stopped.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agorunstate: Print state transition when invalid
Luiz Capitulino [Thu, 13 Oct 2011 13:59:07 +0000 (10:59 -0300)]
runstate: Print state transition when invalid

Makes it easier to debug.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agoQMP: Fix blockdev-snapshot-sync doc example
Luiz Capitulino [Mon, 10 Oct 2011 20:30:08 +0000 (17:30 -0300)]
QMP: Fix blockdev-snapshot-sync doc example

Fix wrong command name.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agotcx: convert to memory API
Avi Kivity [Wed, 5 Oct 2011 16:26:24 +0000 (18:26 +0200)]
tcx: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agotc63963xb: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:42:42 +0000 (14:42 +0200)]
tc63963xb: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosyborg: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:33:26 +0000 (14:33 +0200)]
syborg: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosun4u: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:31:12 +0000 (14:31 +0200)]
sun4u: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosun4m: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:27:32 +0000 (14:27 +0200)]
sun4m: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agostrongarm: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:14:20 +0000 (14:14 +0200)]
strongarm: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agospitz: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 11:03:56 +0000 (13:03 +0200)]
spitz: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agospapr: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 10:56:38 +0000 (12:56 +0200)]
spapr: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosm501: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 15:56:06 +0000 (17:56 +0200)]
sm501: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agos390-virtio: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 15:06:42 +0000 (17:06 +0200)]
s390-virtio: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agorealview: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 15:04:26 +0000 (17:04 +0200)]
realview: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agor2d: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 14:48:42 +0000 (16:48 +0200)]
r2d: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoppcr500_mpc8544ds: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 14:43:01 +0000 (16:43 +0200)]
ppcr500_mpc8544ds: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopci: simplify memory region registration
Avi Kivity [Thu, 11 Aug 2011 11:40:58 +0000 (14:40 +0300)]
pci: simplify memory region registration

The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) are
identical.  Unify them.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopxa2xx: convert to memory API (part II)
Avi Kivity [Sun, 25 Sep 2011 15:19:19 +0000 (18:19 +0300)]
pxa2xx: convert to memory API (part II)

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopxa2xx: convert to memory API (part I)
Avi Kivity [Sun, 25 Sep 2011 15:19:19 +0000 (18:19 +0300)]
pxa2xx: convert to memory API (part I)

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoppc_prep: convert to memory API
Avi Kivity [Sun, 25 Sep 2011 13:57:45 +0000 (16:57 +0300)]
ppc_prep: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>