]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
11 years agobuffered_file: We can access directly to bandwidth_limit
Juan Quintela [Fri, 20 Jul 2012 11:33:53 +0000 (13:33 +0200)]
buffered_file: We can access directly to bandwidth_limit

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agobuffered_file: unfold migrate_fd_close
Juan Quintela [Fri, 20 Jul 2012 11:19:36 +0000 (13:19 +0200)]
buffered_file: unfold migrate_fd_close

We only used it once, just remove the callback indirection.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agobuffered_file: unfold migrate_fd_wait_for_unfreeze
Juan Quintela [Fri, 20 Jul 2012 11:16:28 +0000 (13:16 +0200)]
buffered_file: unfold migrate_fd_wait_for_unfreeze

We only used it once, just remove the callback indirection.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agobuffered_file: unfold migrate_fd_put_ready
Juan Quintela [Fri, 20 Jul 2012 11:13:59 +0000 (13:13 +0200)]
buffered_file: unfold migrate_fd_put_ready

We only use it once, just remove the callback indirection.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agobuffered_file: unfold migrate_fd_put_buffer
Juan Quintela [Fri, 20 Jul 2012 11:10:54 +0000 (13:10 +0200)]
buffered_file: unfold migrate_fd_put_buffer

We only used it once, just remove the callback indirection

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agobuffered_file: opaque is MigrationState
Juan Quintela [Fri, 20 Jul 2012 11:07:17 +0000 (13:07 +0200)]
buffered_file: opaque is MigrationState

It always have that type, just change it.
We will remove buffered file later on the migration thread series.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agobuffered_file: rename opaque to migration_state
Juan Quintela [Fri, 20 Jul 2012 11:04:42 +0000 (13:04 +0200)]
buffered_file: rename opaque to migration_state

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoBufferedFile: append, then flush
Paolo Bonzini [Tue, 16 Aug 2011 23:43:24 +0000 (16:43 -0700)]
BufferedFile: append, then flush

Simplify the logic for pushing data from the buffer to the output
pipe/socket.  This also matches more closely what will be the
operation of the migration thread.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agomigration: Add dirty_pages_rate to query migrate output
Juan Quintela [Mon, 13 Aug 2012 10:31:25 +0000 (12:31 +0200)]
migration: Add dirty_pages_rate to query migrate output

It indicates how many pages were dirtied during the last second.

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoSeparate migration bitmap
Juan Quintela [Fri, 20 Jul 2012 10:33:00 +0000 (12:33 +0200)]
Separate migration bitmap

This patch creates a migration bitmap, which is periodically kept in
sync with the qemu bitmap. A separate copy of the dirty bitmap for the
migration limits the amount of concurrent access to the qemu bitmap
from iothread and migration thread (which requires taking the big
lock).

We use the qemu bitmap type.  We have to "undo" the dirty_pages
counting optimization on the general dirty bitmap and do the counting
optimization with the migration local bitmap.

Signed-off-by: Umesh Deshpande <udeshpan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agoram: create trace event for migration sync bitmap
Juan Quintela [Tue, 4 Sep 2012 11:08:57 +0000 (13:08 +0200)]
ram: create trace event for migration sync bitmap

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoram: introduce migration_bitmap_sync()
Juan Quintela [Fri, 20 Jul 2012 08:52:51 +0000 (10:52 +0200)]
ram: introduce migration_bitmap_sync()

Helper that we use each time that we need to syncronize the migration
bitmap with the other dirty bitmaps.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoram: Export last_ram_offset()
Juan Quintela [Fri, 20 Jul 2012 08:37:54 +0000 (10:37 +0200)]
ram: Export last_ram_offset()

Is the only way of knowing the RAM size.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoram: Introduce migration_bitmap_test_and_reset_dirty()
Juan Quintela [Fri, 20 Jul 2012 08:36:12 +0000 (10:36 +0200)]
ram: Introduce migration_bitmap_test_and_reset_dirty()

It just test if the dirty bit is set, and clears it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agoram: introduce migration_bitmap_set_dirty()
Juan Quintela [Fri, 20 Jul 2012 08:16:08 +0000 (10:16 +0200)]
ram: introduce migration_bitmap_set_dirty()

It just marks a region of memory as dirty.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agosavevm: Factorize ram globals reset in its own function
Juan Quintela [Tue, 17 Jul 2012 15:02:24 +0000 (17:02 +0200)]
savevm: Factorize ram globals reset in its own function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agomigration: print expected downtime in info migrate
Juan Quintela [Mon, 13 Aug 2012 07:53:12 +0000 (09:53 +0200)]
migration: print expected downtime in info migrate

Signed-off-by: Juan Quintela <quintela@redhat.com>
11 years agomigration: export migrate_get_current()
Juan Quintela [Mon, 13 Aug 2012 07:42:49 +0000 (09:42 +0200)]
migration: export migrate_get_current()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomigration: rename expected_time to expected_downtime
Juan Quintela [Mon, 13 Aug 2012 07:36:36 +0000 (09:36 +0200)]
migration: rename expected_time to expected_downtime

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agomigration: print total downtime for final phase of migration
Juan Quintela [Mon, 13 Aug 2012 07:35:16 +0000 (09:35 +0200)]
migration: print total downtime for final phase of migration

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agomigration: store end_time in a local variable
Juan Quintela [Fri, 10 Aug 2012 19:53:08 +0000 (21:53 +0200)]
migration: store end_time in a local variable

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agofix migration sync
Juan Quintela [Fri, 3 Aug 2012 10:58:16 +0000 (12:58 +0200)]
fix migration sync

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agobuffered_file: g_realloc() can't fail
Juan Quintela [Tue, 24 Jul 2012 12:14:32 +0000 (14:14 +0200)]
buffered_file: g_realloc() can't fail

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agotcg: Optimize mulu2
Richard Henderson [Tue, 2 Oct 2012 18:32:30 +0000 (11:32 -0700)]
tcg: Optimize mulu2

Like add2, do operand ordering, constant folding, and dead operand
elimination.  The latter happens about 15% of all mulu2 during an
x86_64 bios boot.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Optimize half-dead add2/sub2
Richard Henderson [Tue, 2 Oct 2012 18:32:29 +0000 (11:32 -0700)]
tcg: Optimize half-dead add2/sub2

When x86_64 guest is not in 64-bit mode, the high-part of the 64-bit
add is dead.  When the host is 32-bit, we can simplify to 32-bit
arithmetic.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Constant fold add2 and sub2
Richard Henderson [Tue, 2 Oct 2012 18:32:28 +0000 (11:32 -0700)]
tcg: Constant fold add2 and sub2

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Do constant folding on double-word comparisons
Richard Henderson [Tue, 2 Oct 2012 18:32:27 +0000 (11:32 -0700)]
tcg: Do constant folding on double-word comparisons

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Split out subroutines from do_constant_folding_cond
Richard Henderson [Tue, 2 Oct 2012 18:32:26 +0000 (11:32 -0700)]
tcg: Split out subroutines from do_constant_folding_cond

We can re-use these for implementing double-word folding.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Optimize double-word comparisons against zero
Richard Henderson [Tue, 2 Oct 2012 18:32:25 +0000 (11:32 -0700)]
tcg: Optimize double-word comparisons against zero

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Use common code when failing to optimize
Richard Henderson [Tue, 2 Oct 2012 18:32:24 +0000 (11:32 -0700)]
tcg: Use common code when failing to optimize

This saves a whole lot of repetitive code sequences.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Swap commutative double-word comparisons
Richard Henderson [Tue, 2 Oct 2012 18:32:23 +0000 (11:32 -0700)]
tcg: Swap commutative double-word comparisons

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Canonicalize add2 operand ordering
Richard Henderson [Tue, 2 Oct 2012 18:32:22 +0000 (11:32 -0700)]
tcg: Canonicalize add2 operand ordering

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg: Split out swap_commutative as a subroutine
Richard Henderson [Tue, 2 Oct 2012 18:32:21 +0000 (11:32 -0700)]
tcg: Split out swap_commutative as a subroutine

Reduces code duplication and prefers

  movcond d, c1, c2, const, s
to
  movcond d, c1, c2, s, const

It also prefers

  add r, r, c
over
  add r, c, r

when both inputs are known constants.  This doesn't matter for true add, as
we will fully constant fold that.  But it matters for a follow-on patch using
this routine for add2 which may not be fully foldable.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agomemory: abort if a memory region is destroyed during a transaction
Avi Kivity [Wed, 17 Oct 2012 15:14:41 +0000 (17:14 +0200)]
memory: abort if a memory region is destroyed during a transaction

Destroying a memory region is illegal within a transaction, as until
the transaction is committed, the memory core may hold references to
the region.  Add an assert to check for violations of this rule.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agoi440fx: avoid destroying memory regions within a transaction
Avi Kivity [Wed, 17 Oct 2012 15:10:04 +0000 (17:10 +0200)]
i440fx: avoid destroying memory regions within a transaction

Calling memory_region_destroy() within a transaction is illegal, since
the memory API is allowed to continue to dispatch to a region until the
transaction commits.  440fx does that however when managing PAM registers.

This bug is benign, since the regions are all aliases (which the memory
core tends to throw anyway), and since we don't do concurrent dispatch yet,
but instead of relying on that, tighten ship ahead of the coming concurrency
storm.

Fix by having a predefined set of regions, of which one will be enabled at
any time.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agomemory: Make eventfd adhere to device endianness
Alexander Graf [Mon, 15 Oct 2012 18:30:28 +0000 (20:30 +0200)]
memory: Make eventfd adhere to device endianness

Our memory API MMIO regions know the concept of device endianness. This
is used to automatically swap endianness between devices and host CPU,
depending on whether buses in between would swizzle the bits.

The ioeventfd value comparison does not adhere to that semantic though.
Probably because nobody has been running ioeventfd on a BE platform and
the only device implementing ioeventfd right now is LE (PCI) based.

So add swizzling to ioeventfd registration / deletion to make the rest
of the code as consistent as possible.

Thanks a lot to Michael Tsirkin to point me towards the right direction.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agotarget-mips: Pass MIPSCPU to mips_vpe_sleep()
Andreas Färber [Thu, 11 Oct 2012 22:56:37 +0000 (00:56 +0200)]
target-mips: Pass MIPSCPU to mips_vpe_sleep()

Needed for moving halted field to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Pass MIPSCPU to mips_tc_sleep()
Andreas Färber [Thu, 11 Oct 2012 22:56:36 +0000 (00:56 +0200)]
target-mips: Pass MIPSCPU to mips_tc_sleep()

Needed for changing mips_vpe_sleep() argument type to MIPSCPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Pass MIPSCPU to mips_vpe_is_wfi()
Andreas Färber [Thu, 11 Oct 2012 22:56:35 +0000 (00:56 +0200)]
target-mips: Pass MIPSCPU to mips_vpe_is_wfi()

Needed for moving halted field to CPUState.
The variable name "c" is retained for MIPSCPU to leave "cpu" for CPUState.

Also change return type to bool while at it.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Pass MIPSCPU to mips_tc_wake()
Andreas Färber [Thu, 11 Oct 2012 22:56:34 +0000 (00:56 +0200)]
target-mips: Pass MIPSCPU to mips_tc_wake()

Needed for changing mips_vpe_is_wfi() argument type to MIPSCPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Clean up other_cpu in helper_{d,e}vpe()
Andreas Färber [Thu, 11 Oct 2012 22:56:33 +0000 (00:56 +0200)]
target-mips: Clean up other_cpu in helper_{d,e}vpe()

Free the variable name "other_cpu" for later use for MIPSCPU.

Fix off-by-one indentation while at it.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg-ia64: Implement deposit
Richard Henderson [Wed, 10 Oct 2012 23:01:35 +0000 (16:01 -0700)]
tcg-ia64: Implement deposit

Note that in the general reg=reg,reg case we're restricted
to 16-bit insertions.  This makes it easy to allow "any"
constant as input, as post-truncation it will fit into the
constant load insn for which we have room in the bundle.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/ia64: slightly optimize TLB access code
Aurelien Jarno [Tue, 9 Oct 2012 19:53:55 +0000 (21:53 +0200)]
tcg/ia64: slightly optimize TLB access code

It is possible to slightly optimize the TLB access code, by replacing
the movi + and instructions by a deposit instruction.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/ia64: remove suboptimal register shifting in qemu_ld/st ops
Aurelien Jarno [Tue, 9 Oct 2012 19:53:55 +0000 (21:53 +0200)]
tcg/ia64: remove suboptimal register shifting in qemu_ld/st ops

Remove suboptimal register shifting in qemu_ld/st ops, introduced at the
CONFIG_TCG_PASS_AREG0 time.

As mem_idx is now loaded in register R58/R59 for the slow path, we have
to make sure to do it last, to not add additional register constraints.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/ia64: implement movcond_i32/64
Aurelien Jarno [Tue, 9 Oct 2012 19:53:55 +0000 (21:53 +0200)]
tcg/ia64: implement movcond_i32/64

Implement movcond_i32/64 on ia64 hosts. It is not possible to have
immediate compare arguments without adding a new bundle, but it is
possible to have 22-bit immediate value arguments.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/ia64: use stack for TCG temps
Blue Swirl [Tue, 9 Oct 2012 19:53:55 +0000 (21:53 +0200)]
tcg/ia64: use stack for TCG temps

Use stack instead of temp_buf array in CPUState for TCG temps.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/arm: Implement movcond_i32
Peter Maydell [Wed, 26 Sep 2012 18:48:55 +0000 (19:48 +0100)]
tcg/arm: Implement movcond_i32

Implement movcond_i32 for ARM, as the sequence
  mov dst, v2   (implicitly done by the tcg common code)
  cmp c1, c2
  movCC dst, v1

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg/arm: Factor out code to emit immediate or reg-reg op
Peter Maydell [Wed, 26 Sep 2012 18:48:54 +0000 (19:48 +0100)]
tcg/arm: Factor out code to emit immediate or reg-reg op

The code to emit either an immediate cmp or a register cmp insn is
duplicated in several places; factor it out into its own function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoxen: drop no-op MemoryListener callbacks
Avi Kivity [Tue, 2 Oct 2012 14:42:23 +0000 (16:42 +0200)]
xen: drop no-op MemoryListener callbacks

Removes quite a bit of useless code.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: drop no-op MemoryListener callbacks
Avi Kivity [Tue, 2 Oct 2012 14:42:23 +0000 (16:42 +0200)]
kvm: drop no-op MemoryListener callbacks

Removes quite a bit of useless code.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agoxen_pt: drop no-op MemoryListener callbacks
Avi Kivity [Tue, 2 Oct 2012 14:42:23 +0000 (16:42 +0200)]
xen_pt: drop no-op MemoryListener callbacks

Removes quite a bit of useless code.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agovfio: drop no-op MemoryListener callbacks
Avi Kivity [Tue, 2 Oct 2012 14:42:23 +0000 (16:42 +0200)]
vfio: drop no-op MemoryListener callbacks

Removes quite a bit of useless code.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agomemory: drop no-op MemoryListener callbacks
Avi Kivity [Tue, 2 Oct 2012 14:42:23 +0000 (16:42 +0200)]
memory: drop no-op MemoryListener callbacks

Removes quite a bit of useless code.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agomemory: provide defaults for MemoryListener operations
Avi Kivity [Tue, 2 Oct 2012 14:39:57 +0000 (16:39 +0200)]
memory: provide defaults for MemoryListener operations

Many listeners don't need to respond to all MemoryListener callbacks;
provide suitable no-op defaults instead.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agomemory: maintain a list of address spaces
Avi Kivity [Tue, 2 Oct 2012 13:28:50 +0000 (15:28 +0200)]
memory: maintain a list of address spaces

Instead of embedding knowledge of the memory and I/O address spaces in the
memory core, maintain a list of all address spaces.  This list will later
be extended dynamically for other bus masters.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agomemory: export AddressSpace
Avi Kivity [Tue, 2 Oct 2012 12:59:23 +0000 (14:59 +0200)]
memory: export AddressSpace

The DMA API will use an AddressSpace to differentiate among different
initiators.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agomemory: prepare AddressSpace for exporting
Avi Kivity [Tue, 2 Oct 2012 11:53:41 +0000 (13:53 +0200)]
memory: prepare AddressSpace for exporting

AddressSpace contains a member, current_map, of type FlatView.  Since we
want to limit the leakage of internal types to public headers, switch to
a pointer to a FlatView.  There is no performance impact as this isn't used
during lookups, only address space reconfigurations.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agoxen_pt: use separate MemoryListeners for memory and I/O
Avi Kivity [Sun, 30 Sep 2012 20:21:11 +0000 (22:21 +0200)]
xen_pt: use separate MemoryListeners for memory and I/O

Using an unfiltered memory listener will cause regions to be reported
fails multiple times if we have more than two address spaces.  Use a separate
listener for memory and I/O, and utilize MemoryListener's address space
filtering to fix this.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: use separate MemoryListeners for memory and I/O
Avi Kivity [Sun, 30 Sep 2012 20:21:11 +0000 (22:21 +0200)]
kvm: use separate MemoryListeners for memory and I/O

The construct

   if (address_space == get_system_memory()) {
       // memory thing
   } else {
       // io thing
   }

fails if we have more than two address spaces.  Use a separate listener
for memory and I/O, and utilize MemoryListener's address space filtering to
fix this.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agovhost: use MemoryListener filtering to only monitor RAM address space
Avi Kivity [Sun, 30 Sep 2012 20:02:53 +0000 (22:02 +0200)]
vhost: use MemoryListener filtering to only monitor RAM address space

Instead of checking manually, let the listener filter for us.  This prepares
us for DMA address spaces.

Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agomemory: rename 'exec-obsolete.h'
Avi Kivity [Thu, 20 Sep 2012 13:02:51 +0000 (16:02 +0300)]
memory: rename 'exec-obsolete.h'

exec-obsolete.h used to hold pre-memory-API functions that were used from
device code prior to the transition to the memory API.  Now that the
transition is complete, the name no longer describes the file.  The
functions still need to be merged better into the memory core, but there's
no danger of anyone using them.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agoFix popcnt in long mode
malc [Sun, 14 Oct 2012 10:54:38 +0000 (14:54 +0400)]
Fix popcnt in long mode

Thanks to Andriy Gapon for initial problem report.

Signed-off-by: malc <av1474@comtv.ru>
11 years agosun4u: Pass SPARCCPU to cpu_set_ivec_irq()
Andreas Färber [Fri, 12 Oct 2012 02:23:08 +0000 (04:23 +0200)]
sun4u: Pass SPARCCPU to cpu_set_ivec_irq()

Needed for moving halted field to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosun4u: Pass SPARCCPU to cpu_kick_irq()
Andreas Färber [Fri, 12 Oct 2012 02:23:07 +0000 (04:23 +0200)]
sun4u: Pass SPARCCPU to cpu_kick_irq()

Needed for changing qemu_cpu_kick() argument type to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosun4u: Pass SPARCCPU to {,s,hs}tick_irq() and cpu_timer_create()
Andreas Färber [Fri, 12 Oct 2012 02:23:06 +0000 (04:23 +0200)]
sun4u: Pass SPARCCPU to {,s,hs}tick_irq() and cpu_timer_create()

Needed for changing cpu_kick_irq() argument type to SPARCCPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosun4m: Pass SPARCCPU to cpu_kick_irq()
Andreas Färber [Fri, 12 Oct 2012 02:23:05 +0000 (04:23 +0200)]
sun4m: Pass SPARCCPU to cpu_kick_irq()

Needed for changing qemu_cpu_kick() argument type to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosun4m: Pass SPARCCPU to cpu_set_irq()
Andreas Färber [Fri, 12 Oct 2012 02:23:04 +0000 (04:23 +0200)]
sun4m: Pass SPARCCPU to cpu_set_irq()

Needed for changing cpu_kick_irq() argument type to SPARCCPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Emit MOVR insns for setcond_i64 and movcond_64
Richard Henderson [Wed, 10 Oct 2012 16:02:47 +0000 (09:02 -0700)]
tcg-sparc: Emit MOVR insns for setcond_i64 and movcond_64

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Emit BPr insns for brcond_i64
Richard Henderson [Wed, 10 Oct 2012 16:02:46 +0000 (09:02 -0700)]
tcg-sparc: Emit BPr insns for brcond_i64

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Dump illegal opode contents
Richard Henderson [Wed, 10 Oct 2012 16:02:45 +0000 (09:02 -0700)]
tcg-sparc: Dump illegal opode contents

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Drop use of Bicc in favor of BPcc
Richard Henderson [Wed, 10 Oct 2012 16:02:44 +0000 (09:02 -0700)]
tcg-sparc: Drop use of Bicc in favor of BPcc

Now that we're always sparcv9, we can not bother using Bicc for
32-bit branches and BPcc for 64-bit branches and instead always
use BPcc.

New interfaces allow less direct use of tcg_out32 and raw numbers
inside the qemu_ld/st routines.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Optimize setcond2 equality compare with 0.
Richard Henderson [Wed, 10 Oct 2012 16:02:43 +0000 (09:02 -0700)]
tcg-sparc: Optimize setcond2 equality compare with 0.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Use Z constraint for %g0
Richard Henderson [Wed, 10 Oct 2012 16:02:42 +0000 (09:02 -0700)]
tcg-sparc: Use Z constraint for %g0

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Fix add2/sub2
Richard Henderson [Wed, 10 Oct 2012 16:02:41 +0000 (09:02 -0700)]
tcg-sparc: Fix add2/sub2

We must care not to clobber the high parts before we consume them.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Fix setcond
Richard Henderson [Wed, 10 Oct 2012 16:02:40 +0000 (09:02 -0700)]
tcg-sparc: Fix setcond

The set of comparisons that can immediately use the carry are LTU/GEU,
not LTU/LEU.  Don't swap operands when we need a temp register; the
register may already be in use from setcond2.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Fix qemu_st for 32-bit
Richard Henderson [Wed, 10 Oct 2012 16:02:39 +0000 (09:02 -0700)]
tcg-sparc: Fix qemu_st for 32-bit

The datalo variable is still live in the miss path.  Use another
when reconstructing the full data value.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Fix setcond2
Richard Henderson [Wed, 10 Oct 2012 16:02:38 +0000 (09:02 -0700)]
tcg-sparc: Fix setcond2

Like brcond2, use tcg_high_cond.  Use movcc instead of branches.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Implement movcond.
Richard Henderson [Wed, 10 Oct 2012 16:02:37 +0000 (09:02 -0700)]
tcg-sparc: Implement movcond.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Fix brcond2
Richard Henderson [Wed, 10 Oct 2012 16:02:36 +0000 (09:02 -0700)]
tcg-sparc: Fix brcond2

Much the same problem as recently fixed for hppa.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sparc: Don't compute full flags value so often
Richard Henderson [Tue, 9 Oct 2012 21:50:00 +0000 (14:50 -0700)]
target-sparc: Don't compute full flags value so often

Avoid speculatively computing flags before every potentially trapping
operation and instead do the flags computation when a trap actually
occurs.  This gives approximately 30% speedup in emulation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sparc: Avoid unnecessary local temporaries
Richard Henderson [Tue, 9 Oct 2012 21:49:59 +0000 (14:49 -0700)]
target-sparc: Avoid unnecessary local temporaries

Now that save_state never ends a BB, we don't need to copy
values into local temps around it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sparc: Optimize CC_OP_LOGIC conditions
Richard Henderson [Tue, 9 Oct 2012 21:49:58 +0000 (14:49 -0700)]
target-sparc: Optimize CC_OP_LOGIC conditions

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sparc: Fix optimized %icc comparisons
Richard Henderson [Tue, 9 Oct 2012 21:49:57 +0000 (14:49 -0700)]
target-sparc: Fix optimized %icc comparisons

Signed-off-by: Richard Henderson <rth@twiddle.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge remote-tracking branch 'pmaydell/arm-devs.for-upstream' into staging
Anthony Liguori [Fri, 12 Oct 2012 16:20:14 +0000 (11:20 -0500)]
Merge remote-tracking branch 'pmaydell/arm-devs.for-upstream' into staging

* pmaydell/arm-devs.for-upstream:
  arm_gic: Rename gic_state to GICState
  zynq_slcr: Fixed ResetValues enum
  versatilepb: add gpio pl061 support
  hw/ds1338: Implement state save/restore
  hw/ds1338: Remove 'now' field from state struct
  hw/ds1338: Recapture current time when register pointer wraps around
  hw/ds1338: Fix mishandling of register pointer
  hw/arm_gic.c: Fix improper DPRINTF output.
  cadence_ttc: Fix 'clear on read' behavior

11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 12 Oct 2012 16:19:56 +0000 (11:19 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  vnc: fix "info vnc" with "-vnc ..., reverse=on"
  sheepdog: use bool for boolean variables
  configure: Tidy up remnants of non-64-bit physaddrs

11 years agoMerge remote-tracking branch 'kraxel/usb.67' into staging
Anthony Liguori [Fri, 12 Oct 2012 14:14:32 +0000 (09:14 -0500)]
Merge remote-tracking branch 'kraxel/usb.67' into staging

* kraxel/usb.67:
  uhci: Raise interrupt when requested even for non active tds
  usb-redir: Don't make migration fail in none seamless case
  usb-redir: Change usbredir_open_chardev into usbredir_create_parser

11 years agoMerge remote-tracking branch 'mdroth/qga-pull-10-9-12' into staging
Anthony Liguori [Fri, 12 Oct 2012 14:14:23 +0000 (09:14 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-10-9-12' into staging

* mdroth/qga-pull-10-9-12:
  qemu-ga: ga_open_pidfile(): add new line to pidfile
  qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR
  configure: add --localstatedir

11 years agoMerge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20121008.0' into staging
Anthony Liguori [Fri, 12 Oct 2012 14:14:14 +0000 (09:14 -0500)]
Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20121008.0' into staging

* awilliam/tags/vfio-pci-for-qemu-20121008.0:
  vfio-pci: Fix BAR->VFIODevice translation in
  vfio-pci: Clang cleanup
  vfio-pci: Cleanup on INTx setup failure
  vfio-pci: Extend reset
  vfio-pci: Remove setting of MSI qsize
  vfio-pci: Use uintptr_t for void* cast
  vfio-pci: Don't peak at msi_supported
  vfio-pci: Roll the header into the .c file
  vfio-pci: No spurious MSIs
  vfio-pci: Rework MSIX setup/teardown
  vfio-pci: Unmap and retry DMA mapping
  vfio-pci: Re-order map/unmap
  vfio-pci: Update slow path INTx algorithm

11 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Fri, 12 Oct 2012 14:14:04 +0000 (09:14 -0500)]
Merge remote-tracking branch 'stefanha/net' into staging

* stefanha/net:
  net: consolidate NetClientState header files into one
  virtio-net: update nc.link_down in virtio_net_load()
  e1000: update nc.link_down in e1000_post_load()
  rtl8139: implement 8139cp link status

11 years agoMerge remote-tracking branch 'spice/spice.v61' into staging
Anthony Liguori [Fri, 12 Oct 2012 14:13:58 +0000 (09:13 -0500)]
Merge remote-tracking branch 'spice/spice.v61' into staging

* spice/spice.v61:
  qxl: set default revision to 4
  spice: raise requirement to 0.12
  hw/qxl: qxl_dirty_surfaces: use uintptr_t
  hw/qxl: fix condition for exiting guest_bug
  hw/qxl: exit on failure to register qxl interface
  qxl: fix range check for rev3 io commands.
  qxl/update_area_io: cleanup invalid parameters handling
  qxl: always update displaysurface on resize

11 years agolinux-user: register align p{read, write}64
Alexander Graf [Sat, 29 Sep 2012 15:32:39 +0000 (15:32 +0000)]
linux-user: register align p{read, write}64

pread64 and pwrite64 pass 64bit parameters which for some architectures need
to be aligned to special argument pairs, creating a gap argument.

Handle this special case the same way we handle it in other places of the code.

Reported-by: Alex Barcelo <abarcelo@ac.upc.edu>
Signed-off-by: Alexander Graf <agraf@suse.de>
Tested-by: Alex Barcelo <abarcelo@ac.upc.edu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: ppc: mark as long long aligned
Alexander Graf [Sat, 29 Sep 2012 15:32:38 +0000 (15:32 +0000)]
linux-user: ppc: mark as long long aligned

The SysV PPC32 ABI dictates that long long (64bit) parameters are pass in odd/even
register pairs. Because unlike ARM and MIPS we start at an odd register number,
we can reuse the same aligning code that ARM and MIPS use.

Clarified inline comment that it is SysV ABI that requires long long aligned
parameters - Riku

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agotcg: Remove TCG_TARGET_HAS_GUEST_BASE define
Peter Maydell [Tue, 9 Oct 2012 03:16:50 +0000 (03:16 +0000)]
tcg: Remove TCG_TARGET_HAS_GUEST_BASE define

GUEST_BASE support is now supported by all TCG backends, and is
now mandatory. Drop the now-pointless TCG_TARGET_HAS_GUEST_BASE
define (set by every backend) and the error if it is unset.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agoconfigure: Remove unnecessary host_guest_base code
Peter Maydell [Tue, 9 Oct 2012 03:16:49 +0000 (03:16 +0000)]
configure: Remove unnecessary host_guest_base code

All TCG hosts now support guest-base functionality, so we can
remove the setting of host_guest_base to 'yes' in every arm
of the case "$cpu" statement, and simply set guest_base to
default to 'yes'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: If loading fails, print error as string, not number
Peter Maydell [Fri, 24 Aug 2012 06:55:53 +0000 (06:55 +0000)]
linux-user: If loading fails, print error as string, not number

If the attempt to load the guest executable fails, print the
error message as a string, not a number. This requires us to
fix a couple of places in loader_exec() where we were returning
-1 instead of a valid negative errno.

The change allows us to drop the "Unknown binary format" message
because the strerror-enhanced message is now a more self-explanatory
"Error while loading $guest-binary: Exec format error".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: Fix siginfo handling
Richard Henderson [Sat, 15 Sep 2012 18:34:20 +0000 (11:34 -0700)]
linux-user: Fix siginfo handling

Compare signal numbers in the proper domain.
Convert all of the fields for SIGIO and SIGCHLD.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agoalpha-linux-user: Fix sigaltstack structure definition
Richard Henderson [Fri, 14 Sep 2012 22:59:24 +0000 (15:59 -0700)]
alpha-linux-user: Fix sigaltstack structure definition

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: Implement gethostname
Richard Henderson [Sat, 15 Sep 2012 20:20:46 +0000 (13:20 -0700)]
linux-user: Implement gethostname

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: Perform more checks on iovec lists
Richard Henderson [Sat, 15 Sep 2012 20:20:25 +0000 (13:20 -0700)]
linux-user: Perform more checks on iovec lists

Validate count between 0 and IOV_MAX.  Limit total length of
operation in the same way the kernel does.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: fix multi-threaded /proc/self/maps
Alexander Graf [Wed, 30 May 2012 12:45:21 +0000 (14:45 +0200)]
linux-user: fix multi-threaded /proc/self/maps

When reading our faked /proc/self/maps from a secondary thread,
we get an invalid stack entry. This is because ts->stack_base is not
initialized in non-primary threads.

However, ts->info is, and the stack layout information we're looking
for is there too. So let's use that one instead!

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>